Skip to content

Cinematic Rendering & Photographic Profiles

This document describes the high-fidelity cinematic rendering system and its architectural evolution towards professional photographic simulation.

🎨 Creative Philosophy: The "Fujifilm" Connection

The Nordic Noir look (Key 9) is heavily inspired by the color science and "Film Simulations" of the Fujifilm X100VI.

Photographic Parallels

  • Film Simulation (Classic Neg style): Our cg_lift and color temperature (4050K) emulate the high-contrast yet "breathable" shadows characteristic of Fuji's modern film simulations.
  • X-Trans Grain Emulation: The temporal jitter-based grain was designed to match the organic, non-scrolling noise generated by Fujifilm's internal image processor.
  • 35mm Narrative Perspective: The default Field of View (FOV) and depth-based fog density replicate the storytelling feel of a 23mm f/2 lens (35mm equivalent).

🌫️ Atmospheric Fog System

The system uses a depth-based exponential fog with several high-end features:

Height-Based Falloff

Unlike simple linear fog, the density decays exponentially with vertical height (y coordinate). This allows for realistic ground-level haze while keeping the sky clear.

\[ Fog(h) = d \cdot e^{-falloff \cdot h} \]

Spectral Shift

To simulate real-world Rayleigh scattering, the fog color shifts towards a deep teal (0.10, 0.16, 0.22) as it gets denser in the distance. This provides much more depth than a single-color fog.

Skybox Masking

The fog is masked from the skybox using depth/stencil testing. This prevents the "washed out" look common in simple implementations and preserves the deep contrast of the background imagery.

Debug Mode (Shift + F7)

A dedicated diagnostic view allows developers to isolate only the fog component (rendered against a black background). This is invaluable for balancing density and height falloff.

🎞️ Photographic Film Grain

The grain system emulates 35mm film stock through a perceptual noise model:

  • Temporal Jitter: Instead of "scrolling" noise, the system uses a high-frequency hash of time to regenerate a unique noise grain every frame. This prevents directional streaks and creates a natural "boiling" effect.
  • Luminance Weighting: Grain intensity is dynamically scaled based on the scene luminance. It is densest in the shadows and midtones, and barely visible in clear highlights, mimicking real silver halide behavior.

📸 Camera Profile System

The system implements a Camera Profile System where each profile bundles specific rendering characteristics of legendary camera brands.

Implemented Profiles

Profile Characteristic Simulation Target
Sony (CineStyle) Professional mid-tones, soft highlights, 3D LUT Alpha 7S III / S-Cinetone
Fujifilm (Classic) Teal shadows, high contrast, organic grain X100VI / X-Trans V
Leica (Summarit) Severe highlight roll-off, ultra-fine grain M11 Monochrome
Canon (Vivid) Saturated primaries, soft bloom, pleasant reds EOS R5

🛠️ Advanced Debugging: 3D LUT Lattice (Shift + F10)

To visualize how a 3D LUT deforms the color space, a dedicated lattice debugger can be toggled via Shift + F10. It renders a GPU-accelerated point grid representing the RGB volume, showing exactly how the gamut is remapped by the active profile.

Technical Roadmap (Achieved)

  1. 3D LUT Support: Full integration of .cube LUT processing for brand-specific gamut mapping.
  2. Anamorphic Bokeh: Support for non-spherical lens bokeh (2.0x stretch) in the Depth of Field module.
  3. Lattice Visualization: Real-time debugging of color space deformation.

Data Sources & Technical Resources

To build these profiles with scientific accuracy, we rely on the following industry-standard resources:

  • 3D LUTs & Color Science:
  • FujiXWeekly: Film simulation recipes and color transforms.
  • FreshLUTS: Community-driven library of .cube color grades.
  • Manufacturer Portals: Official Sony (S-Log), Canon (C-Log), and ARRI (Log-C) conversion LUTs.
  • Sensor Performance (DR & Noise):
  • PhotonsToPhotos: Read noise and dynamic range plots for thousands of sensors.
  • Optics & Diffusion (Lens PSF):
  • OpticalLimits: Comprehensive MTF and lens characteristic testing.
  • Christopher Frost (YT): High-quality visual analysis of lens flare and micro-contrast.

📊 Monitoring & Control

The rendering parameters are exposed in the F1 Detailed Overlay:

  • WB Temp: Real-time color temperature in Kelvin.
  • Shadow Lift: Current elevation of the black point.
  • Fog Metrics: Density and start distance.

All parameters can be calibrated via the PostProcessPreset structures in include/postprocess_presets.h.