mattboran / CudaRT

Photorealistic CPU or GPU (NVidia only) rendering engine written in C++/CUDA.
3 stars 0 forks source link

Change triangle representation #14

Closed mattboran closed 5 years ago

mattboran commented 5 years ago

Currently, the triangles are stored with all their vertices, all their normals, and UV data. This would be a big refactor, but how about we store the indexes of the triangles inside the vertex array and normals array? This could make the getNormalAt(...) function take longer but would require up to 3x less memory and potentially allow for better memory coherence.

mattboran commented 5 years ago

Related to #4 . #4 is much more doable if this is implemented and the triangle representation is simpler

mattboran commented 5 years ago

Closing this because I tried moving all the triangle data (there's still a branch: feature/41/bvh-textures that contains these changes) that moves all of the triangles to texture memory. The end result is more complicated, requires #ifdef __CUDA_ARCH__ everywhere, and is actually slower than just leaving the Triangle structs in global memory.