3D Rotation & Projection using Python / Pygame

preview_player
Показать описание
This video was inspired by pythonista's 3D projection video. Link is included in the references section below.

In this tutorial I go over the math behind 3d projection/rotation and write code to display the projection of a rotated cube onto a pygame window.
If you followed the tutorial fully, thank you! You can also try creating your own 3-D points by making a new list of 3-d coordinates and iterating through those points instead of the points in cube_points! (ex. try a pyramid shape!)
Source Code:

References:

Chapters:
0:00 Introduction
0:17 Projection and Rotation Math
6:35 Coding
24:03 Conclusion

Disclaimer: I do not claim that I am 100% correct in everything that I say in my videos. I would never intentionally misinform my viewers but mistakes can happen. Keep in mind that I am not a professional. Please let me know if there is any misinformation in my video and I will make sure to fix it. Thanks!
Рекомендации по теме
Комментарии
Автор

Hi everyone,

Thank you all for the kind comments. I see all of them and appreciate every one. I never expected this video to reach so many people.
If I didnt' respond to your question, it unfortunately means I don't know the answer and I don't want to invest the time to figure out the answer - sorry.
Although the space is still very fascinating, Game development/math is no longer my main topic of interest since I started web development professionally.

I originally decided to make the 3D projection video because there weren't a lot of videos on YouTube explaining both the math and the code behind it.
Although I'd be happy to upload videos on web development, there is already so much content out there that it feels redundant.

That said, I'm pretty curious about your guys' main topic of interest so it would help a lot if you could leave a comment here on what kind of content you'd like to see, if any.
Depending on whether my knowledge/interest and your guys' interests align or not, I'll try coming up with another video idea for the future.

Thank you all again

yutaa.
Автор

just what I was looking for. Very clear explanation. This guy deserves more recognition

lpi
Автор

The Time I spent trying to find a video like this that explains the maths behind it!

EDIT:
You need more subs this is AMASING

TheSecretDev
Автор

Very clear. Next step how to fill the polygons of the cube with a solid color or texture please

enricopassoni
Автор

Oh wow, what a journey! I really enjoyed this video! Thanks for helping me understand how pygame generates 3D objects!

Phostings
Автор

genuinely one of the best tutorials ever
thanks!

kelpR
Автор

Great video! Just one correction for the newcomers: remove the key detection from the event loop and put it inside the main loop, so it doesn't depend on the amount of events coming in.

leobozkir
Автор

Good tutorial! Thanks! I was playing around with PyGame a little today, and I was wondering how to do something like this. I was already familiar with rotation matrices and matrix calculation in general, but wasn't sure how to actually code it in Python. This helped a lot!
You, sir, have got yourself a subscriber!

LukeLane
Автор

Iv watched so many videos and this is the first one that I actually understood about 3d. Thank you seriously

crime
Автор

Finally understood matrices after this thank you

danhadland
Автор

This is amazing video with great explanation math behind it, which is really important to understand. Thank you

archyt
Автор

I havent tested your code but its calculated in the same way as many other python tutorials which cover up a fatal flaw by using a cube. The issue is that in certain conditions the polarity of the value of the z axis flips in all points which is invisible on a cube

ravethefox
Автор

This is so cool and really well made :)

treechickens
Автор

me looking for hours finds this video and expirences joy

BeBetter_-_
Автор

wow thank you your'e so i've learnt a lot of you

BlinkersGameDev
Автор

17:09 experiment with frames to understand the projection better. I did that on 1 frame, and could understand what was going on.

BlinkersGameDev
Автор

Awesome.. I hope you will cover Quatrnions some day..

rupeshkanth
Автор

How to rotate an object about its centroid
Or how to rotate based on a arbitrary point

jotdown
Автор

Could you please do a video on gestener waves implementation in python?

austineadah
Автор

Cool 👍 Just subbed. I'm using pygame for dev tools and puzzles... When I get the time.

nerdyturkey
welcome to shbcf.ru