Skip to content

Color Grading & Tonemapping

Norz3n edited this page Oct 11, 2026 · 5 revisions

Color Grading & Tonemapping

Ray-MMD ReForge processes the entire lighting and composite pipeline in High Dynamic Range (HDR) linear color space before applying tonemapping and color grading.


1. Tonemap Operators Overview

Configured via HDR_TONEMAP_OPERATOR in ray.conf:

Operator ID Name Description Best For
8 (Default) AgX Base (Blender 4.0) Troy Sobotka's 6th-order polynomial S-curve (16.5 EV). Hue-preserving highlight roll-off. General production, cinematic, high contrast.
11 GT7 (Gran Turismo 7) Polyphony Digital (SIGGRAPH 2025) physically based curve calibrated to 250 nits paper white. Photorealism, outdoor daylight, automotive shaders.
12 AgX Golden Troy Sobotka's AgX with warm golden cinematography roll-off and rich tonality. Sunset, golden hour, emotional and warm lighting.
10 PBR Neutral Khronos Group (2024) standard preserving authored albedos and skin hues without shift. Color-critical PBR inspection, catalog renders.
9 AgX Punchy Blender 4.0 AgX Punchy look with elevated contrast and vibrancy. Stylized animations, music videos, high-energy scenes.
5 / 7 ACES (sRGB / Fitted) Film industry standard ACES RRT/ODT fit with high vibrancy. Stylized, punchy projects.
2 Hable (Uncharted 2) Filmic curve developed by John Hable for Naughty Dog. Gritty realism, game cinematics.
1 Reinhard Simple luminance-based hyperbolic compression. Low-contrast soft looks.
0 Linear Uncompressed raw linear color (requires external LUT). Custom external color-grading workflows.

Note

TPDF Triangular RGB Dithering (Gjøl 2016): Post-tonemap quantizing utilizes Morten S. Mikkelsen's Triangular Probability Density Function (TPDF) noise (Shader/PostProcess/ColorGrading.fxsub). It eliminates 8-bit banding on gradients (skies, fog, smooth skin) without generating color-speckle or grainy chroma noise.


2. Visual Tonemapper Comparison (+50% Contrast)

Reinhard (HDR_TONEMAP_OPERATOR 1) ACES (HDR_TONEMAP_OPERATOR 4 / 5) AgX (HDR_TONEMAP_OPERATOR 8 - Default)
Reinhard ACES AgX

*All previews rendered with Contrast+ elevated to ~50% on ray_controller. Notice how ACES suffers from severe hue-skewing (skin burning into yellow/orange), whereas AgX cleanly preserves authentic skin tones and cinematic dynamic range.


3. Why AgX is the Default Standard in ReForge

  • Highlight Roll-off Without Hue-Skew: In older tonemappers (like ACES or Reinhard), pushing exposure or contrast causes bright skin to burn into harsh yellow/orange and skies into cyan. AgX gracefully desaturates intense highlights towards white while maintaining exact color hues.
  • Extreme Contrast Tolerance: You can push Contrast+ on ray_controller up to 50%+ without crushing shadow details or burning skin highlights.

4. Post-Processing Features on ray_controller

Morph Slider Description
Exposure+ / Exposure- Linear exposure compensation in EV stops.
Contrast+ / Contrast- Filmic S-curve contrast adjustment.
Saturation+ / Saturation- Color saturation scaling.
Gamma+ / Gamma- Mid-tone gamma curve balance.
Temperature+ / Temperature- White balance adjustment (warm sunset vs cool daylight).
BalanceR/G/B (+/-) Individual color channel balance and tinting.
BloomThreshold Minimum luminance required to trigger bloom glow.
BloomRadius+ / BloomRadius- Spatial spread and size of the bloom halo.
BloomColorAllV+ / BloomColorAllV- Total bloom brightness multiplier.
BloomStarFade Fade intensity of anamorphic lens flare streaks.
Vignette Optical lens corner darkening.
Dispersion / DispersionRadius Fullscreen camera lens chromatic aberration.
SSGI+ / SSGI- Screen-Space Global Illumination indirect radiance strength.
SSAO+ / SSAO- Ambient occlusion shading density.
SSSS+ / SSSS- Subsurface scattering blur profile scale.
FocalLength / FocalDistance / Fstop Optical camera Depth of Field (DoF) bokeh controls.

5. Studio Color Grading Engine & ColorGradingController.pmx

Ray-MMD ReForge includes a studio-grade linear HDR color grading engine (Shader/ColorGrading.fxsub) integrated directly into the pre-tonemap HDR composite pass. Controlled via the dedicated 60-morph ColorGradingController.pmx, it brings full professional grading suites to MMD without performance overhead.

1. Pre-Tonemap Linear HDR 3-Way Split Toning

Provides independent control over Shadows (Lift), Midtones (Gamma), and Highlights (Gain):

  • Per-Zone Controls: Individual Tint (R/G/B), Contrast, and Saturation (0.0x desaturation to 4.0x boost).
  • Black & White Levels: ShadowLift+/- lifts or crushes the deepest black floors; HighlightGain+/- expands or compresses bright highlight energy.

2. Perceptual Naka-Rushton Luma Partitioning

Instead of arbitrary linear thresholds, tonal zones are smoothly partitioned using Michaelis-Menten / Naka-Rushton perceptual compression: $$pLuma = \frac{luma}{luma + 0.18}$$ This maps standard 18% middle gray precisely to $0.50$. Calibrated thresholds (mColorGradingShadowMax = 0.45, mColorGradingHighlightMin = 0.40) ensure that lit skin, hair sheen, specular glints, and skies receive natural highlight grading without harsh clipping or tonemap desaturation.

3. 2D White Balance & Smart Vibrance

  • 2D White Balance: Planckian blackbody Temperature+/- (warm amber vs cool blue) coupled with orthogonal Green/Magenta Tint+/-, normalized by luminance to prevent unwanted exposure drift.
  • Smart Vibrance (Vibrance+/-): Non-linear curve boosting muted, pastel tones while protecting already saturated colors and anime skin.
  • 3D Rodrigues Hue Rotation (Hue+/-): Branchless axis-angle rotation enabling full 360° global hue angle shifts in ~4 ALU instructions.

4. Cinematic Creative Film Presets

One-touch film stock presets with uniform dynamic branching (zero GPU cost when inactive):

  • TealOrange+: Hollywood blockbuster look with cool cyan-teal shadows and warm golden amber highlights.
  • BleachBypass+: Silver-retention film processing look with high contrast and desaturated metallic grit.
  • CrossProcess+: Stylized C-41 chemical slide cross-processing response.
  • Monochrome+: Photometric spectral black & white conversion (Rec.709 luminance weights).

5. ColorGradingController.pmx Morph Layout

Panel Tab Morph Sliders Description
Eyebrows (眉) Contrast+/-, Saturation+/-, Gamma+/-, Exposure+/-, Vibrance+/-, Hue+/- Master global grading, smart vibrance, and hue rotation.
Eyes (目) Temperature+/-, Tint+/-, ShadowR/G/B+/-, ShadowContrast+/-, ShadowSaturation+/-, ShadowLift+/- 2D White balance and Shadows (Lift) split-toning.
Mouth (口) HighlightR/G/B+/-, HighlightContrast+/-, HighlightSaturation+/-, HighlightGain+/-, MidtoneR/G/B+/-, MidtoneContrast+/-, MidtoneSaturation+/- Highlights (Gain) and Midtones (Gamma) split-toning.
Other (他) BalanceR/G/B+/-, TealOrange+, BleachBypass+, CrossProcess+, Monochrome+ Color balance offsets and one-touch creative film presets.

Clone this wiki locally