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

Recommended Posts

hello

is my technique correct?

i use this technique for rendering a shadow using HLSL :

1/ my scene has a sphere located in (0,3,0) & a floor like a plane (y = 0) & a point light located in (0, 7, 0);

2/ the technique is : if we name P the point light position + N is the name of every vertex of the sphere vertices + the point M is for every vertex of the floor vertices, i use two techniques t1 & t2, t1 for gathring the N points & t2 for calculating the vertices M  & then use the math operation :

float4 NP =mul(P, world_matrix) - mul(sphere.Position, world_matrix); // so here we calculate the NP vector.

float4 NM = mul(floor.Position, world_matrix) - mul(sphere.Position, world_matrix); // so here we calculate the NM vector.

// for dot product calculation ;

NP = normalize(NP);

MN = normalize(NM);

if (floor(dot(NP, NM)) == -1)

{

// the vertex M is in shadow

}

else

{

// the vertex M is not in shadow.

}

the scene without shadow is

Edited by abdellah

1. 1
2. 2
Rutin
19
3. 3
khawk
15
4. 4
5. 5
A4L
13

• 13
• 26
• 10
• 11
• 44
• Forum Statistics

• Total Topics
633744
• Total Posts
3013653
×