How to make a 3D projection in Python | Rendering a cube in 2D! (No OpenGL)

preview_player
Показать описание
This is a tutorial that shows how to make a 3D projection using python and pygame.
This is a way of projecting 3D dimensions to 2D.
In this video we will project a cube :O

If I said something wrong, forgive me, because english is not my native language :P

#python #computergraphics #pygame #3D #gamedev

---

---

Songs used:
We Are The Champions
Queen

Lのテーマ
タニウチヒデキ

Low of Solipsism Ⅱ
平野義久

Semblance of Dualism
平野義久
Рекомендации по теме
Комментарии
Автор

This is the only tutorial I've seen so far that animated the matrix multiplication. That makes so much more sense now.

justinlua
Автор

here is a fun way to avoid copy pasting in the beginning :)

points = []
for x in (-1, 1):
for y in (-1, 1):
for z in (-1, 1):
points.append(np.matrix([x, y, z]))

hellishbrogaming
Автор

Perfect in its simplicity. Thank you for this video, and for showing the way how to do matrix multiplication in Python (still not the language of my preference however) ! After looking for some theory, this was the perfect "next-step"-hit !

sudolea
Автор

I just cant find the right words to explain how i am appreciate this. Man i spent weeks to understand 3d projection and because my math background is weak i just disappointed and stopped to try. But God finally sent you to me :) Thanks man, this is awesome explanation for aliens to 3d(like me). Also thanks again for funny presentation.

cgiscript
Автор

mine generates a task failed succesfully

halfsine
Автор

I love how you got L's theme playing in the background lol, great tutorial

brickolo_
Автор

Great tutorial!
My piece of mind on the "bracket" issue". In order to multiply matrices, number of columns of matrix on the left needs to be equal to the number of rows of the matrix on the right.

The projection matrix (P) is 3x3 matrix.
M1 = [x, y, z] is 1x3 matrix.
M2 = [[x]], [y], [z]] is 3x1 matrix. (It doesn't look so intuitive when there's only one element per row)

P x M1 -> not possible
P x M2 -> possible
M2 = (M1) transposed

So, even though you solved problem using reshape, I think that more accurate way is to use matrix transposition here. I've yet to start learning numpy, but i'm sure there is a function numpy.transpose() or something along those lines.

nikolastamenkovic
Автор

good video.teaches how to apply texture and apply a Z position and camera position and camera rotation

kaklikcontapessoal
Автор

Nice Video! Learned a lot while being entertained!

jonasstrabel
Автор

Thanks a lot, this was perfect for me as i could understand it and change it to my own needs.
I used it to create a Hexagon viewed from an x-axis angle.
Now I want to try making a game-grid for pygame from this.

vinnn
Автор

man started this video like the monogatari series

RenderingUser
Автор

I like that death note theme song in the background, makes it feel so dramatic.

Dileuven
Автор

Valeu, brazuca! Deu pra entender bem o inglês.

lyrabruno
Автор

Unexpected death note. Very unexpected.

peeper
Автор

Wah! Your videos are too good for 385 subscribers. Thanks lot for the video tho.

Lights
Автор

Great to code along simple to follow as well as learned a few things... and i got a spinning cube on my computer 😎

hezziacGames
Автор

The "set caption" piece killed me

cock_sauce
Автор

Man that's what I needed, an actual tutorial on drawing points and lines using a not so bloated library in a good language (fck java) in structured programming (fck classes), not to simple or starting from the ground and not too complex or starting with OpenGL (vulkan gives me nightmares)...

kevinquintana
Автор

You can do this on pydroid it works and i verified it (pydroid has diffrent interpretations of window you also gotta screen = display.set_mode((0, 0))

-bit
Автор

How do I make it so that the line on the front appears over the line on the back?

ziyadcodes