Offline Light Propagation Volumes

Materials, textures, lighting, postfx
  • 1
  • 2
  • 3
  • 4
  • 5
  • 7
68 posts Page 3 of 7
andrewmac
Posts: 295
Joined: Tue Feb 03, 2015 9:45 pm
 
by andrewmac » Fri Feb 13, 2015 3:46 am
I just did a push the branch with two great updates. First I cleaned up the options in the properties a bit and I added the reflection shader as an option that's rendered on top of the regular stuff. You can turn it on/off.

Second, voxels now detect the diffuse color assigned to the material. The color detected is blended with the light that bounces off it. This finally gives us some color bleed and reflection color:

Image

Image
Nils
Posts: 160
Joined: Thu Feb 05, 2015 3:32 am
 
by Nils » Fri Feb 13, 2015 4:42 am
Looking very nice! :-D
buckmaster
Steering Committee
Steering Committee
Posts: 321
Joined: Thu Feb 05, 2015 1:02 am
by buckmaster » Fri Feb 13, 2015 4:53 am
Why are the shadows so jaggy, but the light cutoff so smooth?
8bitprodigy
Posts: 13
Joined: Fri Feb 06, 2015 6:43 pm
by 8bitprodigy » Fri Feb 13, 2015 6:35 am
buckmaster wrote:Why are the shadows so jaggy, but the light cutoff so smooth?

I imagine the shadows are handled separately from the light propagation.
andrewmac
Posts: 295
Joined: Tue Feb 03, 2015 9:45 pm
 
by andrewmac » Fri Feb 13, 2015 2:09 pm
@
User avatar
8bitprodigy


Correct.

@
User avatar
buckmaster


Those are just stock pointlight shadows. Fixing the shadows is beyond the scope of this project, but perhaps I'll take a look at them when/if I drag out the old Variance Shadow Maps project I have on my github (branch is vsm).
buckmaster
Steering Committee
Steering Committee
Posts: 321
Joined: Thu Feb 05, 2015 1:02 am
by buckmaster » Fri Feb 13, 2015 11:20 pm
Ok haha. Does LPV do shadows currently? Surely it could...
JeffR
Steering Committee
Steering Committee
Posts: 757
Joined: Tue Feb 03, 2015 9:49 pm
 
by JeffR » Sat Feb 14, 2015 4:11 am
By technically.

More appropriately, it just doesn't light certain areas. However, for it to be of a decent quality, you've got to get the resolution pretty high on the grid.
andrewmac
Posts: 295
Joined: Tue Feb 03, 2015 9:45 pm
 
by andrewmac » Sat Feb 14, 2015 3:53 pm
I don't think you'll ever get any kind of good shadows out of it. You want your pixel perfect shadows for things like fences. You'll always need a dynamic shadow solution. The shadows can be fixed, it's just a different project is all.
andrewmac
Posts: 295
Joined: Tue Feb 03, 2015 9:45 pm
 
by andrewmac » Sat Feb 14, 2015 7:50 pm
I just did a push with some usability updates. I added a field flag so the gui inspector can display buttons instead of the hacked checkboxes:

Image

If anyone wants to try it out you just place the volume around the area you want to use it on and then go through the steps from top to bottom.

voxelSize: size of each voxel in torque units. When you change this you need to regen volume.
regenVolume: voxelizes the area within the area and clears all the light and propagation grids. You can visualize it the editor with showVoxels.
injectLights: pulls the pointlights from the scene (pointlights only for now, will add spot and sun very soon), visualize in editor with showDirectLight.
propagateLights: propagates the lights through the grid. You can press this as many times as you want until you get a result you like. Visualize it in the editor with showPropagated.
exportPropagated: exports the results of propagation to the GPU to be displayed.
exportDirectLight: exports the results of injectLights to be used for reflections (optional). Check off renderReflection to enable the shader to display reflection within the volume. This property will save with the volume so you can turn it on/off.

Lastly, saveResults/loadResults. This exports the results from your propagation grid, and your direct light grid to the file path chosen in fileName. These results are loaded back in when the mission loads (or when you press the load button). These final results hold only what it needs to send to the GPU. You cannot propagate them further or work with them in the editor when you load from saved files. You have to start back at regenVolume and go through all the steps again. By doing it this way the final results are loaded straight to the GPU from temp buffers. This gives minimal memory usage when using them in a game.
Last edited by andrewmac on Sat Feb 14, 2015 9:41 pm, edited 1 time in total.
andrewmac
Posts: 295
Joined: Tue Feb 03, 2015 9:45 pm
 
by andrewmac » Tue Feb 17, 2015 12:55 am
I spent the last few days experimenting with spherical harmonics. It seems like the natural progression people take when doing light propagation, and I see now why that is. With spherical harmonics you can store intensity of a color in a direction instead of just storing the color. You can also store more than one by adding them together. It's some neat math. I made this javascript demo while figuring them out:

http://andrewmac.ca/spherical_js/2d_lpv.html

What you see is a wall lit by two lights. As you press propagate it will propagate the light outward in the reflected direction. What's neat is it's a single row of voxels holding light data from both lights. As you propagate the two lights separate and go in opposite directions. My old propagation method was more or less a blur and would have just blurred those colors together into yellowish and pushed them outward in all directions.

This new propagation method produces much better results:


As shown in the video propagated light will show up on dynamic objects. They just can't occlude it, so if you stand in between the box and the wall the box will still be lit green from the wall. Also, the player will have green ambient light on sides not facing the green wall. It's not perfect, but it's plausible.
  • 1
  • 2
  • 3
  • 4
  • 5
  • 7
68 posts Page 3 of 7

Who is online

Users browsing this forum: No registered users and 1 guest