Layered Variance Shadow Maps

Discussion in 'Rendering Technology and APIs' started by Andrew Lauritzen, Mar 28, 2008.

  1. gjaegy

    Newcomer

    Joined:
    Mar 21, 2007
    Messages:
    73
    Likes Received:
    0
    Yes I should definitively try the multi pass approach.

    Current solution is so elegant that am not very willing to go back to the previous implementation however. With D3D9 I was using the multipass approach and was CPU limited. However D3D10 improved the draw call CPU cost, so it might not be the case anymore... will see if I have time.
     
  2. sasahq

    Newcomer

    Joined:
    May 1, 2008
    Messages:
    2
    Likes Received:
    0
    Hello Andrew,

    the PSVSM implementation in our app makes big steps forward.-)
    and now I´am trying to get better performance and get some "negative pixels" away.
    There are three things i have some problems. (most in understanding.-))

    The Thing1


    I found your tips in the
    2006-GDC-Variance-Shadow-Maps.ppt
    Ways to improve Stability

    When using floating-point formats
    Rescale the numeric range to fall in [-1, 1]
    Gets an extra bit of precision from the sign


    and interpreted as like below

    Code:
    [COLOR="DarkOrange"]//rescale the numeric range to [0 1][/COLOR]
    float linstep_0p1(float min, float max, float v)
    {
        return clamp((v - min) / (max - min), 0, 1);
    }
    [COLOR="DarkOrange"]//rescale the numeric range to [-1 1] to get an extra bit of prescion from the sign[/COLOR]
    [COLOR="Blue"]float linstep_m1p1(float min, float max, float v)[/COLOR]
    {
        return clamp( lerp(-1, 1, (v - min) / (max - min)), -1, 1);
    }
    
    float RescaleDistToLight(float Distance)
    {
    	if (VSM_bRescaleDTL) 
    	{
    		if(VSM_bExtraPrecisionBit)
    		{
    			return linstep_m1p1(VSM_LightNearFar.x, VSM_LightNearFar.y, Distance);
    	    }
    		else
    		{
    			return linstep_0p1(VSM_LightNearFar.x, VSM_LightNearFar.y, Distance);
    	    }
    	}
    	else
    	{
    		return Distance;
        }
    }

    did i interpreted your idea right? However it gives me more precision when iám using 64Bit RGBA float 16 when using float linstep_m1p1()


    The Thing2



    Your tip:
    Four-component floating-point formats
    Store extra precision in extra components
    Must still filter linearly!!!


    i interpreted as
    Code:
    // Store extra precision in BA Chanel of RGBA
    float4 EncodeRGBA(float2 moments) {
    	
    	float4 output = 0.0f;
    	const float factor = [COLOR="DarkOrange"]64.0f[/COLOR];
    	output.rg = frac(moments * factor) / factor;
    	output.ba = moments - output.rg;
    	
    	return output;
    }
    Code:
    float2 DecodeRGBA(float4 input) {	
    	return input.xy + input.zw;
    }
    What do you mean with must must still filter linearly?
    It boosts the accuracy by using
    64Bit RGBA float 16
    does it make sense to use it with a
    128Bit RGBA float 32 ,too.
    and i must change
    Code:
    const float factor = [COLOR="DarkOrange"]64.0f[/COLOR];
    to
    Code:
    const float factor = [COLOR="DarkOrange"]128.0f[/COLOR];
    I did not understand what happens here.-(




    The BiggestThing3


    The last visual artifact, mostly visible during driving the car in VSM and PSVSM
    is visible in areas where the surface geometry stands near to perpendicular to the Shadow camera direction vector. (Artifacts i have marked in red ellipses).
    I tried to overwrite this areas with a SelfShadow Term, looks nice but it´s not correct rendering.
    Do you have an idea what to do here.

    Unblurred screenshot.

    [​IMG]

    Blurred Screenshot
    [​IMG]

    Blurred + SelfShadowing
    multiplied with
    Code:
    float normalDotLight = dot(normalize(Input.Normal), normalize(Input.LightDir));
    float4 selfShadow = (EnableSelfShadowing ? saturate(normalDotLight * SelfShadowingSaturate) : 1.0f);
    [​IMG]



    However, Slideshow has bigger Resolution.

    http://picasaweb.google.com/4Sascha/VSMPVSM#slideshow/5327496129378546386

    And an additional one, with PSVSM.
    Hard to get good performance with DX9.-) but it´s gets better and better.
    [​IMG]

    Thanks for your help. I could say your papers has start an addiction in shadows to me.-) When car is driving through shadow areas and all the other physicalized objects cast correct smooth shadows, that´s really give as extra portion of immersion.

    Bye,

    sasa
     
Loading...

Share This Page

  • About Us

    Beyond3D has been around for over a decade and prides itself on being the best place on the web for in-depth, technically-driven discussion and analysis of 3D graphics hardware. If you love pixels and transistors, you've come to the right place!

    Beyond3D is proudly published by GPU Tools Ltd.
Loading...