Jump to content

  • Log In with Google      Sign In   
  • Create Account

Voxel Cone Tracing Experiment - Part 2 Progress


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
54 replies to this topic

#1 gboxentertainment   Members   -  Reputation: 770

Like
10Likes
Like

Posted 25 September 2013 - 05:01 PM

Okay,

 

I thought it might time to provide you folks with an update on the progress of my voxel cone tracing (VCT) test engine done in OpenGl 4.3. Everything is 100% dynamic running at approximately 20fps on gtx485m @ 1024x768:

 

giboxv3-0.png giboxv3-1.png

giboxv3-2.png giboxssr7.png giboxssr9.png

 

The VCT itself (with "unlimited" bounces by temporal coherence) runs at around 50fps @ 1024x768.

The effects that slow this down to 20fps are:

  • Screen space jittered soft shadows (all omnidirectional, with maximum 1 direct light and 3 emissive lights)
  • Screen space reflections
  • Screen space ambient occlusion (Arkano22's method)

The area is currently only limited to this scene (i'm using a single 64x64x64 3D texture), but I intend to have a go at this "camera-centred cascades" idea to see if I can get consistent interactive framerates for a much larger scene. The main concern I have with using cascades is that it involves dynamically shifting the volume texture, thus leading to large scale flickering. This flickering is evident when I move around emissive objects in my current implementation.

 

I also want to try optimizing this engine, firstly by trying to implement bindless graphics.

 

Here is a video of my latest engine:

 

 

You'll have to excuse the banding artifacts - the quality of the video makes them look worse than they actually are!

 

Link to part one, which details the journey I've been on since January: http://www.gamedev.net/topic/638933-voxel-cone-tracing-experiment-progress/


Edited by gboxentertainment, 05 October 2013 - 01:21 AM.


Sponsor:

#2 Migi0027   Crossbones+   -  Reputation: 2117

Like
0Likes
Like

Posted 25 September 2013 - 11:00 PM

Amazing work!


Hi! Cuboid Zone
The Rule: Be polite, be professional, but have a plan to steal all their shaders!

#3 jcabeleira   Members   -  Reputation: 694

Like
0Likes
Like

Posted 26 September 2013 - 04:14 AM

Interesting results, I think it's time for you to get a more complex scene to evaluate your implementation. It would be nice to see that running on a room scene or some exterior scene with walls and buidlings around you.

 


The area is currently only limited to this scene (i'm using a single 64x64x64 3D texture), but I intend to have a go at this "camera-centred cascades" idea to see if I can get consistent interactive framerates for a much larger scene. The main concern I have with using cascades is that it involves dynamically shifting the volume texture, thus leading to large scale flickering. This flickering is evident when I move around emissive objects in my current implementation.

 

Yup, I can confirm that camera centered cascades will result in large flickering. I've tested that my self on my own implementation of Voxel Cone Tracing and I can say that it simply doesn't look good.



#4 gboxentertainment   Members   -  Reputation: 770

Like
0Likes
Like

Posted 26 September 2013 - 08:07 AM


Yup, I can confirm that camera centered cascades will result in large flickering. I've tested that my self on my own implementation of Voxel Cone Tracing and I can say that it simply doesn't look good.

 

hmm...

I'm thinking now that cascades do not have to be camera-centred. I might have an alternative idea.


Edited by gboxentertainment, 26 September 2013 - 08:07 AM.


#5 Alpha_ProgDes   Crossbones+   -  Reputation: 4692

Like
2Likes
Like

Posted 26 September 2013 - 08:31 AM

Out of curiosity, is there a link to Part 1? Seeing as this is Part 2. :)


Beginner in Game Development? Read here.
 
Super Mario Bros clone tutorial written in XNA 4.0 [MonoGame, ANX, and MonoXNA] by Scott Haley
 
If you have found any of the posts helpful, please show your appreciation by clicking the up arrow on those posts Posted Image
 
Spoiler

#6 jcabeleira   Members   -  Reputation: 694

Like
0Likes
Like

Posted 26 September 2013 - 09:40 AM


hmm...
I'm thinking now that cascades do not have to be camera-centred. I might have an alternative idea.

 

What do you have in mind?

 

If you are thinking about keeping the volume centered on the camera but snapping it to the voxel grid then I can tell you before hand that it doesn't solve the problem either. My approach did that and there was still lots of flickering when the volume changed position. smile.png


Edited by jcabeleira, 26 September 2013 - 09:41 AM.


#7 Styves   Members   -  Reputation: 1077

Like
0Likes
Like

Posted 26 September 2013 - 10:13 AM

YMMV? Snapping to voxel grid positions after N number of steps/distance works fine for almost all of the flickering I've had. How are you voxelizing the scene?



#8 kalle_h   Members   -  Reputation: 1566

Like
0Likes
Like

Posted 26 September 2013 - 02:03 PM

What is quality difference of screenspace reflections vs just using cone tracing reflections? Also have you tested voxel space ambient oclusion?



#9 Frenetic Pony   Members   -  Reputation: 1401

Like
2Likes
Like

Posted 26 September 2013 - 04:24 PM

What is quality difference of screenspace reflections vs just using cone tracing reflections? Also have you tested voxel space ambient oclusion?

 

I imagine both are dependent on voxel resolution. Which reminds to point out Directed Acylic Graphs for Voxels: http://www.cse.chalmers.se/~uffe/HighResolutionSparseVoxelDAGs.pdf Which seems like a fantastic win for reflections and thin object problems both.

 

I also don't remember any flickering in Epic's Elemental demo, despite some quite vast areas using cascaded octree levels. I can't remember if they mentioned flickering being a problem though.


Edited by Frenetic Pony, 26 September 2013 - 04:28 PM.


#10 gboxentertainment   Members   -  Reputation: 770

Like
0Likes
Like

Posted 26 September 2013 - 04:42 PM

YMMV? Snapping to voxel grid positions after N number of steps/distance works fine for almost all of the flickering I've had. How are you voxelizing the scene?

 

This actually describes a much better way of understanding a possible implementation of my idea.

As well as doing this, I am thinking of using something similar to partially resident textures (because most of us, especially with nvidia hardware still are not able to use them yet).

We piece together multiple smaller high-res textures, together with larger lower-res textures to simulate cascaded partially resident textures.

The biggest problem is that there may be texture seams between texture edges which cannot be hardware filtered (this must be done manually).

Has anyone tried this yet?



#11 gboxentertainment   Members   -  Reputation: 770

Like
0Likes
Like

Posted 26 September 2013 - 04:50 PM

 

I also don't remember any flickering in Epic's Elemental demo, despite some quite vast areas using cascaded octree levels. I can't remember if they mentioned flickering being a problem though.

 

 

I'm pretty sure the flickering problem shouldn't occur with octrees - the main reason being that instead of sampling directly from a 3D texture, they aren't limited in their filtering method to offset the sampling by each voxel. With octrees, they can offset by half a voxel, if I understand Crassin's paper correctly.


Edited by gboxentertainment, 26 September 2013 - 04:52 PM.


#12 gboxentertainment   Members   -  Reputation: 770

Like
2Likes
Like

Posted 26 September 2013 - 05:13 PM

I think Frenetic mentioned to me once about something that I guess would be called "Voxel Temporal Anti-aliasing".

I tried to implement it but couldn't get it working - but now that I think about it - I only tried it for the lowest level voxels (highest res).

Majority of the flickering actually occurs at mid-level.

 

I think the way to implement it is to fade in/fade out the color of adjacent voxels based on the position of the object within each voxel so that it smoothly interpolates instead of jumping from 0 to 1.

 

Has anyone tried something like this yet?



#13 jcabeleira   Members   -  Reputation: 694

Like
0Likes
Like

Posted 30 September 2013 - 03:48 AM


I'm pretty sure the flickering problem shouldn't occur with octrees - the main reason being that instead of sampling directly from a 3D texture, they aren't limited in their filtering method to offset the sampling by each voxel. With octrees, they can offset by half a voxel, if I understand Crassin's paper correctly.

 

They don't have any flickering because the octree allows them to store the entire voxelized scene. Their lighting is stable because they don't need to have a moving voxel volume that only covers the scene partially. However, the octree is probably impractical for many games because larger scenes may not fit inside the 512x512x512 texture they use to store the voxel bricks.


Edited by jcabeleira, 30 September 2013 - 03:49 AM.


#14 gboxentertainment   Members   -  Reputation: 770

Like
2Likes
Like

Posted 01 October 2013 - 05:35 AM

I've just re-viewed the original UE4 walkthrough demo (back from when they were showing off their fancy new lighting tech - which they later removed and covered up) and noticed that there is flickering in the reflection of the gold statue on the floor when he moves it. The emissive object that he moves around (the fire hammer) also flickers but its hard to differentiate that from the flickering effect that they purposely used. There's also some noticeable flickering of the indirect lighting when he moves the "spotlight planet" around. I never actually noticed any of this before.

 

I then went to have another look at Crassin's video and paid close attention to the hand's reflection on the floor when he demonstrates the specularity control - I had to pinpoint the exact moment, but it flickers! This occurs most abruptly when the specular cone ratio was turned to medium, but when it was either high(diffuse) or very low(reflective), then its smooth.

 

So it seems that the solution to this problem is neither to do with octrees or voxel resolution or filtering, which is good for me because it doesn't really give too much incentives to using octrees.



#15 gboxentertainment   Members   -  Reputation: 770

Like
3Likes
Like

Posted 01 October 2013 - 06:58 AM

What is quality difference of screenspace reflections vs just using cone tracing reflections?

 

For a true comparison, I turned up the voxel resolution to 256 (left) and turned off any fade effects from the ssr (right).

 

giboxvct.png giboxssr.png

 

To tell you the truth - I am simply just using SSRs to fake reflections that I cannot yet achieve with VCT (but one day in the future I may be able to).

 

The biggest issue that I can't seem to figure out with my VCT reflections though, is the transparency. I'm not sure if this is anything to do with the way I filter my voxels.

Each ray should terminate when it accumulates full opacity. So when a ray hits the surface of the orange box it should terminate when it detects that its opacity is 1, but it doesn't, instead, it continues on, accumulating everything that is behind it.

 

Here's the specular cone tracing code if anyone wants to analyze it:

vec4 specConeTrace(vec3 o, vec3 d, float coneRatio, float maxDist)
{
	vec3 samplePos = o;
	vec4 accum = vec4(0.0);
	float minDiam = 1.0/voxDim;
	float startDist = 2*minDiam;

	float dist = startDist;
	while(dist <= maxDist && accum.w < 1.0)
	{		
		float sampleDiam = max(minDiam, coneRatio*dist);
		float sampleLOD = log2(sampleDiam*voxDim);
		vec3 samplePos = o + d*dist;
		vec4 sampleVal = sampleSpecVox(samplePos, -d, sampleLOD);

		float sampleWt = (1.0 - accum.w);
		accum += sampleVal * sampleWt;

		dist += sampleDiam;
	}

	accum.xyz *= 2.0;

	return accum;
}


#16 Styves   Members   -  Reputation: 1077

Like
0Likes
Like

Posted 01 October 2013 - 12:41 PM

How are you downsampling your voxels?



#17 kalle_h   Members   -  Reputation: 1566

Like
0Likes
Like

Posted 01 October 2013 - 03:02 PM

        float sampleWt = (1.0 - accum.w);
        accum += sampleVal * sampleWt;

There is bug. With full opaque voxel you get zero value for sampleWT. Or am I missing something?



#18 Chris_F   Members   -  Reputation: 2461

Like
0Likes
Like

Posted 02 October 2013 - 01:38 AM

 

What is quality difference of screenspace reflections vs just using cone tracing reflections?

 

For a true comparison, I turned up the voxel resolution to 256 (left) and turned off any fade effects from the ssr (right).

 

attachicon.gifgiboxvct.pngattachicon.gifgiboxssr.png

 

To tell you the truth - I am simply just using SSRs to fake reflections that I cannot yet achieve with VCT (but one day in the future I may be able to).

 

The biggest issue that I can't seem to figure out with my VCT reflections though, is the transparency. I'm not sure if this is anything to do with the way I filter my voxels.

Each ray should terminate when it accumulates full opacity. So when a ray hits the surface of the orange box it should terminate when it detects that its opacity is 1, but it doesn't, instead, it continues on, accumulating everything that is behind it.

 

Here's the specular cone tracing code if anyone wants to analyze it:

vec4 specConeTrace(vec3 o, vec3 d, float coneRatio, float maxDist)
{
	vec3 samplePos = o;
	vec4 accum = vec4(0.0);
	float minDiam = 1.0/voxDim;
	float startDist = 2*minDiam;

	float dist = startDist;
	while(dist <= maxDist && accum.w < 1.0)
	{		
		float sampleDiam = max(minDiam, coneRatio*dist);
		float sampleLOD = log2(sampleDiam*voxDim);
		vec3 samplePos = o + d*dist;
		vec4 sampleVal = sampleSpecVox(samplePos, -d, sampleLOD);

		float sampleWt = (1.0 - accum.w);
		accum += sampleVal * sampleWt;

		dist += sampleDiam;
	}

	accum.xyz *= 2.0;

	return accum;
}

 

Why are your voxel reflections transparent?

 

EDIT: Nevermind. I need to read first.


Edited by Chris_F, 02 October 2013 - 01:40 AM.


#19 gboxentertainment   Members   -  Reputation: 770

Like
1Likes
Like

Posted 02 October 2013 - 02:55 AM

Okay, so I'm going to answer my own question about the transparent voxel reflections.

For diffuse reflections (or glossy but not clearly reflective) I had to divide my alpha samples by a factor (say 10 in this case) during filtering, otherwise ugly voxel artifacts occur on the surface - as seen below on the sphere and the red wall (which are glossy but not entirely reflective - specular cone ratios of 0.4).

 

giboxvct2.png

 

The floor, which has a specular cone ratio of 0.01, is now showing clear reflections without transparency.

Of course this scene only runs at about 7fps because I turned up the voxel resolution to 256 to demonstrate the effect.



#20 Styves   Members   -  Reputation: 1077

Like
0Likes
Like

Posted 02 October 2013 - 05:46 AM

Heh, I'll ask again since it seems my question was skipped: how are you downsampling your voxel data? This might play a role in the issue you're having.


Edited by Styves, 02 October 2013 - 05:51 AM.





Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS