Raytracing is a PAIN to code...
Автор: MaxMakesGames
Загружено: 2024-02-25
Просмотров: 2811
Описание:
Raytracing meshes is a pain because you have to check all the triangles that make up the mesh... or do you ??? ( Vsauce music starts )
Raytracing part 1: • I Added RAYTRACING To My Voxel Engine ! ( ...
Checking if a ray intersects with a triangle is basic math that you can copy from smart people, but checking that for millions of triangles is gonna be way too laggy for real time raytracing. So how did I do it ?! Well I implemented bounding volume hierarchy ( BVH ).
BVH is used to split a mesh into a tree of smaller and smaller boxes until each box only has a few triangles ( I think in the best case it should be 1 only but in my case it's 9 or less ). Then when you trace a ray, you check for intersections with the main boxes, then the children of those hit, the children of the children hit, etc until you reach the leaf nodes that contain the triangles and then you check the triangles. Doing that, you only check intersections with a few boxes and triangles.
I also had to apply animations to my meshes. This is done by getting every frame the bone positions. Then applying their transform to each vertex based on the vertex's weights for each bone.
It was a lot of work and made the few neurons I have work very hard but I'm pretty happy with the results :)
---------------------------------
Subscribe for game making tutorials, other game-making related content and to follow my projects with the devlogs !
Повторяем попытку...
Доступные форматы для скачивания:
Скачать видео
-
Информация по загрузке: