Skip to main content
GameDev.net gamedev.net
🔒 Locked

soft edged shadows problem

Started by DiPharoH Aug 4, 2009 at 8:44 PM 3 replies 800+ views
Original Post
DiPharoH
DiPharoH
guys after struggling i managed to implement soft edged shadows but i have a problem when i move away from the shadows it go i mean it disappear is it normal????? what should i do???? here is the shots is it because i blur it so hard?? ok here what i do i calculate the shadows by storing the depth then i write the shadows to a floating point texture then blur that texture so hard i set it to a texture with(ScreenWidth / 8) * (ScreenHeight / 8) then blur it with the blur filter which came in the sdk in that blur effect i must convert from pixels to textels i divide by(ScreenWidth / 16), (ScreenHeight / 16) so what???? that's near near alittle far near so far near
Zuka
Zuka
Might have something to do with the fact it's in screen-space...?
Hi, I can't really come up with a good signature at the moment...
Hodgman
Hodgman
Quote:
Original post by DiPharoH
is it because i blur it so hard??
Looks like it. Try blurring it less...
DiPharoH
DiPharoH
it is screen space
i cannot blur it less the problem with screen space
actually i donot know what is screen space
and in the shader should i convert from pexels to texels or from texels to pixels for the text2d command
i really need to know to convert them in the shader
ok here how i do the shit

writting the shadows to the floating point texture


//transform from RT space to texture space.
float2 ShadowTexC = 0.5 * vPosLight.xy / vPosLight.w + float2( 0.5, 0.5 );
ShadowTexC.y = 1.0f - ShadowTexC.y;

float LightAmount = (tex2D( g_samShadow, ShadowTexC + float2(1.0/SMAP_SIZE, 0) ) < (vPosLight.z / vPosLight.w) - SHADOW_EPSILON)? 0.0f: 1.0f;




// Light it
Diffuse = ( saturate( dot( -vLight, normalize( vNormal ) ) ) * LightAmount) ;
} else
{
Diffuse = g_vLightAmbient ;
}

return Diffuse;

now i acces the floating point texture to get shadows multiply it by the scene pixel

vertex shader

oPos = mul( iPos, g_mWorldView );

oPos = mul( oPos, g_mProj );

ScreenCoord.x = ( oPos.x * 0.5 + oPos.w * 0.5 );
ScreenCoord.y = ( oPos.w * 0.5 - oPos.y * 0.5 );
ScreenCoord.z = oPos.w;
ScreenCoord.w = oPos.w;

pexel shader

float shadows = tex2Dproj( g_samSBuffer, ScreenCoord );

return tex2D( g_samScene, Tex) * shadows ;

ohh i can do the shit but i donot understand it
please someone tell me what why convert pixels texels screen space???
DiPharoH
DiPharoH
guys i am triing to use a cheap blur so i blur it so much by using a small texture to fit it on a bigger quad that's cheap blur
do you think i should not do that so the shadows will not disappear

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.