Metric / Materia

An open source alternative to Substance Designer written in C#
MIT License
330 stars 29 forks source link

Look at Adding GPU Raytracing #16

Open Metric opened 3 years ago

Metric commented 3 years ago

Need to look at adding GPU Raytracing compared to trying to implement Cycles renderer.

Metric commented 3 years ago

Note: https://github.com/erichlof/THREE.js-PathTracing-Renderer

This is done with Three.js and in browser at 60 FPS for the BVH Mesh and HDR example. Accomplished by compressing the geometry and aabb bounds down to a 2048x2048 texture each, and thus allowing GPU parallel processing per pixel, while using standard ray tracing algorithms. However, the algorithms have been adapted to reference the geometry and aab from a texture. This looks far more feasible to add in versus Cycles and Cycles is still CPU based. It is also release under public domain via CC0.

Will have to play around with implementing the BVH / HDR example and see how it does. The upside of using this method, is no texture data will need to be exported off the GPU and will still use OpenGL. In theory, this could be done on a Compute Shader, rather than a regular shader since we have full access to OpenGL 4.6.