This topic is 3641 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

Recommended Posts

Share on other sites
use a cubemap (cubemap shadowmaps arent supported on most hardware) so u will have to emulate a depth map with a standard colormap, this way the texture lookup is only done in one of the sides,

though u will have to render most shadowcasters to more than one side though

Share on other sites
This is the Shader sofar but i can't see what i'm doing wrong, any help is appreciated, somehow i think it has todo with this line

Regard

Paul

float shadowColor = 1.0;	vec4 base = texture2D(tex0,  texCoord);	vec3 bump = normalize(texture2D(tex1,   texCoord).xyz* 2.0 - 1.0);	float depth  = texture2D(tex2, texCoord).r;	vec4 worldPos = invMat * vec4( (texCoord*2.0)-1.0, depth * 2.0 - 1.0, 1.0 );	worldPos.xyz /=worldPos.w;	vec3 lDir =(lightPos - worldPos.xyz);			float distance = length(lDir);	float att=max(0.0, 1.0 - distance/lightRadius)*lightScale;	vec3 lightdir = normalize(-lDir);		vec4 cubecoord = vec4( lightdir, max(max(abs(lightdir.x),abs(lightdir.y)),abs(lightdir.z)) );	shadowColor = shadowCube(tex3, cubecoord).x;		//is this correct	float shadow = (distance < shadowColor)? 1.0 : 0.0;		lDir    = normalize(lDir);		float cos_cur_angle = dot(-lDir,lightDirection);	float diff = max(0.0, dot(lDir, bump));	vec4 final_color = vec4(0.0, 0.0, 0.0, 0.0);	if(diff > 0.0)	{		final_color += base * diff * att *  vec4(lightColor, 1.0)*lightScale;	}		vec4 color = final_color*shadow;	gl_FragColor =color;

Share on other sites
Quote:
 Original post by zedzuse a cubemap (cubemap shadowmaps arent supported on most hardware) so u will have to emulate a depth map with a standard colormap, this way the texture lookup is only done in one of the sides,though u will have to render most shadowcasters to more than one side though

Actually doesn't DX10.1 hardware have support for this? And if so, I am assuming this is coming sooner or later.

Share on other sites
I'm having a geforce 8600, so depth cube maps are supported, from what i have read, and i'm already rendering to a cubemap, i just don't get it how to figure out when a fragment is in shadow and when not. I thought i would just comparing the distance of the fragment with the light, and the value stored in the cubemap

Paul

Share on other sites
IIRC humus has a demo that does omni point shadow maps.

Share on other sites
finally got it working, what i do now, is first render the squared distances into a cubemap, then i use that cubemap later on to compare the distances...seems so easy if you got it working.

here are some screenshots as well as the shader code

my blog

regards,

1. 1
2. 2
3. 3
4. 4
Rutin
17
5. 5

• 11
• 30
• 12
• 12
• 11
• Forum Statistics

• Total Topics
631408
• Total Posts
2999922
×