mrdoob / three.js

JavaScript 3D Library.
https://threejs.org/
MIT License
101.82k stars 35.31k forks source link

Global Illumination via Instant Radiosity / Virtual Point Lights #14047

Closed bhouston closed 4 years ago

bhouston commented 6 years ago

The idea here is to basically use the forward renderer as a ray-trace engine and over a series of frames, usually less than a second, you get a very close to GI solution.

The algorithm is quite simple. You just keep rendering the scene from the standard view while varying the placement of virtual point lights, the placement of which mimics how light roughly bounces through the scene. For each light thus you need to sample rays from its source and then figure out where those hit the scene. For each hit you then need the position, normal, light intensity and direct diffuse information, and then on the next render you use these as virtual point lights and re-render the scene, simulating a light bounce. Likely you need to not use all VPLs in each render, so you need to store them and then sample from the possible VPLs.

I think this ray casting can be done via the GPU fairly easily, although we will have to read-back textures to then create the virtual point lights.

More details: http://www.cs.utah.edu/~schmelze/radiosity/proj/proj.html

Reference: http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.40.2213&rep=rep1&type=pdf

bhouston commented 6 years ago

Here is a runnable demo (with horrible music) that worked in 2008: https://dee.cz/lightsmark/ This means that it is fast enough for mobile now.

Video of engine running: https://www.youtube.com/watch?v=M0ylvjrbwEc

bhouston commented 6 years ago

More interesting research:

https://users.aalto.fi/~laines9/publications/laine2007egsr_paper.pdf

http://miloshasan.net/VirtualSphericalLights/SIGAsia09VSL.pdf

http://sjbrown.co.uk/2011/05/09/virtual-point-light-bias-compensation/