Fighting Game · Guides & deep dives

V2 Colorblind Simulation Shader

The V2UI runtime owns the colorblind simulation post-process surface:

5sections2 minread

On this page

This runbook covers TODOS.phase-72.72.13.1.1: an engine-level colorblind simulation shader for protanopia, deuteranopia, tritanopia, and achromatopsia filters as a post-process.

Runtime Contract#

The V2UI runtime owns the colorblind simulation post-process surface:

  • shader source: V2/ue/Shaders/V2/Accessibility/V2ColorblindSimulation.usf
  • shader mapping: /V2/Accessibility
  • shader virtual path: /V2/Accessibility/V2ColorblindSimulation.usf
  • C++ header: V2/ue/Source/V2UI/Public/V2ColorblindSimulation.h
  • C++ source: V2/ue/Source/V2UI/Private/V2ColorblindSimulation.cpp
  • automation spec: V2/ue/Source/V2Tests/Private/UI/ColorblindSimulationShader.spec.cpp
  • contract: V2/ue/Content/V2/UI/Accessibility/ColorblindSimulationShader_V2_Contract.json
  • focused checker: V2/ue/Tools/check-v2-colorblind-simulation-shader.py

The module maps the shader directory during FV2UIModule::StartupModule with AddShaderSourceDirectoryMapping, so the pass can resolve the project shader by virtual path.

Supported Modes#

The post-process mode list is:

  • Protanopia
  • Deuteranopia
  • Tritanopia
  • Achromatopsia

The shader keeps Off as the no-op runtime state and publishes the four deficiency filters as selectable simulation modes.

Post-Process Behavior#

FV2ColorblindPostProcessPass defines the engine-facing pass descriptor:

  • pass name: V2.ColorblindSimulation.PostProcess
  • entry point: MainPS
  • consumes scene color
  • writes scene color
  • applies after tonemap
  • supports runtime strength blending from 0.0 to 1.0

The pixel shader samples SceneColorTexture, applies the selected simulation matrix, clamps the result, and blends it with the original scene color by V2ColorblindSimulationStrength.

Matrix Validation#

The C++ helper exposes the same normalized matrix coefficients as the shader:

  • protanopia: 0.567, 0.433, 0.000 / 0.558, 0.442, 0.000 / 0.000, 0.242, 0.758
  • deuteranopia: 0.625, 0.375, 0.000 / 0.700, 0.300, 0.000 / 0.000, 0.300, 0.700
  • tritanopia: 0.950, 0.050, 0.000 / 0.000, 0.433, 0.567 / 0.000, 0.475, 0.525
  • achromatopsia: 0.299, 0.587, 0.114 repeated across all three output rows

FV2ColorblindSimulationSettings::IsValidSettings requires a normalized strength, full-frame scene-color simulation, and post-process execution.

Verification#

bash
python3 V2/ue/Tools/check-v2-colorblind-simulation-shader.py
python3 V2/ue/Tools/check-v2-ci-workflow.py
python3 V2/tools/validate-v2-docs.py
python3 -m py_compile V2/ue/Tools/check-v2-colorblind-simulation-shader.py V2/ue/Tools/check-v2-ci-workflow.py
python3 -m json.tool V2/ue/Content/V2/UI/Accessibility/ColorblindSimulationShader_V2_Contract.json
python3 -m json.tool V2/ue/Build/Horde/v2-buildgraph-job.json

The automation spec is registered as V2.UI.Accessibility.ColorblindSimulationShader.AssetContract.

Required gates:

  • colorblind-simulation-shader-source
  • colorblind-simulation-shader-modes
  • colorblind-simulation-shader-post-process
  • colorblind-simulation-shader-matrices
  • colorblind-simulation-shader-automation
  • colorblind-simulation-shader-ci-wired