Skip to content

01 · Write your first post-process ​

Add a mild warm tint and contrast while keeping UI readable. Prerequisites: chapter 00 and texture sampling/mix in GLSL essentials.

Changes and complete snapshot ​

Relative to 00, only present.psh changes effect logic. The manifest has a new example identity; resource/route/command counts remain 2 / 4 / 5. The download still contains all four files.

Download and inspect all files

Resource flow ​

scene/color → sample → contrast and warm tint → mix → present → screen

Sample source, apply 1.08 contrast around 0.5, multiply tint and blend with strength=0.65. Clamp limits the output to [0,1]. This is an RGBA8/LDR teaching transform, with no claim of linear-light processing, HDR or color-correct tone mapping. The fullscreen vertex shader generates a quad from gl_VertexID; the fragment shader runs for output pixels.

Complete shaders ​

glsl
#version 320 es
precision highp float;
out vec2 v_uv;
void main() {
    const vec2 corners[4] = vec2[4](vec2(-1.0, -1.0), vec2(1.0, -1.0), vec2(-1.0, 1.0), vec2(1.0, 1.0));
    vec2 position = corners[gl_VertexID & 3];
    v_uv = position * 0.5 + 0.5;
    gl_Position = vec4(position, 0.0, 1.0);
}
glsl
#version 320 es
precision highp float;
uniform sampler2D u_sceneColor;
in vec2 v_uv;
layout(location = 0) out vec4 o_color;
void main() {
    vec3 source = texture(u_sceneColor, v_uv).rgb;
    const vec3 tint = vec3(1.04, 1.0, 0.92);
    const float strength = 0.65;
    vec3 contrast = (source - 0.5) * 1.08 + 0.5;
    o_color = vec4(clamp(mix(source, contrast * tint, strength), 0.0, 1.0), 1.0);
}

Complete manifest ​

shaderpack.json
json
{
  "manifestVersion": 5,
  "sceneAbiVersion": 2,
  "expectedCatalogSha256": "4bc28c17beffea2311a422fff9f633d2e4f03784460d0254adda8af2e766d84c",
  "id": "course:01-first-post",
  "name": "DawnlightCore Course 01-first-post",
  "version": "0.1.0",
  "author": "EltanceX",
  "description": "Your first color effect; independent v5 course snapshot, runtime not yet verified.",
  "shaderRoot": "shaders",
  "options": [],
  "resources": [
    {
      "id": "course:scene/color",
      "kind": "texture2D",
      "lifetime": "persistent",
      "size": {
        "mode": "viewport"
      },
      "format": "rgba8"
    },
    {
      "id": "course:scene/depth",
      "kind": "texture2D",
      "lifetime": "persistent",
      "size": {
        "mode": "viewport"
      },
      "format": "depth24"
    }
  ],
  "programs": [
    {
      "id": "course:post/present",
      "kind": "graphics",
      "vertex": "fullscreen.vsh",
      "fragment": "present.psh",
      "compileMode": "manifestDriven"
    }
  ],
  "frameTarget": {
    "targets": {
      "colors": [
        {
          "location": 0,
          "resource": "course:scene/color",
          "loadOp": "clear",
          "storeOp": "store",
          "clearValue": [
            0,
            0,
            0,
            1
          ]
        }
      ],
      "depth": {
        "resource": "course:scene/depth",
        "loadOp": "clear",
        "storeOp": "store",
        "clearValue": 1
      }
    }
  },
  "passes": [
    {
      "id": "course:terrain_opaque",
      "enabled": true,
      "stage": {
        "template": "dawnlight:command_list",
        "version": 1,
        "target": "world",
        "phase": "opaque"
      },
      "services": [],
      "programs": [],
      "commands": [
        {
          "type": "engineDraw",
          "sceneProvider": {
            "id": "dawnlight:scene_draw/terrain_opaque",
            "version": 2
          },
          "targets": {
            "colors": [
              {
                "location": 0,
                "resource": "course:scene/color",
                "loadOp": "load",
                "storeOp": "store"
              }
            ],
            "depth": {
              "resource": "course:scene/depth",
              "loadOp": "clear",
              "storeOp": "store",
              "clearValue": 1
            }
          },
          "state": {
            "blend": "opaque",
            "depth": "default",
            "rasterizer": "cullCounterClockwiseScissor"
          },
          "viewport": {
            "source": "target",
            "restore": "frame",
            "synchronizeScissor": true
          }
        }
      ],
      "inputs": [
        "course:scene/color",
        "course:scene/depth"
      ],
      "outputs": [
        "course:scene/color",
        "course:scene/depth"
      ]
    },
    {
      "id": "course:terrain_alpha_tested",
      "enabled": true,
      "stage": {
        "template": "dawnlight:command_list",
        "version": 1,
        "target": "world",
        "phase": "opaque",
        "ordering": {
          "after": [
            "course:terrain_opaque"
          ]
        }
      },
      "services": [],
      "programs": [],
      "commands": [
        {
          "type": "engineDraw",
          "sceneProvider": {
            "id": "dawnlight:scene_draw/terrain_alpha_tested",
            "version": 2
          },
          "targets": {
            "colors": [
              {
                "location": 0,
                "resource": "course:scene/color",
                "loadOp": "load",
                "storeOp": "store"
              }
            ],
            "depth": {
              "resource": "course:scene/depth",
              "loadOp": "load",
              "storeOp": "store"
            }
          },
          "state": {
            "blend": "opaque",
            "depth": "default",
            "rasterizer": "cullCounterClockwiseScissor"
          },
          "viewport": {
            "source": "target",
            "restore": "frame",
            "synchronizeScissor": true
          }
        }
      ],
      "inputs": [
        "course:scene/color",
        "course:scene/depth"
      ],
      "outputs": [
        "course:scene/color",
        "course:scene/depth"
      ]
    },
    {
      "id": "course:terrain_transparent",
      "enabled": true,
      "stage": {
        "template": "dawnlight:command_list",
        "version": 1,
        "target": "world",
        "phase": "transparent"
      },
      "services": [],
      "programs": [],
      "commands": [
        {
          "type": "engineDraw",
          "sceneProvider": {
            "id": "dawnlight:scene_draw/terrain_transparent",
            "version": 2
          },
          "targets": {
            "colors": [
              {
                "location": 0,
                "resource": "course:scene/color",
                "loadOp": "load",
                "storeOp": "store"
              }
            ],
            "depth": {
              "resource": "course:scene/depth",
              "loadOp": "load",
              "storeOp": "store"
            }
          },
          "state": {
            "blend": "alphaBlend",
            "depth": "default",
            "rasterizer": "cullCounterClockwiseScissor"
          },
          "viewport": {
            "source": "target",
            "restore": "frame",
            "synchronizeScissor": true
          }
        }
      ],
      "inputs": [
        "course:scene/color",
        "course:scene/depth"
      ],
      "outputs": [
        "course:scene/color",
        "course:scene/depth"
      ]
    },
    {
      "id": "course:terrain_sorted_translucent",
      "enabled": true,
      "stage": {
        "template": "dawnlight:command_list",
        "version": 1,
        "target": "world",
        "phase": "transparent",
        "ordering": {
          "after": [
            "course:terrain_transparent"
          ]
        }
      },
      "services": [],
      "programs": [],
      "commands": [
        {
          "type": "engineDraw",
          "sceneProvider": {
            "id": "dawnlight:scene_draw/terrain_sorted_translucent",
            "version": 2
          },
          "targets": {
            "colors": [
              {
                "location": 0,
                "resource": "course:scene/color",
                "loadOp": "load",
                "storeOp": "store"
              }
            ],
            "depth": {
              "resource": "course:scene/depth",
              "loadOp": "load",
              "storeOp": "store"
            }
          },
          "state": {
            "blend": "alphaBlend",
            "depth": "default",
            "rasterizer": "cullCounterClockwiseScissor"
          },
          "viewport": {
            "source": "target",
            "restore": "frame",
            "synchronizeScissor": true
          }
        }
      ],
      "inputs": [
        "course:scene/color",
        "course:scene/depth"
      ],
      "outputs": [
        "course:scene/color",
        "course:scene/depth"
      ]
    },
    {
      "id": "course:present",
      "enabled": true,
      "stage": {
        "template": "dawnlight:command_list",
        "version": 1,
        "target": "afterDraw",
        "phase": "screenOutput"
      },
      "services": [],
      "programs": [
        "course:post/present"
      ],
      "commands": [
        {
          "type": "present",
          "program": "course:post/present",
          "bindings": [
            {
              "kind": "sampler2D",
              "symbol": "u_sceneColor",
              "binding": 0,
              "resource": "course:scene/color"
            }
          ],
          "state": {
            "blend": "opaque",
            "depth": "disabled",
            "rasterizer": "cullNoneScissor"
          },
          "viewport": {
            "source": "frame",
            "restore": "none",
            "synchronizeScissor": true
          }
        }
      ],
      "inputs": [
        "course:scene/color"
      ],
      "outputs": []
    }
  ],
  "sceneCategories": [
    {
      "id": "dawnlight:scene/terrain_opaque",
      "version": 1,
      "mode": "builtin"
    },
    {
      "id": "dawnlight:scene/terrain_alpha_tested",
      "version": 1,
      "mode": "builtin"
    },
    {
      "id": "dawnlight:scene/terrain_transparent",
      "version": 1,
      "mode": "builtin"
    },
    {
      "id": "dawnlight:scene/terrain_sorted_translucent",
      "version": 1,
      "mode": "builtin"
    }
  ]
}

Checks and images ​

Extract to a fresh directory, open PowerShell in that pack root and use the pinned Analyzer installed in environment setup. Expected: exit code 0 with no diagnostics; scene shows four active Terrain routes. Static checks do not compile against a real driver.

powershell
$analyzer = "C:\Tools\Dawnlight\shaderpack-analyzer.exe"
& $analyzer pack validate . --format json
& $analyzer scene explain . --include-inactive --format json
& $analyzer graph dump . --contract 2 --include-inactive
& $analyzer program interface . --program course:post/present --contract 2

Actual game observations

Loaded, reloaded, resized between two window sizes and returned to BuiltIn on the recorded Windows host and NVIDIA driver. All reported Programs linked; Analyzer matched the driver report and every pack-owned Program interface. The image is a single-scene observation of this source snapshot.

588f68099eaaf03bd7835e7d591d84bcc8f5fbe6453fcf1bb9f356621ef4474e

Matched driver report · Lifecycle observations

Scene output with mild warmth and contrast.

Test host, method and limits →

Troubleshooting ​

No change: edit shaders/present.psh in the active child directory, save and force-reload; refreshing discovery does not recompile. White/black output: set strength to 0 to isolate sampling, then check for an accidental tint of 104. On compilation failure, check semicolons, types and the file/line diagnostics.

Exercise ​

In a working copy set strength to 0, reload, then set it to 1. Explain both mix endpoints. Modified bytes have a different identity: record the edit rather than reusing the original ZIP receipt as evidence for changed source.

Runtime method and evidence · Next: 02 · Add a separate post-process resource

Author documentation · Manifest v5 / Scene ABI v2