Adding Back World Reflections


The last major feature I wanted to get into this rework was world reflections. That is still missing from the last release which was v1013. delayed doing this change because the original code would re-execute the main draw loop and flag out portions of the draw to skip. Harder to implement this when the draw pipeline is being changed frequently, I needed to work out how the extract the logic and execute a portion of the draw call. instead of flagging points in the draw call I just pulled them into separate methods and reconstructed a part of the draw call. Easier to manage without having to worry about side effects due to a recursive call.

These reflections use an oblique near clip plain to implement this. the camera is mirrored on the other side of the reflected surface and renders the scene from that perspective to produce this. Doing this does not quite work if there is existing geometry obscuring the view so an oblique projection matrix is used to clip the geometry to the reflected surface.

The base game was written in opengl so the clip plan goes from -1 to 1. so in the image below only half the reflection is rendered more modern API's will use a clip plan from 0 to 1. Additional detail can be found here: https://forum.gamemaker.io/index.php?threads/projection-matrix-with-oblique-near...

This change was made to the oblique near clip plan to correct for the change in the clip plane. 


This image demonstrates how the near clip plan cuts half the bowl else that would be obscured by the geometry below the waters surface. The rest of the draw call works the same.

here is the final frame to the player


Get Amnesia The Dark Descent Redux

Leave a comment

Log in with itch.io to leave a comment.