Skip to content

NJUCG/Hair-Radiance-Cache

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

HairMSNN Codebase

This repository contains a Windows/CUDA/OptiX hair rendering codebase centered on path tracing for hair and several acceleration baselines and experiments.

It currently includes:

  • render_path_tracing: path tracing renderer, plus SHARC-style radiance caching extensions used for experiments in this repo
  • render_nrc: neural radiance caching baseline
  • render_hair_msnn: Hair-MSNN baseline from the original paper
  • Python scripts for batch rendering, equal-time/equal-spp evaluation, and figure generation

The repository has been trimmed to keep only the curly and wWavy example scenes and the envmaps needed by those scenes.

What This Repo Is For

Use this repo if you want to:

  • render hair scenes interactively with OptiX
  • run path tracing, NRC, Hair-MSNN, and SHARC-based variants
  • reproduce figure-generation workflows in scripts/
  • extend the renderer for research experiments on hair multiple scattering

Repository Layout

Important directories:

  • cuda: CUDA kernels
  • cuda_headers: CUDA-side headers and shared device code
  • headers: host-side headers
  • scenes: scene configs, hair assets, envmaps
  • scripts: batch rendering and figure scripts
  • tasks: generated task JSONs for scripted runs
  • output: rendered EXR/PNG/JSON outputs

Main entry points:

Requirements

Tested primarily on Windows with NVIDIA RTX GPUs.

  • Windows 10/11
  • Visual Studio 2019 or 2022 with C++ toolchain
  • CMake 3.18+
  • CUDA 12.1
  • OptiX 7.4
  • Recent NVIDIA driver
  • GPU with RTX support

This project uses submodules and third-party dependencies under extern/.

Clone

Clone with submodules:

git clone --recursive <your-repo-url>
cd HairMSNN_code2

If you already cloned without submodules:

git submodule update --init --recursive

Build

mkdir build
cd build
cmake ..
cmake --build . --config RelWithDebInfo --target render_path_tracing render_nrc render_hair_msnn

Built executables will be under:

  • build/RelWithDebInfo/render_path_tracing.exe
  • build/RelWithDebInfo/render_nrc.exe
  • build/RelWithDebInfo/render_hair_msnn.exe

Included Scenes

This trimmed repo keeps two hair scenes:

Main hair assets:

Included envmaps used by these scenes:

Scene Path Notes

Some scene JSON files still contain absolute paths from the original local machine. Before running on a new machine, check these fields:

  • hair.geometry
  • lights.environment.exr
  • integrator.image_output
  • integrator.stats_output
  • tcnn.config
  • optional surface.geometry

Typical files to edit:

Use repository-relative paths where possible.

Running Interactively

Path tracing

.\build\RelWithDebInfo\render_path_tracing.exe scenes\curly\config.json

NRC

.\build\RelWithDebInfo\render_nrc.exe scenes\curly\config.json

Hair-MSNN

The MSNN renderer takes an extra integer beta argument:

.\build\RelWithDebInfo\render_hair_msnn.exe scenes\curly\config.json 5

Running Task JSONs

render_path_tracing.exe supports task mode:

.\build\RelWithDebInfo\render_path_tracing.exe --task tasks\some_task.json

Task JSONs can override:

  • scene
  • spp
  • output path
  • PT parameters
  • SHARC parameters
  • snapshot times / snapshot spp

Many scripts under scripts generate and run these task files automatically.

Common Scripts

Useful scripts in this repo:

Example:

python scripts\run_voxel_scale_and_jitter.py

Example task-based run:

python scripts\run_beta_bounce_tasks.py --mode write
python scripts\run_beta_bounce_tasks.py --mode run
python scripts\run_beta_bounce_figure.py --mode compose

SHARC-Related Notes

render_path_tracing in this repo contains SHARC-style hair caching experiments beyond plain path tracing. These controls are exposed through:

  • the interactive UI under SHARC Cache
  • task JSON fields under "sharc"

Examples of configurable options:

  • cache enable / update enable
  • query bounce / max update bounces
  • query jitter
  • scene scale / log base / level bias
  • hair tangent query mode
  • tangent threshold / parallel scale / perp scale
  • adjacent-level blending during resolve

Outputs

Rendered images and batch outputs are typically written to:

  • output
  • scene-local paths set by integrator.image_output

Task mode also writes metadata JSON next to EXR outputs.

Common Issues

Build succeeds but scenes fail to load

Usually caused by stale absolute paths inside scene JSON files. Fix the paths in the scene configs.

Empty or incorrect env lighting

Check lights.environment.exr in the scene JSON and confirm the referenced EXR exists locally.

Python scripts rerender things unexpectedly

Some scripts decide whether to skip work based on existing EXR/JSON outputs. If you want clean reruns, delete the specific outputs first or use the script's rerun flag if available.

Large repository size

This repo includes scene assets, envmaps, figures, and external research code. Generated outputs under output/ are ignored by Git but can still take a lot of local disk space.

License

See LICENSE.

About

No description, website, or topics provided.

Resources

License

Code of conduct

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors