mrdoob / three.js

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

Voxel Cone Tracing global illumination #4434

Closed Usnul closed 10 years ago

Usnul commented 10 years ago

engines such as unreal 4 and unity (in experimental state at least) are implementing voxel cone tracing based on spherical harmonics and sparse voxel tree generation using GLSL: http://perso.telecom-paristech.fr/~eisemann/publications/Crassin2011VoxelGlobalPG/VoxelGI_EG-pg2011-sub.pdf the author claims that this approach is only enabled by GLSL 5, and I believe version supported by WebGL at the moment is 2, so likely some of the things would have to be done differently (using FBOs probably). There is a project here on github which claims to implement this technique in C++: https://github.com/domme/VoxelConeTracing there are also quotations of GLSL code in scientific papers (either the GI ones or GigaVoxel work, i can't recall). There is an interesting documentation of implementation of this approach for OpenGL: http://www.altdevblogaday.com/2013/01/31/implementing-voxel-cone-tracing/ I'm interested to know how this would fit within threejs and if there is much of general interest in this topic. The reason this approach is very appealing as a GI solution is due to the fact that it is more or less fully automatic, except for controlling granularity (smallest voxel size or total number of voxels) - there is not magic involved, designer doesn't have to place probes manually and control their size by hand.

mrdoob commented 10 years ago

There is definitely interest from my side! :D

Usnul commented 10 years ago

the closest thing i've seen on the subject of spherical harmonics used for global illumination for WebGL is: http://codeflow.org/entries/2012/aug/25/webgl-deferred-irradiance-volumes/ but this is somewhat few steps in a different direction. As you can see "probes" are manually placed, are of set size and it would be more fair to call them spherical projections as opposed to ray/cone tracing. However, having SH (spherical harmonics) is part of the solution. The demo above looks few levels above anything else i've seen done in WebGL, albeit it's achieved using a rigged scene (manual management of "probes").

zz85 commented 10 years ago

wow this is way over my head for now... :)

Usnul commented 10 years ago

I'm pretty sure it isn't, I've seen some amazing stuff done by you in the past :) The information is all there, it just needs to be adapted for WebGL, granted that's quite some effort regardless.

Doidel commented 9 years ago

Let me place this discussion about Voxel Cone Tracing for WebGL here for documentation purposes: http://pastebin.com/936qFsyM

novalain commented 6 years ago

I recently implemented this technique in my toy web engine https://novalain.github.io/gi-voxels/. The results are pretty cool but without geometry shaders and imagestore the voxelization step takes way too long (with a decent voxel resolution) - i.e won't work in real-time yet for dynamic scenes.

MEBoo commented 5 years ago

Hi @mrdoob any plan to integrate this VCTGI or another GI technique? Is anyone working on it?

mrdoob commented 5 years ago

@MEBoo not that I know of...