Skip to content
pireu2Public

About

Ray tracing simulator made in Unity with DirectX12 that calculates and visualizes cumulative light damage on cultural artifacts for heritage conservation.

Topics

Resources

Contributing

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

ChronoLux: Digital Twin for Environmental Light Dosimetry

Unity Render Pipeline API Status License

ChronoLux is a scientifically rigorous metrology and visualization tool designed for the preventive conservation of cultural heritage artifacts. Successfully completed as a CS Diploma Project, it functions as a "Digital Twin," simulating long-term solar radiation exposure and calculating cumulative environmental light damage (measured in Lux-Hours) on 3D artifacts.

Read the full academic thesis: ChronoLux Thesis (PDF)

Unlike traditional game renderers that prioritize aesthetic screen-space approximations, ChronoLux employs a custom Texture-Space Monte Carlo Path Tracer to mathematically simulate thermodynamic light transport directly onto an artifact's surface over extended temporal ranges.


Scientific Methodology

1. Texture-Space Ray Tracing

Standard ray tracers shoot rays from a virtual camera to evaluate pixels on a screen. ChronoLux inverts this paradigm. Using DirectX Raytracing (DXR), it launches rays directly from the unwrapped UV coordinates of the 3D artifact (via pre-baked PositionMap and NormalMap buffers). This ensures that light energy is calculated persistently across the entire surface of the object, regardless of camera occlusion or screen resolution.

2. Perez All-Weather Sky Model

To ensure physically accurate solar illumination, ChronoLux integrates the Perez Sky Model. It calculates the precise astronomical altitude and azimuth of the sun based on geolocation (Latitude/Longitude), UTC offset, and time of year. Diffuse skylight is evaluated using Cosine-Weighted Hemisphere Importance Sampling to accurately simulate ambient scattering.

3. Next Event Estimation (NEE)

The custom stochastic RayGen kernel utilizes Next Event Estimation to explicitly sample direct sunlight alongside recursive indirect multi-bounce reflections, unifying the direct and indirect light calculation for maximum statistical convergence. Critically, shadow rays dynamically traverse refractive surfaces (e.g. conservation glass windows), correctly attenuating energy instead of prematurely terminating.

4. Energy Conservation

All scene geometry is bound by strict thermodynamic laws. The custom SimulationMaterial component allows real-time configuration of physical Reflectance ($R$) and Transmittance ($T$) values, algorithmically clamping the system to ensure $R + T \le 1.0$.


Core Capabilities

  • Time-Stepping Dosimetry: Accumulates instantaneous illuminance ($E$) in Lux over configurable chronological steps (e.g., hourly intervals across 365 days) into a cumulative dose ($D_{total}$) in Lux-Hours.
  • Decoupled Direct/Indirect Tracking: Uses multi-target Texture Space shading to isolate and independently track structural light damage originating from Direct Solar Beams versus Diffuse Perez ambient scattering.
  • Virtual Lux Sensors: Deployable 3D probes that act as digital light meters. They calculate expected theoretical irradiance ($E = E_{beam} \cdot \cos(\theta) + E_{diffuse} \cdot 0.5$) and validate the Monte Carlo raytracer's output, actively tracking percentage error margins.
  • Heatmap Visualization: High-performance HDRP surface shader maps the raw Float32 Lux-Hour data into an "Inferno" (Purple-Red-Yellow) gradient. This enables curators to instantly identify microscopic high-risk exposure hotspots.
  • Deterministic RTAS: Enforces absolute strict sorting of Renderer Instance IDs during Acceleration Structure generation to guarantee repeatable scientific data across different hardware executions.
  • Asynchronous Runtime Mesh Parsing: Background-threaded OBJ parser capable of loading multi-million vertex photogrammetry models without stalling the main Unity thread.
  • Interactive Object Inspection: A robust crosshair-based ObjectPicker combined with a FreeLookCamera (featuring Shift-key non-linear velocity multipliers) for precise architectural exploration.
  • Headless Data Pipeline: Asynchronous Coroutines safely read back GPU memory to generate massive multi-column CSV datasets (tracking DeltaMaxDose, DoseVariance, Coverage, and telemetry) without stalling the main simulation thread.

System Requirements

Because ChronoLux relies on raw hardware-accelerated ray tracing to calculate millions of paths, it requires modern hardware:

  • OS: Windows 10 / Windows 11 (Strictly required for DirectX 12)
  • GPU: NVIDIA RTX 20-series / 30-series / 40-series, or AMD equivalent (Must support DXR 1.0 or higher)
  • Engine: Unity (HDRP)
  • Project Settings:
    • Graphics API: Direct3D12 (Experimental)
    • Static Batching: Disabled (Required for DXR sorting)
    • Realtime Ray Tracing: Enabled in the active HDRP Asset

Data Output & Metrology

ChronoLux provides highly granular export mechanisms for external data analysis (e.g., Python, MATLAB, Excel):

  1. SimulationMetrics.csv: A comprehensive time-series dataset generated asynchronously. It tracks Hourly Time, Sun Altitude/Azimuth, Exterior Beam/Diffuse Lux, Artifact Delta Max/Avg Dose, Cumulative Dose, Hourly Variance, Surface Coverage (%), and Virtual Sensor Error tracking, alongside decoupled Direct and Indirect stress markers.
  2. Daily Dose EXR Snapshots: Exports full 32-bit floating-point High Dynamic Range .exr textures for every day of the simulation. This allows exact surface irradiance maps to be analyzed externally or re-imported into ChronoLux's UI timeline slider.

Project Architecture

  • /Scripts: C# simulation orchestration, orbital mechanics (SunCalculator), Async GPU Readback logic, and CSV writing pipelines.
  • /Shaders: HLSL Compute kernels (IrradianceBaker.compute) containing the core mathematical ray tracer and BRDF evaluation, plus the visual HeatmapShader.shader.
  • /UI: Modern Unity UI Toolkit architecture (.uxml and .uss) comprising the laboratory dashboard, settings launcher, and material catalog.
  • /Models: Sandbox testing environments (Note: All imported target artifacts must have non-overlapping UVs and Read/Write enabled in import settings).

Citation

If you use ChronoLux in your research, please cite our paper:

@article{chronolux2026,
  title={ChronoLux: Texture-Space Ray Tracing for Interactive Light Dosimetry in Preventive Conservation},
  author={Duică Sebastian},
  journal={CS Diploma Thesis, Technical University of Cluj-Napoca},
  year={2026}
}

About

Ray tracing simulator made in Unity with DirectX12 that calculates and visualizes cumulative light damage on cultural artifacts for heritage conservation.

Topics

Resources

Contributing

Stars

0 stars

Watchers

0 watching

Forks

Contributors

Languages