RSM indirect Light flickering

Started by
3 comments, last by StanIAm 10 years ago
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.color.rgb(the sample color) * (saturate(dot(VPLBuffer.normal.xyz,position.xyz - VPLBuffer.position.xyz)) * saturate(dot(normal,VPLBuffer.position.xyz - position.xyz))) / pow(length(position.xyz - VPLBuffer.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.
Advertisement

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?

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 ??

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

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.

This topic is closed to new replies.

Advertisement