#gamedev #opengl #3dgraphics
Hey all, here are some clips I took while building a new rendering pipeline for the 2X and 4Xzoom weapon scopes.
This pipeline involves:
rendering the gun and scope
rendering the nonzoomed scene behind the gun
rendering the zoomed scene within the scope
I use a stencil buffer to restrict the zoomed scene to the scope area.
Each scene stores a unique bit in an extra R8 framebuffer texture, which is used to differentiate between the different scenes in postprocessing shaders.
I apply postprocessing over the entire scene in one pass, using a different inverse view projection for each of the three regions (background, gun and scope) to reconstruct each pixel's worldspace position from a single depth buffer. This worldspace position is then used in lighting, shadows and SSAO shaders.
This seems to be rendering a lot faster than the old blurredbackground method, and the code is a lot simpler too! It feels great to be able to see around me while also aiming at a target through a 2X scope.
Music is by Punch Deck: / punchdeck
Join the Sector's Edge beta here: https://sectorsedge.com/d/zehh