Godot Shaders

A collection of shaders I have written in Godot GLSL 3. The source code of all these shaders is available on GitHub.


Summer 2021


The forcefield shader can be applied to any mesh to turn it into an energy shield. The most important feature of the resultant mesh is its dynamically adaptive border. By sampling both the screen depth texture and the fragment depth, the shield is given highlights near object intersections. This, combined with a fresnel effect, gives the shield a fully adaptive outline. The shield can be given a texture, such as hexagonal, and can change color. It can also portray damage through appearing holes, and has a built-in activation/deactivation effect.


Spring 2021

Lost Souls

This atmospheric effect is a layering of two separate screen-space shaders – a simple partial greyscale, and the more involved rain shader. The source of the rain pattern itself is a black and white texture passed as a uniform, which is then scrolled with respect to time. The rain pattern is used as a distortion heatmap for an applied pixel offset. Being a screen space shader, the rain does not move as the game camera moves, not natively, something that is undesirable as it gives the rain the appearance of sliding left or right with respect to the world. To combat this, the shader takes a camera position uniform and compensates appropriately. A similar approach is taken with display aspect ratio upon window resizing to prevent texture distortion.


Spring 2021

Lost Souls

This shader is a screen-space shader which allows a player character to be seen behind foreground objects when applied to these objects. The player’s current screen position is passed as a uniform to the shader, as well as the current aspect ratio, which is used to avoid distortion upon window resize.