Skip to content

Modernize TEN lighting with HDR, GGX materials, bloom and softer shadows#6

Draft
illyaine wants to merge 115 commits into
masterfrom
feature/ten-improved-lighting
Draft

Modernize TEN lighting with HDR, GGX materials, bloom and softer shadows#6
illyaine wants to merge 115 commits into
masterfrom
feature/ten-improved-lighting

Conversation

@illyaine

@illyaine illyaine commented Jun 27, 2026

Copy link
Copy Markdown
Owner

Summary

This draft consolidates the ongoing TEN lighting modernization in one branch and one pull request.

Modern direct lighting

  • Add a shared modern lighting path for room geometry, moveables, instanced statics and inventory objects.
  • Replace the old reflection-vector highlight with a dielectric Cook-Torrance GGX BRDF.
  • Use the real per-pixel camera-to-surface view vector instead of a global camera direction for specular highlights.
  • Keep existing AO, roughness, specular, height and emissive material maps authoritative.
  • Do not simulate metallic materials because TEN currently has no metalness channel.
  • Convert legacy vertex sheen values into compatible roughness and specular overrides.
  • Add derivative-based specular antialiasing to reduce shimmering on detailed normal maps.
  • Add basic dielectric energy conservation between direct diffuse and specular lighting.
  • Preserve HDR values above 1.0 for bright direct light and highlights.

Light attenuation and selection

  • Replace hard linear range edges in the modern shader path with smooth inner/outer range attenuation.
  • Add a mild distance response while retaining the ranges and intensities authored for existing TEN levels.
  • Smooth spotlight cone transitions.
  • Keep the legacy object-lighting path available for direct comparison with F8.
  • Add object-bound-aware light collection for moveables and statics.
  • Rank lights by local influence instead of always preferring dynamic lights.
  • Add selection hysteresis to reduce visible light swapping near influence boundaries.
  • Correct spotlight CPU ranking by converting stored cone angles from degrees to cosine space.
  • Expand spotlight selection cones by the apparent angular radius of the object's bounding sphere.

Material and reflection response

  • Separate indirect ambient lighting from runtime diffuse and specular lighting.
  • Keep direct and specular lighting independent from baked AO attenuation.
  • Preserve emissive contribution after shadows.
  • Correct normal and tangent transforms for non-uniform and mirrored scale.
  • Normalize the room tangent basis and initialize room sheen explicitly.
  • Make legacy and skybox reflection strength respond to roughness and view-angle Fresnel.
  • Reduce reflections on rough surfaces rather than faking unavailable prefiltered reflection mip levels.

Shadows

  • Replace the square 5x5 box PCF pattern with a rotated 16-tap Poisson filter.
  • Add a real slope-dependent receiver depth bias plus shadow-map texel bias.
  • Increase filter radius gradually with receiver distance for less uniform shadow softness.
  • Preserve signed projection depth near cube-face boundaries.
  • Evaluate shadow strength using the modern point and spotlight attenuation.
  • Apply room shadow maps to the full non-emissive surface result, including direct diffuse and specular light.
  • Keep emissive materials self-lit after shadowing.

Internal HDR pipeline

  • Add an engine-controlled FP16 scene-color path independent of Windows HDR.
  • Restrict FP16 promotion to scene-color, SMAA scene, bloom and reflection targets instead of converting all RGBA8 utility targets.
  • Keep normals, material masks, SSAO and emissive/material G-buffer targets in their intended formats.
  • Preserve HDR precision through bloom composition, FXAA and SMAA.
  • Tone-map the FP16 scene before it enters the SDR postprocess chain.
  • Avoid applying tone mapping, fade, tint or cinematic bars twice.
  • Keep frozen scene and inventory backgrounds compatible with the HDR scene buffer.

Tone mapping, bloom and glare

  • Add ACES-style tone mapping with exposure and strength controls.
  • Add configurable light bloom, threshold, strength, radius, glare strength and glare length.
  • Normalize the bloom downsample kernel so it no longer adds artificial brightness.
  • Evaluate bloom using perceptual luminance plus a peak-channel term for saturated colored lights.
  • Make bloom threshold evaluation exposure-aware.
  • Apply a softer threshold to emissive material sources without making low-intensity emissive maps haze the image.
  • Add a small highlight chroma correction to reduce neon channel clipping.
  • Skip the glow pass entirely when bloom and glare strengths are both zero.
  • Preview all postprocess values directly while the Lighting and HDR page is open.
  • Draw the settings UI after tone mapping so text remains stable and is not bloomed.
  • Determine restart requirements from the actual active scene render-target format.
  • Persist all HDR and bloom options in the TEN graphics configuration.

Current menu integration

  • Branch: feature/ten-improved-lighting
  • Draft PR retained for iterative testing.
  • The existing High Framerate row currently exposes the HDR page through Select and is labelled High Framerate / HDR Settings; Left/Right continues to change the framerate option.
  • A fully separate Display-menu row still requires the coordinated central GuiController option-index change and remains pending. No duplicate menu state machine has been introduced.

Validation required

No CI checks are currently attached to this branch. A local Windows build, Direct3D HLSL compilation and in-game comparison are still required, including:

  • HDR on/off startup paths and restart handling
  • no AA, FXAA and SMAA paths
  • title, pause, inventory, loading and frozen-scene rendering
  • bloom threshold, strength and radius live preview
  • glare strength and length
  • saturated red, blue and warm light sources
  • rough and glossy material-map extremes
  • normal-map shimmer during camera movement
  • emissive materials and bright specular highlights
  • legacy versus improved object-light selection
  • point-light range boundaries
  • spotlights near cone edges and on large objects
  • shadow acne, peter-panning and cube-face seams
  • dynamic statics with WADTool ambient value 128

@illyaine
illyaine force-pushed the feature/ten-improved-lighting branch 4 times, most recently from 2403267 to 9d72f03 Compare June 27, 2026 18:46
@illyaine illyaine changed the title Improve TEN lighting selection and composition Improve TEN lighting selection, composition and normal transforms Jun 27, 2026
@illyaine
illyaine force-pushed the feature/ten-improved-lighting branch from 07b7c04 to 78d628d Compare June 27, 2026 19:50
illyaine added 30 commits June 28, 2026 14:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant