r/Unity3D•
LexieD

Custom Realtime Dynamic GI - VR test

Show-Off

Posted May 5, 2017, 8:20 PM UTC

2615
LexieDOPHitbox Team•

I'm working on a realtime dynamic GI system for Unity3D. I thought id take a break and get it working in VR to see how well it performed.

It ran at a solid frame rate the whole time without any frame skips, so that's pretty promising! Ill start working on forward rendering so it can support MSAA soon.

The pixel shader is pretty light weight so it should be able to handle forward rendering fine.

Test was on a 1070 GTX with fraps capturing in lossless RGB

My Twitter if you're interested in following my progress.

2
sculptedpixels•

my first question was "whats the perf in vr like?" - congrats on making something so gorgeous work in the tight confines of vr. very much look forward to this!

also, what are the distinguishing differences between this and the Hx asset you also make?

1
LexieDOPHitbox Team•

My asset on the asset store adds volumetric lighting to unity's inbuilt dynamic lights, That's all it does.

Where as this is a realtime dynamic GI solution.

1
sculptedpixels•

that's a subtle difference :D

thanks.

1
riddellriddell•

So I am guessing you have a fixed light volume in the form of a 3D texture and you are propagating the light through the volume by transferring light from neighbor to neighbor each frame/update? Are you doing anything fancy/unique? do you have any plans for speeding up the light propagation? what sort of artifacts are you seeing apart from the diamond light propagation and the temporal errors? What are the pros and cons of your approach? is this approach compatible with volumetric particle lighting / occlusion?

also good work looks amazing!

2
LexieDOPHitbox Team•

Yeah that is pretty much it. I also voxelize the world so bounce lighting works and objects can block light.

You can set the frequency of the propagation step, If you need fast moving lights then a faster propagation speed would mostly remove the visuals of the light propagating out. In this video it's set to 1 propagation per frame so 90hz because the vive caps the refresh rate.

At 1080p this scene renders over 280fps at 1 propagation per frame, I could probably get the propagation up to about 400hz-500hz and still maintain 60fps. But ill have to do some testing.

It also calculates the bounce lighting on the directional light as well. But I'm still working on stabilizing that.

As for downside the lighting is stored using Spherical harmonics. So it suffers from all the issues that come with SH, but generally it works pretty well. The specular is faked by sampling the SH really sharply in the reflection angle. It's not perfect but works on rough surfaces really well. Ill have to do some ray tracing for smooth surfaces/realtime reflections.

As long as your walls are 2 voxels thick then there should be zero light bleeding. If its only one then you can see some light where the wall touches the ground, But it doesn't propagate through.

Other then that most of the artifacts have been fixed.

Edit: Yes its compatible with volumetric lighting. Ill be able to raymarch the lighting to accumulate the light scattering.

It currently works with occlusion, You dont get really strong shadows as the resolution of the grid isn't super fine.

3
riddellriddell•

Have you looked into a non uniform data structure like a sparse voxel octree or a cascading voxel map to accelerate propagation over large uniform spaces?

If you calculate the lighting at a coarse / low res level and then check to see how much the lighting is changing you could use the coarse / low res lighting as a temp substitute while the higher res lighting is still propagating.

1
LexieDOPHitbox Team•

Not yet, working on getting the base of everything in before i bother optimizing things outside of what i need. For me the propagation speed really isn't an issue because most of my emissive surfaces are generated at runtime but are stationary.

1
Frickboi•

Is the delayed nature of the propagation just because of the movement of the cubes?

If you have a static/motionless light that flips on and off, would the GI update instantly or not? I'm guessing yes, but it's not that easy to tell :)

edit: and obligatory 'this looks amazing' !

1
LexieDOPHitbox Team•

No it takes a while for the light to dissipate, Light acts more like sound , So even though the light was turned off, the last waves from it still travel outwards and bounce of walls etc. You can run the simulation at a higher frequency to increase the speed of light in exchange for performance.

3
Morisatoo•

The ripples in the lighting affect are great! Reminds me of a super high speed camera shown on TED talk that could see light traveling.

1
ddutchieHobbyist•

Pretty kewl, how does this work with procedural geometry, can voxelization happen at runtime?

Excited to test!

1
LexieDOPHitbox Team•

Yes, The GPU voxelizes the scene over X frames. In this test i had it set to voxelize the scene every frame.

The game I'm working on is procedural with a lot of lights and emissive surfaces. I've tried a lot of different techniques over the years. This one is looking the most promising and isn't coupled to our level generation so it should be able to be dropped into any project.

1
ddutchieHobbyist•

Epic! Is it limited to DX11? Or will this work on mac also? It really is amazing that we are getting so close to realtime GI. Bring it on!!!

1
LexieDOPHitbox Team•

DX11 and OpenGL 4.3. so it can support linux but not mac as apple doesn't support OpenGL 4.3 which came out in 2012...

Ill look into porting it to metal to see if i can get mac support. But i haven't looked into it yet.

1