Skip to content

breeze028/Radiosity

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Cornell Box Rendering Experiments

This project contains two C++ renderers for a Cornell Box scene:

  • radiosity.cpp: a pure patch-based radiosity renderer
  • hybrid_radiosity.cpp: a hybrid renderer that combines per-pixel direct lighting with radiosity-based indirect lighting

Both programs render a simplified Cornell Box with two rotated boxes and write the result as a P3 PPM image.

Shadertoy version

https://www.shadertoy.com/view/7cSSWG

Pure radiosity

image

Hybrid renderer

Direct illumination

image

Indirect illumination

image

Global illumination

image

Notes

Pure radiosity

The pure radiosity version:

  • discretizes the scene into diffuse patches
  • estimates form factors between patches
  • solves energy exchange iteratively
  • shades each visible point from the radiosity value of the hit patch

This version is simple and useful for studying classic radiosity, but patch boundaries are visible.

Hybrid renderer

The hybrid version separates lighting into two parts:

  • direct lighting: evaluated per pixel by sampling the rectangular area light and tracing shadow rays
  • indirect lighting: approximated with patch-based radiosity

This produces more believable direct shadows while keeping the diffuse interreflection behavior of radiosity.

OpenMP

Both renderers contain OpenMP parallel loop structure in the expensive stages:

  • form factor construction
  • radiosity iteration
  • framebuffer rendering

If your compiler and runtime provide OpenMP support, CMake will link it automatically. If not, the project can still be built in serial mode.

About

Radiosity is an outdated rendering method, and the C++ code available online is old and difficult to run. Therefore, I used Codex to write this sample project for learning purposes.

Topics

Resources

License

Stars

Watchers

Forks

Contributors