A rough screen space reflections implementation based on Morgan McGuire's screen space ray tracing article and Kode80's Unity SSRR implementation.
scene with no normal maps, 1px stride, and 1000 steps
sponza scene from GLTF 2.0 example models
- Add option to disable fade based on distance. With glossy reflections we can progressively take larger and larger steps which let us sample further distances the glossier a surface is. However with fade based on distance glossy sufaces will have to fade at the same rate a sharp surfaces.
- Remove for loop ( unroll )
- Further avoid surfaces intersecting with themselves.
- Fix depth pyramid glossiness when passing behind objects.
- Blur intensity based on roughness (blur rougher surfaces more).
- Weight blur based on roughness similarity.
- Use bicubic filtering for mip map glossiness sampling
- Use metalness and roughness values to fade result hit (pack normal xy, metalness, roughness into single buffer)
- Use the normal / depth used for raymarching and compare that the to the current high def fragment in the upscale. The normal and depth in the blur loop body should be from the march uv but using that causes issues.
- Simplify step calculations.
- Understand TODO items in raymarch code -- how are we getting positive values for rayZMin? Why are we getting ray hits where there is no depth with ortho cam?
- Use a depth pyramid map to raymarch
- Use cheap rays for roughness
- Provide a minimum thickness for potentially thin objects?
- Investigate how incidence angle should play a role (Fresnel effect -- is it always relevant? What about for mirrors?)
- Optionally fall back to environment map
- Convert the sample radius for glossy sampling from world space to clip coordinates
- Objects in the close foreground can create incorrect reflections on the floor / further objects (looks like an interpolated sampling issue?)
- "Black" is considered close to the camera at the moment and is also the same as the clear color. So if there's no background elements then the unrendered space will look like it's "close" to the camera and cause intersections.
- This is complicated because the depths are negated and in the range
[ near, far ]. Fix this when the depth is changed to use another format later.
- This is complicated because the depths are negated and in the range
- At really glancing angles (especially far back on the sponza floor when moving the camera down) it looks like the rays are not actually hitting the wall in the back. Maybe it's because it hits itself? Or the depth behind it? Lowering the rendertarget and raymarch scale to 0.2 demonstrates this -- it looks like the pixels are hitting themselves
- Use mip LoDs for normals, color, depth? to blend the pixels
- Add a max loop iteration.
- Add loop unrollfor blur and raymarch.
- Use seperable blur.
- Use stencil mask to prevent raymarching on pixels that have a high roughness.
- Remove if statments.
- Use depth mip chains for raymarching.
- Simplify code.
- Remove type conversion in shaders.
- MRT
- Stop traversal if a ray goes behind a surface but does not hit.
- Perform a reuseable depth prepass to improve performance on all subsequent passes.
- Use explicit mip level fetch.
- Use explict pixel fetch from sample.
- Use WebGL custom mip maps.
- Generate non power of two mip maps
