A downloadable asset pack

There are two versions to download based on engine version.

This is a camera shader for Godot 4 to add distance fog with optional noise, color limiting, and dither that I am using in my helicopter project. There are a lot of fragmented and partial solutions out there and I wanted to combine various techniques to make an easy to use quad-based shader. Each setting can be enabled/disabled and customized. I have tested this in small maps (100×100) as well as large maps (6000×6000) with no issues.

For the fog, I took direct inspiration and direction from the excellent Godot4-ScreenSpacePostFX-DepthFog by zvodd. His technique is different (using viewports) and contains features mine does not, so please check it out! The color reduction and dithering techniques are my own.

If starting from scratch, create a new 3D scene and add a camera. Create a new MeshInstance3D as a child of the camera, assign it a QuadMesh, then make the size 2×2. Check the box “flip faces”. Move the mesh so it’s in front of the camera very slightly. Then all you need to do is give the QuadMesh a new material -> New ShaderMaterial -> New Shader. Assign the psx_camera_shader.gdshader to the material and boom you’re done. Check the shader parameters to make adjustments and edit everything:

  • Enable Fog – Enables/disables fog  
  • Fog Color – Color of the fog  
  • Noise Color – Color of the noise overlayed on top of the fog  
  • Fog Distance – The distance in units away from the camera the fog is completely opaque  
  • Fog Fade Range – How much distance the fog will take to fade to opaque 
  • Enable Noise - Enables/Disables noise 
  • Noise Time Fac – The amount and movement of the noise  
  • Enable Color Limitation – Enables/disables limiting the colors  
  • Color Levels – Amount of colors allowed onscreen if Enable Color Limitation is checked  
  • Enable Dithering – Enables/disables dithering  
  • Dither Strength – Higher number mean bigger dots 

NOTE: If you have any transparent objects in your scene (meshes, sprites, etc) this shader won’t “see” them as the render mode doesn’t allow alpha transparency. In order to have transparent objects been seen you must change the “Render Priority” of each object to a number higher than “0” so the transparent object is drawn after the shader kicks in. Everything in the editor is set to “0” for a new project, so in most cases setting this to “1” for Each transparent object will be adequate.

Why 2 versions?

Godot 4.3 introduces reverse z, which breaks depth based fog shaders like this. I've included a legacy version for Godot 4.2 and below, but the 4.3 version will be the only maintained one in the future.

Download

Download
PSX-Style-Camera-Shader-4.3-version-2.zip 20 kB
Download
PSX-Style-Camera-Shader-4.2.zip 67 kB

Install instructions

Download and unzip, then import in the Godot Project Manager

Development log

Comments

Log in with itch.io to leave a comment.

Génial

Thank you!