Screen Space Reflections effect, enhancements to GLSL API for effects

scene_outline_ssr
90320562-8e97da80-df6c-11ea-8aee-a37195f4fbcc
90325816-a1c99b00-dfaa-11ea-9195-b15bac7ec4eb
90325645-54e4c500-dfa8-11ea-860a-cc7949262dca
90320557-8b045380-df6c-11ea-8133-a04edb399c17

With many thanks to Kagamma (Trung Le), we now support screen-space reflections in Castle Game Engine! It is a cool technique that generates reflections completely in screen-space, using color and depth buffer information to look for the reflected color.

It is trivially easy to use, just toggle TCastleViewport.ScreenSpaceReflections boolean. As we don’t have material information available in screen space (yet, because we do not have deferred rendering), so everything in the whole viewport is reflective now. That said, the effect is extra pretty and just works “out of the box” on various scenes, so I’m sure it will find it’s use even in current “everything is reflective” form 🙂 You can configure glossiness for the entire viewport by TCastleViewport.ScreenSpaceReflectionsSurfaceGlossiness (in 0..1 range, by default 0.5).

You can also test it with view3dscene, just toggle menu item View -> Screen Effects -> Screen Space Reflections.

Our screeen effects GLSL API also got a small upgrade by the way. We now expose screenf_01_position varying and functions screenf_01_get_color(...) and screenf_01_get_depth(...) to quickly query the screen.

More upgrades to screen effects are coming. I would like to wrap screen effects in components, designable in CGE editor!

1 Like