View more

View more

View more

### Image of the Day Submit

IOTD | Top Screenshots

### The latest, straight to your Inbox.

Subscribe to GameDev.net Direct to receive the latest updates and exclusive content.

# RSM indirect Light flickering

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.

4 replies to this topic

### #1StanIAm  Members

Posted 21 March 2014 - 05:18 AM

Hey guys I have a little problem in my implementation of indirect illumination via Pixellights and RSM.
The Problem is that when I move the light I can "see" the sampling points in the scene and it looks not so good. My implementation method is now: Render the RSM with 8*8 samples with a compute shader in a UAV and then in the final deferred shading pass sum the light influence from all 8*8 samples in each pixel.
I use this formula:

For one pixel:

float3 irradiance = float3(0.0f,0.0f,0.0f);
...
for(int i = 0; i < 8*8;i++)
{
irradiance += diffuse.rgb(the color map) * VPLBuffer[i].color.rgb(the sample color) * (saturate(dot(VPLBuffer[i].normal.xyz,position.xyz - VPLBuffer[i].position.xyz)) * saturate(dot(normal,VPLBuffer[i].position.xyz - position.xyz))) / pow(length(position.xyz - VPLBuffer[i].position.xyz),3);

}
....

return float4(diff + irradiance,1.0f);

When I change the exponent of the pow function to 2 or 1 theflickering goes away, but then the light is reflected by a too big distance and it looks bad....
So how to filter that stuff ?? Here is a video of the problem I have and he/she solves it by an unknown filter.

### #2kalle_h  Members

Posted 23 March 2014 - 02:23 PM

float3 irradiance = float3(0.0f,0.0f,0.0f);
...
for(int i = 0; i < 8*8;i++)
{
float3 diff = position.xyz - VPLBuffer[i].position.xyz;
irradiance += VPLBuffer[i].color.rgb(the sample color) * (saturate(dot(VPLBuffer[i].normal.xyz, diff)) * saturate(dot(normal,-diff))) / pow(length(diff),3);

}
irradiance *= diffuse.rgb(the color map);


Code reformatted to see meaning bit easier. Why you do double sided light equation?

### #3StanIAm  Members

Posted 05 April 2014 - 06:22 AM

Oh thanks that makes sense. Well the double sided equation was my first idea of doing that. Is there an other way to do that ??

### #4kalle_h  Members

Posted 05 April 2014 - 09:39 AM

Just try to use binary nDotL test to prevent backside lighting. Then use standard distance square fallof. This should be lot less flickery.

### #5StanIAm  Members

Posted 06 April 2014 - 05:03 AM

But when do I do that ? My first idea was the standart way of indirect lighting with RSM : Create Vector a = reflect( Lightposition - rsm pixel position, rsm pixel normal). Now vector a is the vector which is (maybe) directed to our dest pixel. Now I do nDotL with the dest pixels normal and vector a. Now I have to multiply this float with the rsm color and divide it by the fallof. But I don't realy unterstand what you mean with the binary test. Maybe someone can give me his way of implementing that, because I thing my way is too expensive.

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.