Let's code 3D Engine in Python from Scratch

  Рет қаралды 378,758

Coder Space

Coder Space

2 жыл бұрын

This is a Tutorial on how to create a 3D Software Renderer in Python from Scratch. Numpy and Pygame libraries are used to create such a 3D Renderer (Engine)
More Python Projects: • Python Projects
SourceCode:
github.com/StanislavPetrovV/S...
#coderspace #python #3dengine #pygame #numpy
#programming #coding #programmer #developer #technology #code

Пікірлер: 360
@CoderSpaceChannel
@CoderSpaceChannel 2 жыл бұрын
This project was created to learn the basics of 3D. Of course, in terms of performance, Python is not the best option for this kind of thing, but it was pretty fun. And sorry for some grammatical errors
@starklosch
@starklosch 2 жыл бұрын
Don't worry. I just read that python will be faster in the next version.
@atharvkumar2564
@atharvkumar2564 2 жыл бұрын
How do you make that voice?
@ak-gi3eu
@ak-gi3eu 2 жыл бұрын
do you know what techstack they used in blender ?
@aaaowski7048
@aaaowski7048 Жыл бұрын
>from scratch lololol that means no libraries, right?
@borisu77
@borisu77 Жыл бұрын
it will always be much slower than strong-typed compiled languages, by design
@backroomsorigin
@backroomsorigin Жыл бұрын
As someone with a degree in Computer Graphics, this 15 minute video pretty much sums up 2 entire years of university studies. Good job
@zwwx2142
@zwwx2142 Жыл бұрын
can you give me advice recommendations I'm a beginner in Python
@aleksanderniemirka5258
@aleksanderniemirka5258 Жыл бұрын
wtf do you do on such a degree lol, i study computer science and this covers only half of the lecture
@popbob4780
@popbob4780 Жыл бұрын
@@aleksanderniemirka5258 even if that would be a lot
@SHORTstudios100
@SHORTstudios100 9 ай бұрын
@@zwwx2142did u ever find out how to get gud?
@marcocazar4266
@marcocazar4266 3 ай бұрын
Genial, yo hice lo mismo con vectores, pero es lento, con matrices por lo visto es más fácil y rápido. Muy buen video.
@djangofakkeldij
@djangofakkeldij 2 жыл бұрын
This is by far the best beginner friendly game engine tutorial. Good job!
@koferperk
@koferperk 2 жыл бұрын
indeed, very comprehensive!
@holygraphite1292
@holygraphite1292 2 жыл бұрын
😆 😆 😆
@user-dh8oi2mk4f
@user-dh8oi2mk4f 2 жыл бұрын
I wouldn't really call this a game engine tutorial, more like a computer graphics tutorial. For any real game engine, you would definitely want to access the GPU with something like OpenGL or DirectX.
@fulcanelly
@fulcanelly Жыл бұрын
but it's really hard to listen
@fulcanelly
@fulcanelly Жыл бұрын
@@user-dh8oi2mk4f why would I?
@stafan102938
@stafan102938 2 жыл бұрын
This has seriously helped me understand so many complex topics that I've been trying to get my head around for so long but have never clicked. Now I can go away and learn about them properly in depth with the context for their use in my mind. Great work, seriously!
@slimfpv
@slimfpv 2 жыл бұрын
The quality of this video is insane and im really happy for you it gets so much attention!!!
@sheylagreenperez1196
@sheylagreenperez1196 Жыл бұрын
I paused as you went along and did the steps myself and that helped a TON.
@tristanv6202
@tristanv6202 Жыл бұрын
This is wonderful and I have never seen such clean and effective python tutorial like this. I can only image what you could do with TensorFlow or PyTorch.
@unluckyaf7673
@unluckyaf7673 2 жыл бұрын
I feel the need to congratulate you, because this video was hard to make. Keep up the good work mate! Well done!
@skilz8098
@skilz8098 2 жыл бұрын
Very nice job and clear explanation of laying down the basic foundations in such a short period of time and not bad for a wireframe renderer within Python. It still has a ways to go when it comes to adding in materials and textures to each of the faces. Then you have lighting and shadow casting calculations which leads to shaders and pre and post processing within the graphics pipeline. After that, then it's a matter of building a Scene Graph where one object node can be in a nested tree like structure making it either a parent or a child node of another. Then once you have your tree structure or scene graph in place comes the concept of partitioning it to reduce your polygon count during the render frame calls such as quad trees or octrees as well as using or implementing a batch rendering process... There are many more things that go into a 3D Engine such as collisions, physics, particle generators, animations, GUIs, HUDs, etc... I'd happily call it a 3D Renderer or Model Viewer at this point, yet it still has a lot to be desired before calling it an "engine"... I'm only saying this not to put down your work, but from personal experience since I have made a 3D Graphics/Game Engine from Scratch in C++... And this here only touches the ground work or the basics... Keep up the good work, I'd love to see future videos to expand on this project. Maybe make a series out of it... P.S. Also most of this processing and drawing of vertices within this video is being done on the CPU... Most of this ought to be processed and passed off to the GPU... The GPU can process all of the vertex, pixel, index, lighting and shading calculations much more efficiently and significantly faster than the CPU. This is where graphics APIs such as OpenGL, Vulkan and DirectX come into play especially with their Graphics and Shader Pipelines.
@quefour9710
@quefour9710 2 жыл бұрын
@skilz8098 Do you have a video series where you walk through the design and coding of your gaming engine you mentioned in your response….? I am interested in learning if you have such a video series on building a 3D Engine.
@skilz8098
@skilz8098 2 жыл бұрын
@@quefour9710 Unfortunately I do not. And I spent several years in researching and learning how to build one. This goes back from about 2003 - 2015. It wasn't overnight and there is a lot involved. Currently I don't have the time nor the proper equipment to make a video series as I'm working a full time job. I would have referred you to some of the resources that I used but again many of them no longer exist. I gained information from 3DBuzz, MarekKnows and a few other sites that no longer exist. You can find some of their material on KZfaq. I also purchases a handful of books that are great reference materials but are now a bit dated yet their general principles still apply... There is a couple of websites that are still available that I can refer you to that is very good and is still up and running and they are www.learnopengl.com and www.rastertek.com and through them and other resources I've learned both the OpenGL and DirectX APIs as well as GLSL and HLSL. I also started to learn Vulkan too along with Spir-V however, instead of writing direct Spir-V code, I used tools to convert GLSL automatically into compiled Spir-V code. There's plenty of information out there, you just have to be willing to put in the time to do the research. And this only involves the "programming" side of things. You'll also want to brush up on your math skills, especially geometry, trigonometry, linear algebra(vectors, matrices and systems of linear equations), as well as classical physics.
@brunorcabral
@brunorcabral 2 жыл бұрын
I am also interested in seeing your code step by step
@7addisalem77
@7addisalem77 Жыл бұрын
This is by far the best beginner friendly game engine tutorial as a beginer i still fight to understand it but keep up the amazing job bro
@arrozyadifalaqi9292
@arrozyadifalaqi9292 Жыл бұрын
Nice video man, clear and concise explanation! Thanks a lot!
@josemfernandeza5979
@josemfernandeza5979 10 ай бұрын
A whole semester worth of classes in a single video, essential for my final exam and project, I owe you one.
@oeunsothearin9696
@oeunsothearin9696 Жыл бұрын
The introduction was very helpful, thanks!
@dr4kk0nnysinc59
@dr4kk0nnysinc59 2 жыл бұрын
Subscribed, liked, added to favorites and sent this video to a bunch of friends. Great job with the video man, you deserve infinite success
@p.k.953
@p.k.953 2 жыл бұрын
I did the same as well 🔥🔥👍👍
@Show-wi7cw
@Show-wi7cw 8 ай бұрын
😮😮😮😮😮😊😊😊😊😊
@ristopaasivirta9770
@ristopaasivirta9770 2 жыл бұрын
I wish this sort of video tutorial existed when I was young and learning about 3D engines and matrices.
@alexl4447
@alexl4447 11 ай бұрын
Wow, thank you for this most easily explanation. This will be my start of programming 3D models
@yohanaasintha5562
@yohanaasintha5562 Жыл бұрын
Thanks for the video! Very helpful and easy to follow instructions
@kossairezig
@kossairezig Жыл бұрын
THANK YOU SO MUCH THIS WAS EXTREMELY HELPFUL :D
@Mochammadsholehanwari
@Mochammadsholehanwari Жыл бұрын
Love your stuff! Big help!
@hacerdemirel9833
@hacerdemirel9833 Жыл бұрын
Very good! Thank you so much. I have already know most of that video. But I got the little miss parts. Perfect.
@timpi4ever
@timpi4ever 2 жыл бұрын
This is just beyond amazing 💯
@hamzaf19
@hamzaf19 5 ай бұрын
7:29 Thank you for explaining that one! I had issues really understanding the fourth homogeneous coordinate but now it's all made clear. Insanely instructive video.
@arjoai
@arjoai 5 ай бұрын
This is by far the best implementation video on 3D engines
@johnsmith1953x
@johnsmith1953x Жыл бұрын
*I remember when I wrote my first 3D engine on the Commodore64 back in the mid-eighties* I was so proud of myself too!!
@hugowinnberg
@hugowinnberg 2 жыл бұрын
This was amazing man greate tutorial
@locowachipanga561
@locowachipanga561 Жыл бұрын
Thank you very much, this is pure gold.
@AlpagaCoding
@AlpagaCoding 5 ай бұрын
Amazing! Thanks so much for this, I have been studying a bit of theory about this, and was looking for a practical example using python, it helped me a lot, please make more videos like this!😄
@homemrisonho5051
@homemrisonho5051 2 жыл бұрын
What a passion! What a dedication! What amazingness!
@eureka334
@eureka334 Жыл бұрын
This is by far the most underrated channel on KZfaq
@teslastellar
@teslastellar Жыл бұрын
Great tutorials 👍 subscribed 👍 keep up the good work.
@widizeiga3120
@widizeiga3120 Жыл бұрын
bro thanks so much, you actually made soft soft easy to understand
@twitch.sae7
@twitch.sae7 Жыл бұрын
TNice tutorials tutorial is so useful,I tried tons of other tutorials but tNice tutorials was the best one
@Radu
@Radu 2 жыл бұрын
Very nice :-) congratulations! Subscribed.
@theshoulderofgiants
@theshoulderofgiants 2 жыл бұрын
u deserve way more subs ..keep up the amazing work 💓💓
@homemrisonho5051
@homemrisonho5051 2 жыл бұрын
I just did! (ノ゚0゚)ノ
@kfirsw
@kfirsw Жыл бұрын
Thank you so much this helped a lot!!!! You saved my life
@dorukkarall9631
@dorukkarall9631 Жыл бұрын
Aweso tutorial bro! I like how you gets down to bus
@samarthpyati2855
@samarthpyati2855 2 жыл бұрын
You are very underrated my friend
@Somonreactionbd
@Somonreactionbd Жыл бұрын
even on my weak computer the installation did not take much time, thank you very much
@darklaker
@darklaker 11 ай бұрын
Clean and powerful code, i'll take the idea to test a dual camera projection on nreal air glasses since they are capable of showing stereo images. Thanks a lot.
@FilterYT
@FilterYT 2 жыл бұрын
Pretty Cool, Thanks!
@farazumer7961
@farazumer7961 Жыл бұрын
Very helpful explanation in easy way for beginners to understand game programming ant its complex geomerty
@its_code
@its_code 2 жыл бұрын
Wow 😳😲 amazing 😍 video
@user-bi9cg8oe3u
@user-bi9cg8oe3u 5 ай бұрын
Nice video, Thanks!
@janjamniksrpcic4517
@janjamniksrpcic4517 Жыл бұрын
Very well done!
@tibetphoto585
@tibetphoto585 Жыл бұрын
TNice tutorials is video is amazing! thanks for posting.
@Potatoinc-
@Potatoinc- Жыл бұрын
very helpful and simple man.. i tNice tutorialnk i'm gonna see all your videos
@ChrisHalden007
@ChrisHalden007 2 жыл бұрын
Great video. Thanks
@abdallahgaming548
@abdallahgaming548 Жыл бұрын
yours is perfect. These are going to takes loads of ti off the learning process.
@SudipBishwakarma
@SudipBishwakarma 2 жыл бұрын
This is so cool!
@coolbrotherf127
@coolbrotherf127 Жыл бұрын
It's true, it is nice to look at the cube.
@codecaine
@codecaine Жыл бұрын
Excellent work
@anhnhat35
@anhnhat35 2 жыл бұрын
thanks for sharing, so cool,!
@user-qd3rt6py7k
@user-qd3rt6py7k Жыл бұрын
my fav and tysvm for this tutorial it was helpful❤️.
@user-ch9zd8ev9z
@user-ch9zd8ev9z Ай бұрын
Wow finally I will make my own Blender ..thanks
@atibyte
@atibyte 8 ай бұрын
Nice job!
@KartikayBagla
@KartikayBagla 2 жыл бұрын
That's an interesting tutorial.
@starklosch
@starklosch 2 жыл бұрын
Nice video. Perhaps it would have been a good idea to mention that you used row major matrices and post multiplication. Notation may be confusing.
@hariangr
@hariangr 2 жыл бұрын
This is great and hella interesting
@rizzbod
@rizzbod Жыл бұрын
Soo good video content. Thnx buddy
@yolamontalvan9502
@yolamontalvan9502 8 ай бұрын
Great video easy to understand. Thank you. You forgot to mention what graphics software did you use to make your animations.
@V1SupremeMachine
@V1SupremeMachine 5 ай бұрын
10:35 "You can bend over and turn around" I died💀😂
@Noliv3
@Noliv3 Жыл бұрын
s and a couple EDM and Dubstep goals for myself, and I guess I better start learning sowhere. Thanks for the great vid!
@atharvkumar2564
@atharvkumar2564 2 жыл бұрын
Congratulations !!! You crossed 1k
@CoderSpaceChannel
@CoderSpaceChannel 2 жыл бұрын
wow! it made my day! thanks! 🥳
@astaghfirullahalzimastaghf3648
@astaghfirullahalzimastaghf3648 Жыл бұрын
@4:08 for 3d vector in python is it better to represent it using tuple instead of creating a class? because if we create a class we can do operator overloading for translation and scaling when required instead of multiply by 4x4 matrix
@MohamedSaeed-iv5dp
@MohamedSaeed-iv5dp Жыл бұрын
thank you very very very much, you help me a lot
@raphofthehills4405
@raphofthehills4405 2 жыл бұрын
Great mix of math basics & implementation tutorial. Which Python editor & Color Theme do you use ?
@CoderSpaceChannel
@CoderSpaceChannel 2 жыл бұрын
Thanks. This is Pycharm and monokai color scheme
@mikey-zk9nd
@mikey-zk9nd Жыл бұрын
You just deserved much more thab "just" over 300k subbers.
@Saw-qv3bl
@Saw-qv3bl 2 жыл бұрын
amazing video
@sebastienramdani985
@sebastienramdani985 Жыл бұрын
Thank you So much for ur ti and support
@stonyfever
@stonyfever 10 ай бұрын
Hello, I have an issue with vertices being shown behind the camera. I want to study how to implement frustum culling into your project, but I’m not sure where to begin. Any suggestions?
@lightyagami4530
@lightyagami4530 Жыл бұрын
I just smashed the subscribe button
@ivanmironov599
@ivanmironov599 Жыл бұрын
For those following the video, when writing out the code, it should be noted that "vertexes" is not a word and will not register IntelliSense to pop up, but "vertices" will.
@CoderSpaceChannel
@CoderSpaceChannel Жыл бұрын
Yes, most people prefer the term "Vertices". Both are perfectly acceptable according to: www.merriam-webster.com/dictionary/vertexes
@xskerrittx1
@xskerrittx1 Жыл бұрын
Please do another video on this! Not just wireframe, actual sides/faces to the 3d shapes! Lighting, etc!
@atharvkumar2564
@atharvkumar2564 2 жыл бұрын
I am your subscriber since you had 50 subs, today you have 973 subscriber.I like to see your channel grow in just three days + 500 subs in three days
@CoderSpaceChannel
@CoderSpaceChannel 2 жыл бұрын
thanks. this is really amazing and unexpected for me 🙃
@justkez2359
@justkez2359 2 жыл бұрын
This is pure amazing
@meditationandrelax6288
@meditationandrelax6288 Жыл бұрын
i love u so much bro, thanks very much
@mydoll.sweetdoll9540
@mydoll.sweetdoll9540 Жыл бұрын
thanks so much man
@ilookintofuture
@ilookintofuture Ай бұрын
you saved my grades thank you
@CubixCreations
@CubixCreations 2 жыл бұрын
What text-to-speech software do you use? It's pretty unnoticable and sounds great!
@CoderSpaceChannel
@CoderSpaceChannel 2 жыл бұрын
cloud.google.com/text-to-speech
@AK-jl6jy
@AK-jl6jy Жыл бұрын
Right here with ya, bro
@kazitahmin4535
@kazitahmin4535 Жыл бұрын
wow! thanks!
@ferferferSix
@ferferferSix Жыл бұрын
Thanks for your tutorial!!! I have a question, are there any posibility to load textures in your code (.mtl associated to the .obj)?
@CoderSpaceChannel
@CoderSpaceChannel Жыл бұрын
this project implements only simple concepts of 3D graphics, in your case you should look towards OpenGL or ready-made engines (Panda3D, UrsinaEngine, Harfang3D)
@justaneric
@justaneric 10 ай бұрын
Great video! How would I add texturing to my imported OBJ models though?
@HabiburRahman-dh7oy
@HabiburRahman-dh7oy Жыл бұрын
Thanks for lesson number one I'm going to leave ssages on a few of your posts and maybe even a few links to soft I make in the
@dataslid
@dataslid 2 жыл бұрын
Amazing
@alessandromarin3803
@alessandromarin3803 Жыл бұрын
You catch on really fast, it seems complex but once you learn the basics it pretty much branches into experintation
@JessicaMorgani
@JessicaMorgani Жыл бұрын
Can you use the code on this video as an engine? it seems to me like you'll have to code the equaltion again for every object!
@aaaaaaaaaaanys592
@aaaaaaaaaaanys592 Жыл бұрын
Thanks so much
@omnigeddon
@omnigeddon 2 жыл бұрын
Wow epic winz.. nice
@calculuslifer4024
@calculuslifer4024 Жыл бұрын
Bro has been coding since 1960... kudos
@collinthomas6288
@collinthomas6288 2 жыл бұрын
This was insane
@urielvargas6777
@urielvargas6777 5 ай бұрын
Is ther any sample of plane intersecting algorithm. I am looking for some calculations or code same like of how to get the line of intersection of 2 triangles in the space
@nobafan7515
@nobafan7515 10 ай бұрын
Will you be able to cover 3d model animations? I heard early 3d games had to make characters out of multiple objs until they found a way to make character models more realisticallythat bend and morph the mesh. Can you do that some day?
@smallbluemachine
@smallbluemachine Жыл бұрын
It's a great look at the fundamentals behind 3D geometry. -Also why you don't use Python if you do anything seriously in this area.
@SSibi
@SSibi Жыл бұрын
Thank you sir
@josephtanko
@josephtanko 2 жыл бұрын
Great tutorial, mine worked! But for some reason Files I export from blender can't be read
@costelinha1867
@costelinha1867 2 жыл бұрын
OOOOOOOOOOOOOO this is gonna be good.
@kimeg7294
@kimeg7294 Жыл бұрын
I've been analyzing this engine and was successful to get proper perspective and camera view working on my project. However as I move the camera forward and go past an object, the object reappears and moves away from the screen when it really should be BEHIND the camera view. It seems that your engine is having this issue as well, so I was playing with both engines to see if can be fixed but no progress yet. I suspect it may has to do with the vertical asymptote of the tangent function approaching either direction of infinity as the camera gets closer to the world coordinate origin.
@CoderSpaceChannel
@CoderSpaceChannel Жыл бұрын
need to implement Frustum Culling
@hxds299
@hxds299 Жыл бұрын
I keep coming back to those basics videos because I STILL don't know how to properly use the software. I'm gonna cry
@osamahalghamdi9955
@osamahalghamdi9955 Жыл бұрын
I see you are a man of culture as well
@garvitjain1623
@garvitjain1623 Жыл бұрын
please help I am having ValueError: setting an array element with a sequence. The requested array has an inhomogeneous shape after 1 dimensions. The detected shape was (2946,) + inhomogeneous part. This error, can't figure out why numpy is giving this?
Let's code 3D Engine in Python. OpenGL Pygame Tutorial
33:31
Coder Space
Рет қаралды 187 М.
The Beauty of Prime Numbers
10:54
Coder Space
Рет қаралды 38 М.
ТАМАЕВ УНИЧТОЖИЛ CLS ВЕНГАЛБИ! Конфликт с Ахмедом?!
25:37
Жайдарман | Туған күн 2024 | Алматы
2:22:55
Jaidarman OFFICIAL / JCI
Рет қаралды 1,8 МЛН
I Made a 3D Renderer with just redstone!
24:56
mattbatwings
Рет қаралды 1,3 МЛН
3 Hours vs. 3 Years of Blender
17:44
Isto Inc.
Рет қаралды 4,2 МЛН
Actually, Maybe There's Only 1 Game of Tic-Tac-Toe
11:58
Marc Evanstein / music․py
Рет қаралды 1 МЛН
Compiled Python is FAST
12:57
Doug Mercer
Рет қаралды 102 М.
Can I Run Youtube Entirely From My Terminal? (No Browser)
15:31
Making FPS Games in Python
8:52
Sacko
Рет қаралды 268 М.
The Math behind (most) 3D games - Perspective Projection
13:20
Brendan Galea
Рет қаралды 380 М.
God-Tier Developer Roadmap
16:42
Fireship
Рет қаралды 7 МЛН
How I Made The World with SINE
9:35
Coder Space
Рет қаралды 182 М.
2 YEARS of PYTHON Game Development in 5 Minutes!
4:54
Coding With Russ
Рет қаралды 868 М.