This is the only tutorial I've seen so far that animated the matrix multiplication. That makes so much more sense now.
@hellishbro3 жыл бұрын
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]))
@nzuckman2 жыл бұрын
omg bless you
@remot1 Жыл бұрын
WIDTH = 100 HEIGHT = 100 LENGTH = 100 points = [] for x in range(-1, WIDTH, WIDTH): for y in range(-1, WIDTH, WIDTH): for z in range(-1, WIDTH, WIDTH): points.append(np.matrix([[x], [y], [z]])) *Matrices so you dont have to copy, even tho I made mine a lil different.* *_Projection & Rotation_* projectionMatrix = np.matrix([ [1, 0, 0], [0, 1, 0], ]) def Rx(angle): return np.matrix([ [1, 0, 0], [0, math.cos(angle), -math.sin(angle)], [0, math.sin(angle), math.cos(angle)] ]) def Ry(angle): return np.matrix([ [math.cos(angle), 0, math.sin(angle)], [0, 1, 0], [-math.sin(angle), 0, math.cos(angle)] ]) def Rz(angle): return np.matrix([ [math.cos(angle), -math.sin(angle), 0], [math.sin(angle), math.cos(angle), 0], [0, 0, 1] ]) *[!] --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- [!]* *You dont have to use np.dot(), you can use the @, matrix multiplication operator.* *Example: Matrix1 @ Matrix2* *[!] --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- [!]*
@sudolea2 жыл бұрын
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 !
@brickolo_ Жыл бұрын
I love how you got L's theme playing in the background lol, great tutorial
@halfsine2 жыл бұрын
uhhhhhhhhhhhhhhhhh mine generates a plane????? task failed succesfully
@iron4537Ай бұрын
When i tried doing it withouth matrixes using only trigonometry i had rhe same issue, i believe its because matrixes are assymetrical but what i did with trig wasnt
@cgiscript415 Жыл бұрын
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.
@nikolastamenkovic70692 жыл бұрын
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.
@kaklikcontapessoal1293 жыл бұрын
good video.teaches how to apply texture and apply a Z position and camera position and camera rotation
@atharvsharma25393 жыл бұрын
this is underated
@vinnn8694 Жыл бұрын
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.
@vinnn8694 Жыл бұрын
Although, I guess I will run into a problem. I am not sure what the right words are, but i guess i need orthographic perspective to get rid of the depth skewing? If anyone can help me with this, leave a comment pls :) Meanwhile I will try to figure it out myself.
@Sycro116 ай бұрын
@@vinnn8694 im a bit late but orthographic projection is a completely different thing and the whole purpose of using perspective projection is to see depth and majority of games use it. orthographic projection is mainly used for things like engineering where they dont want this depth.
@peeper207011 ай бұрын
Unexpected death note. Very unexpected.
@RenderingUser Жыл бұрын
man started this video like the monogatari series
@Dileuven2 жыл бұрын
I like that death note theme song in the background, makes it feel so dramatic.
@nio87393 жыл бұрын
freaking awesome dude!
@xixixitsme Жыл бұрын
this is art, congratulations!
@eagle_27123 жыл бұрын
incredible!! btw where did you get this cursor
@pythonista_3333 жыл бұрын
it's the default dmz white from ubuntu
@ajarivas726 ай бұрын
@@pythonista_333 Arigato
@jonasstrabel2 жыл бұрын
Nice Video! Learned a lot while being entertained!
@tsukigva61303 жыл бұрын
amazing video! learned a lot from it
@programm_mister96929 ай бұрын
Good job bro, How to a make a frustum projection?
@maynermoran Жыл бұрын
De aquí va a salir mi tesis gracias ❤
@linuslim38412 жыл бұрын
Could you map textures on the cube?
@evansmart-w9r3 ай бұрын
amazing! its so easy! thx!
@_doofiis74203 жыл бұрын
Nice use of the deathnote ost
@kevinquintana3085 Жыл бұрын
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)...
@64-bit632 жыл бұрын
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))
@SaferSephy Жыл бұрын
to solve the issue with matrix multiplication you have to match up the shapes in terms of mn * nm. Easiest to do this here is to transpose the point vertex with .T
@curcumin4176 ай бұрын
Awesome tutorial!
@tashadurrahman2 жыл бұрын
Oh man... you got the Death note music in the background
@BielDespair2 ай бұрын
Nice music from Death Note
@thingsss717Ай бұрын
amazing vid i finally understand
@9Lights Жыл бұрын
Wah! Your videos are too good for 385 subscribers. Thanks lot for the video tho.
@AntonioCesarAlvesАй бұрын
Welcome to Plato's Cave
@hezziacGames10 ай бұрын
Great to code along simple to follow as well as learned a few things... and i got a spinning cube on my computer 😎
@lyrabruno1Ай бұрын
Valeu, brazuca! Deu pra entender bem o inglês.
@pythonista_333Ай бұрын
esse video ficou meio cringe, olha o novo que eu postei, ficou daora :)
@ТимофейКарлин-е8с3 жыл бұрын
amazing thank you for video
@harigopaladamus94817 ай бұрын
bro entered the matrix 💀
@brodoshorts3 жыл бұрын
I LOVE YOU!!! 😍
@hessnin Жыл бұрын
the into says it all
@ranveerdev4514 Жыл бұрын
hi sir it is really good tutorial, can you tell me that how can we use arroy of other OBJ and then render that. Please reply me soon.
@renejr2006 Жыл бұрын
any idea how i can connect points to a 4d square using the p in range
@ravethefox2 жыл бұрын
i dont know if its my additions but i tested the code you uploaded and edited the cube to have a new point at 0,0,-1. i added the ability to control the rotation and scale. ive found that if when you start the program and rotate it in the x axis the point will be on the closest side of the cube to the camera while if you rotate it in the y axis it will be on the far side of the cube edit: sometimes both axis give the same result when starting the program and sometimes its the opposite
@ravethefox2 жыл бұрын
Nvm i think its just an optical illusion
@MarlandoCrosdale2 жыл бұрын
This was a really fun video and I enjoyed most of it, my only problem was that your approach on teaching wasn't what I was expecting, meaning you didn't explain everything. So a complete beginner or someone who had little to no knowledge of matrix or perspective would have been completely lost.
@1alexandermichael2 жыл бұрын
this video requires a basic understanding of linear algebra
@yongamamkolokotho99042 жыл бұрын
Watch a video by coding train on projection 3d he explains it.
@pythonista_3332 жыл бұрын
sorry about that ;( check out the coding train's video, im sure he can explain it better
@ziyadcodes2 жыл бұрын
How do I make it so that the line on the front appears over the line on the back?
@cheeseburgerinvr9 ай бұрын
That intro makes me scared already I knew this was a bad idea.
@theguy28873 жыл бұрын
i loved it!!! show to everybodyhow to make an first person!!! it will be awolsome.
@tonin84993 жыл бұрын
Hi ! Great video, worked like a charm :) But I have a question : why is the order of the points so important ?
@atharvsharma25393 жыл бұрын
Because the order matters for multiplication of matrices (in this case are (x , y , z) cordinates
@tonin84993 жыл бұрын
@@atharvsharma2539 Yes, you're right about multiplying the points with the rotation/projection matrixes, but what about the order of the points relative to one another ? He says the order in which the points are defined matters,at 9:00, but that, I don't get why
@dhpshow92772 жыл бұрын
@@tonin8499 because the order decides what dots get a line drawn in between then
@elmondo.2 жыл бұрын
Thank for sharing
@person101035 ай бұрын
is there a way to fill every face of the cube?
@westonkomar37673 жыл бұрын
Thank you
@royal-h3e Жыл бұрын
Hi! Your video is really helpfull, ty!!!
@musicandlength2 жыл бұрын
I am kira
@burhanyasir461411 ай бұрын
thee shape problem you were having on which you spent a lot of time researching it could be fixed by just adding the [0,0,0] at the end of the projection matrix. That's how I fixed it. And by the way the projection matrix is useless
@itzmeB23 жыл бұрын
Is there anyway I can add textures to it?
@pythonista_3333 жыл бұрын
well, that's a good question
@brainloading55433 жыл бұрын
You'd have to draw lines between the main lines
@itzmeB23 жыл бұрын
@@brainloading5543 what about points?
@brainloading55433 жыл бұрын
@@itzmeB2 wdym?
@itzmeB23 жыл бұрын
@@brainloading5543 can't u like get a points 3d position with the method in this video? Then u can just assign a color to that point and have textures
@commissarofpublicsafety2 жыл бұрын
This is godly
@devfromthefuture5063 жыл бұрын
🙏
@01bit Жыл бұрын
Thanks!!!!
@SquirtingBlood9 ай бұрын
when will there be new videos?(
@dynast75502 жыл бұрын
how do u get that cursor?
@tonytony-hz1cg3 жыл бұрын
You bloody bastard 😭 thank you bro it's for my project 😭 😭 😭 😭 😭 😭 😭 😭 😭
@erickcampos66512 жыл бұрын
the only thing I really didn't like was the music at minute 6:10. It was like The Omen's soundtrack.
@mohmedahmed66963 жыл бұрын
Hi thanks for the video can i snap mouse to any point and get its x, y and z coordinates?
@pythonista_3333 жыл бұрын
I'm sure you can get the X and Y, but I'm not sure for the Z axis. I've used orthogonal projection, perhaps in perspective projection you can get the Z axis somehow
@dhpshow92772 жыл бұрын
maybe get the x and y coordinates then do every thing you do to place dots in reverse
@ddoshostingeryeah91853 жыл бұрын
What type projection is this? Ortogonal or what?
@pythonista_3333 жыл бұрын
it's an orthographic projection
@prod_guzz Жыл бұрын
can u make a texture tutorial?
@simplyjemelah82762 жыл бұрын
hi I got this error with the code Traceback (most recent call last): File "C:/Users/Jemelah/AppData/Local/Programs/Python/Python310/cube1.py", line 1, in import pygame File "C:\Users/Jemelah/AppData/Local/Programs/Python/Python310\pygame.py", line 10, in pygame.display.set_caption("3D projection in pygame!") AttributeError: partially initialized module 'pygame' has no attribute 'display' (most likely due to a circular import)
@weversonch2 жыл бұрын
I wrote in javascript and the object shrinks in size. :(
@ohnocoder2 жыл бұрын
Why subtitles are blocked????!!!!?1!!!!!!111!/1?!/!?!!?
@qwaxi45123 ай бұрын
In OpenGL you will do the same concept but OpenGL is harder than PyGame
@joshuac52333 жыл бұрын
Can you add sides on this cube?
@pythonista_3333 жыл бұрын
you can use the pygame.draw.polygon to draw the sides. The problem is that, in this kind of projection, there is no sense of depth. This is something that I need to figure out. Probably One Lone Coder explains it
@joshuac52333 жыл бұрын
@@pythonista_333 thank you ^^
@charliegregg56913 жыл бұрын
@@pythonista_333 x*=z/math.tan(fov[0]/2) y*=z/math.tan(fov[1]/2) z=(z-ncp)/(fcp-ncp)*2-1) perspective projection into unit cube (if point in veiw it will be inside -1,-1,-1 to 1,1,1. screen x and y are x and y of new point) You may have already found this but I'll share it anyway.
@tiktoks4579 Жыл бұрын
it's cute
@chiranthchiranthmb29962 жыл бұрын
Do I hear death note baground
@oracuda Жыл бұрын
"how to make a 3d projection": shows orthographic projection
@iron4537Ай бұрын
People searchin for 3d prolly rlly want orthographic
@oracudaАй бұрын
@@iron4537 no they dont rofl
@iron4537Ай бұрын
@@oracuda yeah ig i over generalized, but some people do and i'm one of them
@samyakmarathe34343 жыл бұрын
If someone find it hard, try watching linear algebra series. In that way u can create this without even watching this video, like I did
@pythonista_3333 жыл бұрын
nice, idk linear algebra, but i think i learned something with this project. If I go to university someday, I will study linear algebra for sure :)
@samyakmarathe34343 жыл бұрын
@@pythonista_333 all the best
@sandiguha Жыл бұрын
Hi I make games with pygame. I want to meet more people who fiddles with pygame and game developement. Is there any group or hub you can suggest me please?
@tonin84993 жыл бұрын
does anyone know, or has a link on how to draw the faces ? thx :)
@jeas293 жыл бұрын
I think it's possible if you connect the points with polygons instead of lines. Then, you can set the color you want for the polygons. I don't know Pygame very well but I think there's a function to draw polygons.
@tonin84993 жыл бұрын
@@jeas29 thank you, yes you are right, pygame.draw.poly(surface,color,position_list). But my main concern is that, by doing so, they are going to overlap. I would like each face to be drawn only if it's on the front...
@timdoring8571 Жыл бұрын
@@tonin8499 Hey I have the exact same problem, did you find a solution in the meantime?
@tonin8499 Жыл бұрын
@@timdoring8571 oh hi haha, yes I did, you have two solutions (at least) : the painter's algorithm or per pixel rendering. Per pixel might be a bit overkill in this case, I'd suggest starting with painter's algorithm, it needs way less computing power. You basically have all your faces, you sort them by distance to the camera (you can average a point in the middle of the face for that), then draw them furthest to closest. But it's an approximation, you often get overlapping problems (that you won't have with per pixel). You also will get overdraw (drawing faces in top of each other), so the problem I pointed out previously about not wanting to draw hidden faces isn't solved. Still a good solution though. You can also choose to automatically subdivide large faces into several smaller faces to limit the size of artefacts. en.m.wikipedia.org/wiki/Painter%27s_algorithm I'd be glad to help you further if needed :), good luck, let me know if you managed to do what you wanted
@timdoring8571 Жыл бұрын
@@tonin8499 thanks for the quick reply! I'll get on it now :)
@spozniony54993 жыл бұрын
Wow and try make pyramid in the next video
@dhpshow92772 жыл бұрын
Just use this points = [] # all the cube vertices points.append(np.matrix([0, -1, 0])) points.append(np.matrix([0, -1, 0])) points.append(np.matrix([1, 1, 1])) points.append(np.matrix([-1, 1, 1])) points.append(np.matrix([0, -1, 0])) points.append(np.matrix([0, -1, 0])) points.append(np.matrix([1, 1, -1])) points.append(np.matrix([-1, 1, -1]))
@havitjustimagine1343 жыл бұрын
This is insine ! 👍
@carlosazuaje83813 жыл бұрын
Someone can help me to understood how he create a cube using arrays of [1, 0, -1]? I mean, Can I do that with all the geomety shapes? Any article or concepts to read?
@fumano26792 жыл бұрын
yes, 1,0,-1 are the coordinates of a point and so every point has 3 different values. it doesnt which shape basically. minecraft is good example how these coordinates work :)
@dhpshow92772 жыл бұрын
[1,1,1] = [X,Y,Z] then the array is for each coordinate he makes a dot. After he just connects the dots and its a cube
@sergiopuccini2 жыл бұрын
Wat about projection in perspective ? %(((((
@srblender53276 ай бұрын
i am comverting the code to work with geometry dash triggers XD
@coolmanthecool6038 ай бұрын
Why are you using python for this?
@iron4537Ай бұрын
Its not meant to be practical, and python is easy
@legendrags Жыл бұрын
Nice vid but WHY ON HELL DID U TEACH US ON LIGHT MODE DO U WANT TO BLIND US!?!?
@Crosbo13_yt8 ай бұрын
Ugh not again I made Minecraft i was trying to make a cube
@I_pvn17 күн бұрын
_vertex_
@WahranRai5 ай бұрын
Why mixing with pygame ! Just use numpy , your array multiplication (projection) and matplotlib to draw the figure. Keep it simple and stupid !
@pythonista_3334 ай бұрын
You're right! But pygame would give more views lol
@brycepersello53313 жыл бұрын
music annoying
@cyklop19773 ай бұрын
Thx
@bueno_excelente Жыл бұрын
Good job, now enter Z depth. Filling of polygons by scaline, and shading. There we will congratulate you, newbie
@jasonboyd782 Жыл бұрын
I can't stand stammering and stuttering speech, it drives me crazy.