PSX Style Camera Shader for Godot 4
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.
Status | Released |
Category | Assets |
Rating | Rated 4.5 out of 5 stars (2 total ratings) |
Author | Immaculate Lift Studio |
Made with | Godot |
Tags | 3D, camera, color, dither, fog, Godot, PSX (PlayStation), Retro, Shaders |
Code license | MIT License |
Download
Install instructions
Download and unzip, then import in the Godot Project Manager
Development log
- Various tweaksJul 20, 2024
- Upgraded for Godot 4.3Jul 18, 2024
Comments
Log in with itch.io to leave a comment.
Hey! love the look of your shader! However I was wondering if you know how I can have this shader ignore the WorldEnvironment/skybox?
I've been struggling to make it so that I can see the Sky through the Fog.
Hi there! There's no way I'm aware of to alter my shader's fog so you can see the skybox. However, if you're using Godot 4.3 or newer, I highly recommend using the engine's fog instead of mine! You can use my shader's color/dithering effects alongside it for whatever look you'd like. That's what I'm doing in my own projects. I'm happy to help you out if you need.
Thank you for the reply! I'll try that then!
Good luck! I believe the setting in Godot's Environment node (within the distance fog section) is "Sky Affect", with which a value of 1.0 will obscure the sky, and 0.0 will result in the sky completely ignoring the fog.
Hi
Can this be used on scenes that have multiple fixed camera angles?
Hi there! I don't know, I've only used it with single-camera setups. However, I would think that as long as each camera has it's own quad with the shader to "see" through, there shouldn't be an issue.
If it doesn't work, please go to my Github and open an issue. I'll see what I can do to help!
Génial
Thank you!