Instead, this method is more like a game of battleship. This first intersection point is the only valid point to reflect in the current fragment. Ideally there would be some analytical method for determining the first intersection point exactly. If there is an intersection, that position in the scene is a potential candidate for being reflected by the current fragment. With each iteration, the algorithm samples the scene's positions or depths, along the reflection ray, asking each time if the ray intersected with the scene's geometry. It tries to find the reflected point the light ray bounced off of and hit the current fragment. SSR is the process of tracing the light ray's path in reverse. Intuitively, a light ray hits some point in the scene, bounces off, travels in the opposite direction of the reflected position vector, bounces off the current fragment, travels in the opposite direction of the position vector, and hits the camera lens allowing you to see the color of some point in the scene reflected in the current fragment. The ray in screen space reflection is the position vector reflected about the normal. Ray marching is the process of iteratively extending or contracting the length or magnitude of some vector in order to probe or sample some space for information.
Screen space reflection uses a technique known as ray marching to determine the reflection for each fragment. This illusion holds for the most part but SSR does fail in some cases as you'll see. By reflecting your screen onto itself, you can create the illusion of reflection. In SSR, you reflect a ray from some point on your screen to some other point on your screen. In cube mapping, you reflect a ray from some point in your scene to some point on the inside of a cube surrounding your scene. Compare this to cube mapping which uses six screens or textures. SSR works by reflecting the screen image onto itself using only itself. Instead of the light ray coming from the source and bouncing off into the camera, the light ray comes from some object in the scene and bounces off into the camera. Similarly, using screen space reflection or SSR, you can simulate the reflection of other objects in the scene instead of just the light source. Recall that the specular light was computed using the reflected light direction. This was the process of rendering the specular reflection. In the lighting section, you simulated the reflected, mirror-like image of the light source. With reflections, you can really sell the illusion of water and metallic objects.
Wet and shiny objects spring to life as nothing makes something look wet or shiny quite like reflections. ◀️ ⏫ ? ? ▶️ 3D Game Shaders For Beginners Screen Space Reflection (SSR)Īdding reflections can really ground your scene. Screen Space Reflection | 3D Game Shaders For Beginners