Jump to content

Sparse Voxel Octree Downsampling


Josh

2,161 views

 Share

I've moved on to one of the final steps for voxel cone step tracing, which is downsampling the lit voxels in a way that approximates a large area of rays being cast. You can read more about the details of this technique here.

This artifact looks like a mirror that is sunken below the surface of some kind of frame. It was appearing because the mesh surface was inside the voxel, and neighboring voxels were being intersected. The solution was to move the ray starting point out of the voxel the point was in, using the normal's largest axis to determine which direction to move:

wat.thumb.jpg.c1667628cd6b87d7e9a9cee42b7c3ef6.jpg

Once that was fixed the artifact disappeared. This series of images shows reflections read from each LOD level. The first image is full resolution, and each image after that gets lower-res and blockier/ Notice the lighting in the reflections is much more accurate than in previous images.

0.thumb.jpg.3dbe78e7c3b14bfbe980c1bbb30d9ea1.jpg

1.thumb.jpg.231b5948aa49dfcab2e99ef39f04212c.jpg

2.thumb.jpg.451dc2d428837a9012668eea7142b287.jpg

3.thumb.jpg.17f7a28b4d28e6256b39e4d12beec405.jpg

4.thumb.jpg.2550e576dcffae962f6e286fcb993407.jpg

Because the downsampling routine does not yet consider the alpha value, the geometry has a tendency to grow as it is downsampled. The next step is to determine an equation that will consider the alpha component of each voxel, and use that to start fading the shapes out as the bigger voxels start spanning areas that are both solid and empty. This is the magic optimization that makes cone step tracing an imperfect but fast approximation of ray tracing for real-time rendering.

A naive approach to downsampling would just take the average of the 8 child node colors. This would also result in a lot of light leaking. Instead, I took an average of the closest four children, then performed an alpha blend with the furthest four children, for each axis. When we add transparency into the downsampling and raycasting routine, the reflection gets more confusing, but it's generally correct. Most importantly, the skybox is not leaking through the reflection.

trans.thumb.jpg.7bc0efc48364e487fc916fc7304398b3.jpg

trans2.thumb.jpg.3b971b8c37edd6706f029fd525d8f632.jpg

I think there's a lot I can experiment with here. I'm using six images, with a lighting calculation for the positive and negative direction on each axis, but since it's only an approximation it might be possible to merge that into one image. The transparent areas are hitting interior faces of the voxels, which looks strange, but it is what I told it to do, and I am not sure what the alternative is. I've never actually seen any voxel cone step tracing demo that was this precise. Normally the reflection is not shown very clearly. So it's hard to know how I can improve it, but it's getting there.

  • Like 5
 Share

4 Comments


Recommended Comments

What I am finding is that anything above the second or third LOD just shouldn't be used for specular reflections. The cone step tracing technique should not be used for specular reflection, either. A more accurate octree traversal is the right way to go for this, and then the cone step should be used for diffuse GI.

Link to comment
4 minutes ago, IceBurger said:

Very cool stuff! Do you think UltraEngine will have Dynamic Resolution Scaling?

I'm not a big fan of this because it masks problems, but it is possible to do I think.

  • Like 1
Link to comment
Guest
Add a comment...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...