Update on PSX Shader Fog


Overview

In this update, made significant improvements to our PlayStation (PSX) shader. The primary enhancement is the addition of a fog effect, which helps replicate the classic look and feel of PSX-era games. This update affects both the OpenGL and DirectX versions of our shader.

Changes and Enhancements

1. Addition of Fog Effect

  • Fog Density Parameter
    • New Property: FogDensity
    • Description: Controls the density of the fog effect applied to the scene.
  • Implementation in OpenGL Shader
    • Vertex Shader:
      • Added a new varying variable depth to store the depth value.
      • Modified the w-component of the gl_Position to calculate the fog density.
      • Passed the depth value to the fragment shader.
    • Fragment Shader:
      • Used the depth value to calculate the fog effect.
      • Applied the fog effect by dividing the color by the depth value.
      • Ensured the fog effect does not exceed the original color values.
  • Implementation in DirectX Shader
    • Vertex Shader:
      • Added a new output variable PositionW to store the position in homogeneous coordinates.
      • Modified the w-component of PositionW to include the fog density.
      • Passed the PositionW value to the fragment shader.
    • Fragment Shader:
      • Used the PositionW value to calculate the fog effect.
      • Applied the fog effect similarly by dividing the color by the depth value.
      • Ensured the fog effect does not exceed the original color values.

    2. Improved Jitter Effect

    • Jitter Parameter Adjustments
      • Adjusted the calculation and application of the jitter effect to enhance the visual artifacts, making them more in line with PSX graphics.
      • The jitter effect now scales with a smaller factor to better simulate the desired visual effect.

    Files

    action_psx_DX.js 6.3 kB
    May 19, 2024
    action_psx_GL.js 4.5 kB
    May 19, 2024

    Get CopperCube PSX Shader

    Download NowName your own price

    Leave a comment

    Log in with itch.io to leave a comment.