![]() That is why I decided to use a Wolfenstein 3D level for this demo. This makes it hard to pre-calculate and use BVH’s in WebGL1 shaders. Normally a bounding volume hierarchy (BVH) would be used as an acceleration structure to speed up the ray trace process, but my decision to make this project in WebGL1 didn’t help here: in WebGL1 it is not possible to upload 16-bit data to a texture and you cannot use binary operations in a shader. The problem of having a more complex environment is that I still had to be able to ray trace the scene in real-time. A brute force intersection loop where the ray is tested with all cubes and spheres in the scene is still fast enough to get a program that runs fine in real-time.Īfter creating the prototype, I wanted to make something more complex by having more geometry and by adding a lot of lights to the scene. This makes the ray tracing code in the shader straightforward. There is only one single light and just a few spheres and cubes are rendered. The light source itself is occluded by the brown wall on the left of the image. On the image to the right, you can see how all spheres are correctly lit by indirect lighting only (the light rays bounce on a wall behind the camera). ![]() The shader used to rasterize the geometry not only calculates direct lighting but also casts random rays from the surface of the rendered geometry to collect the indirect light reflection due to non-shiny surfaces (Diffuse GI) using a ray tracer. The prototype is based on a forward renderer that draws all the geometry in the scene.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |