Home 3D Art Showcase & Critiques

Voxel Cone Tracing plugin for Unity

polycounter lvl 18
Offline / Send Message
commander_keen polycounter lvl 18
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

  • AlexCatMasterSupreme
    Options
    Offline / Send Message
    AlexCatMasterSupreme interpolator
    That's badass. I'd post this in the technical talk section though.
  • Serial Lens
    Options
    Offline / Send Message
    This is REALLY exciting. I would suggest putting "dynamic global illumination" or something similar in the title though - lots of artists who really want this feature might not know what "voxel cone tracing" means.

    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.
  • Fingus
    Options
    Offline / Send Message
    Fingus polycounter lvl 11
    Oh dude! I stumbled upon this on youtube. I had no idea you were the one making it!

    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.
  • Shrike
    Options
    Offline / Send Message
    Shrike interpolator
    Its looking really nice
    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
  • Serial Lens
    Options
    Offline / Send Message
    Shrike wrote: »
    no prebaking ? So you can move objects around and Gi bounces adapt in real time !?

    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.
  • Ged
    Options
    Offline / Send Message
    Ged interpolator
    wow that looks amazing!
  • iniside
    Options
    Offline / Send Message
    iniside polycounter lvl 6
    How does your solution scale in big open worlds ?
  • gboxentertainment
    Hey, you mentioned about emissive materials - can you show an example from your implementation? I'm particularly interested in the way you filter your voxels.

    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).
  • NinthJake
    Options
    Offline / Send Message
    Blimey, I gotta say, this is pretty friggin cool!!

    I haven't used Unity much, other than the occasional "new version tryout". This might give me a reason to start using it :D

    I can't wait until you put this up in the asset store.
  • commander_keen
    Options
    Offline / Send Message
    commander_keen polycounter lvl 18
    This is REALLY exciting. I would suggest putting "dynamic global illumination" or something similar in the title though - lots of artists who really want this feature might not know what "voxel cone tracing" means.

    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.

    Good point. It looks like I cant change the title though :(

    Shrike wrote: »
    Its looking really nice
    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

    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.

    iniside wrote: »
    How does your solution scale in big open worlds ?

    Since the volumes are centered around the camera there is no limit to the size of the environment.

    Hey, you mentioned about emissive materials - can you show an example from your implementation? I'm particularly interested in the way you filter your voxels.

    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).

    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.
  • gboxentertainment
    Would you be able to upload a 1080p video to download? I am particularly interested in whether your camera-centred cascades produce any noticeable flickering of the scene lighting when you move around.

    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?
  • nickzucc
    Options
    Offline / Send Message
    nickzucc polycounter lvl 5
    Just wanted to bump this. I think what you are doing is amazing! Keep pushing the tech forward.

    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! :)
  • commander_keen
    Options
    Offline / Send Message
    commander_keen polycounter lvl 18
    Would you be able to upload a 1080p video to download? I am particularly interested in whether your camera-centred cascades produce any noticeable flickering of the scene lighting when you move around.

    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?

    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.
  • gboxentertainment
    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.

    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.
  • allesisda
    Options
    Offline / Send Message
    this is awesome!

    where can i download this?
    it would be very nice for my project at the university! :)
  • locater16
    Options
    Offline / Send Message
    locater16 polycounter lvl 8
    Oh sweet, nice work! Been looking at stuff like this for a long time. That is some excellent performance... though I would say how much ram does it take up? By your performance numbers I'd guess you're using a 3d volume texture rather than a sparse octree.

    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.
  • thatsmauri
    Options
    Offline / Send Message
    I've send you an PM regarding this. Looks great and I'd like to test it out :)

    Edit // To anyone who might stumble across this thread in the future: It's a dead project.
Sign In or Register to comment.