Im getting pretty close to finishing my voxel cone tracing unity plugin, which allows you to have completely dynamic lighting with global illumination.
Heres a dumb video showing the effect. Its a bit outdated and the framerate is much lower in the video due to video capture and optimizations I have done since then.
[ame="
http://www.youtube.com/watch?v=Z1o_CCHhBTQ"]Voxel Cone Tracing Unity Plugin Preview - YouTube[/ame]
That scene runs at about 60-70 fps now on a GTX 660 with the addition of dynamically voxelized objects.
The major things left to do:
-Get multiple cascade sampling working on the gpu side. The cpu side stuff is mostly done.
-Get fallback sky cubemap for if cone traces miss solid objects (sky lighting).
-Terrain voxelizer
-Faster light injection for non-shadow casting point lights
-Directional light support.
If anyone has an environment that they might want to put in Unity and have Unity pro and dx11 gpu then I want to give you a beta so you can make pretty pictures. Especially if the environment could really benefit from dynamic lighting and stuff.
Replies
Regardless, this video has been spreading like wildfire, and if it works like demonstrated it might be the tipping point that gets me to switch to Unity.
I'm super hyped for this tech, but I don't have Unity Pro. I do know of a project that would probably be very interested in this, I'll forward it to them.
This enables you to have full day and night cycles in unity with global illumination right ? A bit explanation would be nice
no prebaking ? So you can move objects around and Gi bounces adapt in real time !?
Marmoset Skyshop and now this, I need to work more with Unity now. I currently work on an environment and I would love to try it out Got a liscense of course aswell, and a nice GTX 770 which is 2 days old
Exactly my point. Artists don't know what "voxel cone tracing" means and it doesn't sound particularly interesting or useful. "Dynamic global illumination" is a much better way to communicate this to us.
Here's an example of my VCT implementation in OpenGL using emissive materials. Although the quality is decent (apart from banding artifacts), when I move the emissive objects, there is noticeable stepping in the lighting (not a smooth transition in motion).
I haven't used Unity much, other than the occasional "new version tryout". This might give me a reason to start using it
I can't wait until you put this up in the asset store.
Good point. It looks like I cant change the title though
Yes everything can be dynamic. The system has 1-3 128x128x128 voxel volumes that are attached to the camera, each 4x bigger than the last. The volumes keep a voxelized representation the static world as they move around. Dynamic objects that you want to be voxelized (so they can contribute to GI) are then composited together with the static volume whenever the volume is updated, usually every frame. Then direct lighting is "splatted" onto the voxels with respect to their diffuse color, normal and shadow map if the light uses shadows. The final lighting volumes are then down sampled into mipmap levels and sampled in the surface shaders using cone tracing (similar to ray tracing but with cones instead of rays) to see what direct light can be seen at any point in the world, creating approximated global illumination.
You can also mix it with lightmaps, which may be a good idea if you have some lights that never change. You wouldnt get the nice specular and reflections from those lights though.
Since the volumes are centered around the camera there is no limit to the size of the environment.
In the video the small lights along the walls, and the big area lights on the ceiling are using emissive materials. Also the windows letting sun light in have an emissive material simulating sky light bleeding in. Right now I dont filter them, which works good enough for static objects, but for moving dynamic objects I also get the stepping you are refering to. I need to look into better ways of voxelizing dynamic. objects.
Also, you mention about splatting the light into the voxels (which requires rendering from each light's point of view) - is there any advantage to doing this in terms of speed and quality? The way I do it is I just voxelize an entire scene that is directly lit.
How many bounces are you using? I'd assume that if you are using emissive lighting then you are using more than one - perhaps infinite bounces with temporal coherence?
Are you just using standard shadow mapping? or are there some cone-traced shadows in your scene?
I can't wait for the day when us artist can manipulate light and have it interact with everything as if it is real light interacting with real surfaces/materials. This is getting us one step closer...so thanks for your hard work!
With standard mipmap generation there would be inconsistencies in the results from 1 position to the next, but with some tricky offsetting during the mipmap generation and lookup you can fix that. It does kind of break the last couple mipmap levels though, but thats not really a problem with multiple cascades.
What i mean by splatting is I use a compute shader to fill an area of the volume with light, checking for solid surfaces and illuminating them, and passing a light view depth map in if the light should use shadows. This means I only have to render the lights point of view if the light is shadowed. So its similar to deferred lighting, but in 3d space instead of 2d. Voxeling the lighting in the geometry pass would mean I would have to revoxelize anything static that gets lighting changes.
I only use 1 bounce. I do some unrealistic sampling which kinda gives the effect of more bounces and more light. This does mean that an emissive material next to a colored non emissive material wont cause color bleeding that non emissive material. I think sampling the albedo volume along with the lit volume could help with that without actually doing multiple bounces.
Yes I just let unity do its standard shadow mapping for direct light.
So doesn't this means you will require multiple depth maps from the light's view if you want multiple lights?
Have you tried using entirely dynamic voxelization to see what the performance is like?
With my implementation, I can run at approx 40-50fps in 1024x768 on a gtx485m using a 64x64x64 voxel volume with fully dynamic voxelization for unlimited bounces. Although its less complex than your scene, with the most complex model being the "Happy Buddha" (over a million triangles) and its smaller as well because I'm not using cascades yet, I'm sure on a gtx660 I can get much higher performance.
where can i download this?
it would be very nice for my project at the university!
Which means you're going to have a lot of potential difficulty with cascades and take up a lot of ram. Cascades also begin to seriously eat into your performance, with specular traces needing ever more samples to hit something.
Still, great work, looks awesome so far!
Edit - Hey Gbox! Thanks for answering all these questions Commander. You really are keen! Ok, that was horrible. I'll commit seppuku now.
Edit // To anyone who might stumble across this thread in the future: It's a dead project.