Jump to content

  • Log In with Google      Sign In   
  • Create Account

Banner advertising on our site currently available from just $5!

1. Learn about the promo. 2. Sign up for GDNet+. 3. Set up your advert!


Member Since 02 Mar 2010
Offline Last Active Mar 25 2015 07:51 AM

Posts I've Made

In Topic: Volumetric Scattering (screen-space) done efficiently ?

25 January 2015 - 06:35 AM

I'm not combining them seperately in a final pass I'm using the blurred output from the first as the input to the second and at the third pass.

By the way the above screens were taken using your code. I don't get why we have so different results.

In Topic: Volumetric Scattering (screen-space) done efficiently ?

25 January 2015 - 05:21 AM

Unfortunately I can't upload a video here because of my crappy internet line but I exported screenshots from RenderDoc showcasing it using the 8x8x8 with different densities each.


Note: Seems like it doesn't gamma correct when exporting that's why they look so dark here.


Input Mask:



First 8 sample pass (Density = 1.0):



Second 8 sample pass (Density = 0.5):



Final 8 sample pass Density = 0.25):




If I multiply the final color by 0.2 or so it doesn't look as overblown but the sky completely fades to black which is not what I want...


The best quality/performance result I've gotten at this point is downsample to 1/2 using a wide gaussian blur then scatter using ~96 samples and upsample again using wide gaussian. Runs at about 1.8ms on my AMD Radeon 5750M. However the result is obviously a little blurry and not as tight as pure 128 samples in full res.


@kalle_h I'm not very familiar with using the jittering you describe. How is this done ? Multiply the Density by some random 2D vector ?

Or could I use a different step size every frame and combine these ?

In Topic: Volumetric Scattering (screen-space) done efficiently ?

24 January 2015 - 06:16 PM

Hmm I'm using a similar code based on the sample from GPU gems 3

// Performs a directional blur from the light source to approximate volumetric scattering
float3 Scatter(in VSOutput input) : SV_Target
	// Calculate vector from pixel to light source in screen space
	float2 sunSS = SunPositionSS.xy;
	float2 deltaTexCoord = (input.TexCoord - sunSS.xy);

	// Divide by number of samples and scale by control factor
	deltaTexCoord *= (1.0f / numSamples) * Density;
	// Store initial sample
	float3 color = InputTexture0.Sample(LinearClampSampler, input.TexCoord).rgb;
	// Set up illumination decay factor
	float illuminationDecay = 1.0f;
	float2 uv = input.TexCoord;

	// Evaluate summation n iterations
	for (int i = 0; i < numSamples; i++)
		// Step sample location along ray
		uv -= deltaTexCoord;

		// Retrieve sample at new location
		float3 sample = InputTexture0.Sample(LinearClampSampler, uv).rgb;

		// Apply sample attenuation scale/decay factor
		sample *= illuminationDecay * Weight;
	        // Accumulate combined color
		color += sample;

		// Update exponential decay factor
		illuminationDecay *= Decay;

	return  (exposure * color);

I just tried your code and it does seem to produce a difference result but still not as smooth as in your screenshot.

In Topic: Volumetric Scattering (screen-space) done efficiently ?

24 January 2015 - 04:29 AM

So let me get this right....you use the blurred output from the first pass with 8 samples as the input to the second pass with 8 samples and so on ?

I'm just having a hard time seeing how 8 samples (basically being 8 little ghosts/copies of the picture) combine to a smooth light beam.

Also the sample distance...would that be the deltaTexCoord from the currentTexCoord to the sun position in screen space ? So each time it has to be half the distance from before meaning effectively 1/2,1/4 ?


My result looks like this:


In Topic: Volumetric Scattering (screen-space) done efficiently ?

23 January 2015 - 02:52 PM

While these more advanced techniques are pretty interesting...what I'm trying to do right now is have the more basic screen space radial blur working fast (and good looking!).


@DASTech can you give me more details about this interleaved sampling approach ? I thought about some kind of temporal supersampling but I'm not sure how to do that.