Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 20 Jun 2012
Offline Last Active May 12 2016 10:19 AM

#5272453 Injection LPV Geometry Shader

Posted by tuccio on 24 January 2016 - 06:47 AM

I'm not sure about the error messages you're getting, but I'll go ahead and say some things I've noticed although they won't fix those.

The reason people draw a pointlist rather than a quad to sample the RSM is that the sampling needs to be done in the vertex shader in LPV, and if you want the whole NxN RSM to be sampled you need NxN vertices, while a quad has 4. You need to sample in the vertex shader, because you need the VPL position information in the geometry shader to decide in which cell of the grid to write. As in the 2D render targets, you can use SV_Position to decide the x and y you're writing to, but to pick the z of the grid, you need to write your cell's z (the actual integral index, not normalized to [0, 1], treating the 3D texture like an array of 2D textures) to SV_RenderTargetArrayIndex in the geometry shader, you wouldn't need the geometry shader at all if you didn't need to write to SV_RenderTargetArrayIndex actually.

#5271865 Injection Step of VPLs into 3D Grid

Posted by tuccio on 19 January 2016 - 11:05 AM

Two passes won't accomplish much, each pass a cell will propagate to its neighbors, that's too local to call it global illumination. You will need a bunch of passes (depending on the 3D texture resolution), and to do so you can use the sets of 3d textures you described, using ping pong buffering (first pass you read from A and write to B, then read from B and write to A and so on).


This is quite an expensive procedure, and to reduce the iterations the crytek paper introduces cascaded LPV.

#5269319 Injection Step of VPLs into 3D Grid

Posted by tuccio on 04 January 2016 - 08:30 PM

The 3D texture in LPV represents an actual AABB in world space, in your example it's represented with min/max corners and you're trying to calculate the cell you need to write in (i.e. the cell where the VPL is located), the 0.5 * normal shift might be confusing, it's a bias to reduce bleeding. You can find most the information you need here