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

## Recommended Posts

hello all

1/ doen't interest by the question;

2/ if you are not concentrating;

this is my opinion, is it correct :

the picture below describes a method to draw shadow in 3D space using a simple technique, if we have the P as a point light AND we have the vertices of the object  as N (example = teapot) AND we have the vertices of the shadowed object as M (example = floor or plane),

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

the vertex M is in shadow

else

the vertex M is not in shadow

(we all know the vertices NP & NM must be normalized) & using the floor() function of HLSL because the dot() function gives us a value like -0.999999 so we down to the least integer (i mean floor(dot(NP, NM)) == -1).

Edited by abdellah

##### Share on other sites

don't forget that the angle (NP, NM) has the value 180° so dot product will be -1

##### Share on other sites

why ""testing == 1.0 with floats will not produce many shadowing values""

##### Share on other sites

This technique would only work with solid objects with a convex profile, right? It seems like something as simple as a torus wouldn't shadow correctly.

##### Share on other sites

can any one from you build the shader file .fx for me

##### Share on other sites

You'll need some kind of a tolerance since testing == 1.0 with floats will not produce many shadowing values. I'm not sure why would you want to use just point shaped occluders.

However, I don't really see how this algorithm would work on GPU - practically, for each pixel in the viewport you'll access a list of points (in the pixel shader), and then calculate if the point occludes the pixel or not - it will be highly inefficient when the amount of points gets bigger.

Cheers!

abdellah you really should again focus on the kaunas's post. What exactly are you trying to do - do you have really some special situation that the algorith would work well for you? Generally, the idea is not good, because:

You will be checking each vertex of all the shadow recievers (or do you really have just one?) against all vertices of all possible shadow casters (or do you really have just one?). That's not really efficient and it's quite hard to achieve, because when you are drawing a certain vertex (you are in its vertex shader), you don't have information about other vertices - unless you pass them to the shader somehow.

Also a very important thing to keep in mind - a vertex will be in shadow only if it there is some vertex of the shadow caster PRECISELY on the line between the said vertex and the point light. In fact you have just a bunch of point occluders with infinitely small size (ideal points), casting shadows in infinitely thin lines on another set of infinitely small point receivers. What are the odds that you will ever get a single shadow?

##### Share on other sites

Don't think about it because i am taliking too much without reaching any results.

(because i use vbNET & Managed DirectX , so the ressources , is verry low (= 0),  & especially when i see the people use the C++ native & DirectX11 , so i hide from pasting my code , also, my code of HLSL, is verry logic.

##### Share on other sites

Shadow map rendering is still better than the algorithm your proposed - you'll be using much less computing resources. Shadow mapping has been around for a long time already and isn't an issue for any GPU younger than 10 years.

Cheers!

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
633743
• Total Posts
3013644
×