[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y ] [Search | Free Show | Home]

hey /g/, I want to understand how 3D engines work, in the sense

This is a blue board which means that it's for everybody (Safe For Work content only). If you see any adult content, please report it.

Thread replies: 14
Thread images: 1

File: maxresdefault (5).jpg (104KB, 1280x720px) Image search: [Google]
maxresdefault (5).jpg
104KB, 1280x720px
hey /g/, I want to understand how 3D engines work, in the sense of managing to convey 3D space through a 2D display.

Would you guys know any literature of note on the subject?
>>
>>58582060
You can start here https://www.youtube.com/watch?v=zb6Eo1D6VW8
>>
>>58582060
Imagine you have one of those plot point graphs like in grade school, now extend it outward from the board. You can place points in this now 3D "graph" just like you could before. Connect these points together and you can make triangles. Connect these triangles together and you can make shapes like squares, spheres, even complex looking things like a man's face.

This is basically an rough idea of how 3D graphics are stored in the computer. There's a problem however: when we look at things far away they converge to a point in the distance, with things up close looking more spread apart. If we were to directly draw a triangle that's immediately in front of the camera to the screen, and another triangle of the same size but simply 100 ft away from the camera, they would overlap perfectly. This is because obviously a 2D screen can't have depth. Everything kind of gets squashed/flattened together when it gets to the screen.

To counter this, at some point in sending the shapes over to the screen to be displayed, a mathematical transformation is applied (by which I mean we do some fancy multiplication). This transformation basically says that things that are farther back in our virtual 3D space will be moved closer to the center of the screen of the screen. This way, when things get squashed together, it looks like they're converging into a point off in the distance, just like in real life. If you want to see examples of before and after this transformation is applied lookup something like "orthogonal vs perspective view". An orthogonal view is how we refer to what it looks like before we move things around to make it look 3D.
>>
>>58582060
a shit ton of vector math
>>
>>58582060

Just google terms like "Software 3D Engine" and "3D Projection." For example, one of the first hits is:

https://www.sitepoint.com/write-3d-soft-engine-scratch-part-1/

Also, familiarize yourself with trigonometry, vectors, and linear algebra, because things like writing your own 3D engine are where the whole "you need to know math to program" thing comes from.

For a more general idea of how it works, imagine looking at an object through a window, and tracing individual rays of light. On the trip from the object to your eye, they're going to intersect with a 2D point on that window. One can make a right triangle by drawing a level line out beneath the angled ray of light, and then a vertical line up to where the ray of light comes from on the object. Some basic trig can then be used to determine how much shorter that vertical line needs to be to find its point on the window. You can then change where it intersects by moving your eye closer and farther away (field of view), moving your head from side to side, etc.
>>
>>58582262

This is actually informative

Am I on Reddit?
>>
>>58582125

https://www.youtube.com/watch?v=HQYsFshbkYw
>>
>>58582635
this is a good and informative video.
>>
>>58582060
Start looking at the ancient techniques such as raycasting first, then move on to newer stuff.
>>
Coding your own 3d engine in this day and age would be a collossal waste of time.
>>
>>58583412
just use unity amarite.
>>
>>58582060
There's released source codes for doom and such

why don't you try understanding that first, if you know math and C already
>>
>>58582262
Good explanation, I really enjoyed it, thank you.
>>
>>58582060
https://www.youtube.com/watch?v=HQYsFshbkYw

this guy explains things pretty well and he has quite many videos covering this topic.
Thread posts: 14
Thread images: 1


[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y] [Search | Top | Home]

I'm aware that Imgur.com will stop allowing adult images since 15th of May. I'm taking actions to backup as much data as possible.
Read more on this topic here - https://archived.moe/talk/thread/1694/


If you need a post removed click on it's [Report] button and follow the instruction.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com.
If you like this website please support us by donating with Bitcoins at 16mKtbZiwW52BLkibtCr8jUg2KVUMTxVQ5
All trademarks and copyrights on this page are owned by their respective parties.
Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.
This is a 4chan archive - all of the content originated from that site.
This means that RandomArchive shows their content, archived.
If you need information for a Poster - contact them.