This page documents the full render pass architecture of retroview for developers and curious users who want to understand how the retro visual effect is constructed — or who want to modify the shader for their own needs. Passes run in the order listed below, each reading from and writing to named color buffers (Documentation Index
Fetch the complete documentation index at: https://mintlify.com/project516/retroview/llms.txt
Use this file to discover all available pages before exploring further.
colortex0–colortex2).
Buffer layout
| Buffer | Format | Contents |
|---|---|---|
colortex0 | RGB16 | Scene color (written by gbuffers, read by every subsequent pass) |
colortex1 | default | Lightmap UV (lmcoord.xy) — blocklight X, skylight Y |
colortex2 | default | Encoded surface normal (normal * 0.5 + 0.5) |
shadowtex0 | depth | Shadow map including transparent geometry |
shadowtex1 | depth | Shadow map for opaque geometry only |
shadowcolor0 | color | Tinted shadow color for stained glass, etc. |
Render passes
gbuffers passes — geometry to G-buffers
The gbuffers family of shaders runs first, once per rendered object type. They write raw scene data into the three color buffers that all later passes read from.gbuffers_terrain handles opaque blocks. It writes to all three render targets:gbuffers_water handles translucent geometry (water, ice). It only writes color (gbuffers_entities handles mobs and items, and additionally supports the entity flash color (used for hurt/invincibility frames):
RENDERTARGETS: 0) and applies the lightmap directly in the fragment shader rather than deferring it:shadow pass — depth map from the light's perspective
The shadow pass renders the scene from the sun/moon’s point of view into the shadow buffers. retroview uses a 2048×2048 shadow map (Shadow clip-space positions are warped by The composite pass applies this distortion before sampling The
shadowMapResolution = 2048):lib/shadowDistort.glsl before sampling. The distortion compresses the outer regions of the shadow map, trading far-field precision for better resolution near the player:shadowtex0 / shadowtex1:0.001 z-bias prevents self-shadowing (shadow acne) on flat surfaces.deferred pass — passthrough
deferred.fsh is a simple passthrough that copies colortex0 unchanged. It exists as an architectural hook — the deferred stage runs after all opaque geometry but before the composite passes, making it the correct place to insert screen-space effects that need a complete opaque scene (SSAO, screen-space reflections, etc.):composite — main retro pass
composite.fsh is where all of retroview’s signature effects are applied. It reads the G-buffer data, reconstructs lighting, and applies the full retro filter stack in a fixed order.All effect strengths are driven by the uniforms declared at the top of the file with their defaults:retroPixelScale pixels, then sampling colortex0 at that snapped UV. This is what makes the image look lower-resolution without actually changing the render resolution:pow(color.rgb, 2.2) converts the sampled sRGB texture into linear light for correct lighting math.Lighting reconstructionThe lightmap values from colortex1 and the encoded normal from colortex2 are used to reconstruct per-pixel lighting. The world-space position is reconstructed from depth to compute shadow coordinates:retroLevels discrete steps, breaking up color banding:pow(..., 2.2)) so the remaining effects operate in linear light.Scanline darkeningEvery other row of pixels is attenuated by retroScanStrength. The step function selects which rows are darkened:smoothstep between retroVignetteInner and retroVignetteOuter (both in normalized UV distance from screen center):colortex0 at a slightly offset UV and blending it in. This emulates the horizontal color bleeding of CRT phosphors:composite1 — atmospheric fog blending
composite1.fsh reconstructs view-space depth from depthtex0 and blends the scene color toward fogColor using an exponential fog curve. FOG_DENSITY is a compile-time constant:depth == 1.0) are skipped — fog is only applied to scene geometry.final — sRGB gamma correction output
final.fsh converts the linear-light result from all composite passes into the sRGB color space required by the display. This is the only operation it performs:final.fsh applies the gamma curve exactly once at the end of the pipeline.Uniform reference
All tunable uniforms are declared incomposite.fsh with their default values. Iris shader packs expose these via shaders.properties or #define blocks for in-game sliders.
| Uniform | Default | Effect |
|---|---|---|
retroLevels | 31.0 | Number of discrete color steps per channel |
retroPixelScale | 5.0 | Pixel block size in screen pixels |
retroDitherStrength | 1.0 | Dither offset magnitude relative to one color step |
retroScanStrength | 0.08 | Fraction of brightness removed from even scanline rows |
retroVignetteStrength | 0.25 | Peak darkening at screen edges |
retroVignetteInner | 0.35 | UV distance from center where vignette begins |
retroVignetteOuter | 0.90 | UV distance from center where vignette reaches full strength |
How to modify retroview
How to modify retroview
retroview is licensed under GPL-3.0. You are free to modify and redistribute it with attribution and under the same license.The files most commonly modified and what they control:
To add a new tunable parameter, declare it as a
| File | What to change here |
|---|---|
shaders/composite.fsh | All retro effect parameters and their defaults; lighting color constants; pixelation, dithering, scanlines, vignette, color bleed |
shaders/composite1.fsh | Fog density (FOG_DENSITY) and fog falloff curve |
shaders/final.fsh | Gamma exponent for final output (default 1/2.2 for sRGB) |
shaders/deferred.fsh | Insert screen-space effects that need the full opaque scene (SSAO, etc.) |
shaders/gbuffers_terrain.fsh | Opaque block rendering and G-buffer layout |
shaders/gbuffers_water.fsh | Translucent geometry rendering |
shaders/gbuffers_entities.fsh | Entity rendering, including hurt flash |
shaders/lib/shadowDistort.glsl | Shadow map distortion function — adjust 0.1 bias to trade near/far shadow precision |
uniform float with a default value in composite.fsh and expose it via shaders.properties for an in-game slider.