Find angle face under mouse pointer

Hi,
I state that I am a c# programmer, but bad shaders programmer :slight_smile:

I have a projector component and I need to find the angle projected texture to exclude the projecting on vertical faces.

My projector is under the mouse pointer and when is over an horizontal faces is ok.

I would like to prevent the projector “work” also on vertical faces to avoid this bad effect.

If possible I would do it in the shader code to avoid the vertical projected image even if the cursor is located on the corners of an horizontal face and a part “goes out” on vertical face.

In c# i find this solution:

if (Physics.Raycast(MouseRay,out hitInfo)){

if(hitInfo.normal.y>0)
draw...

else

not draw...

....

But only it works on curved surfaces and not, for example, on the face cubes.

How can I do?

Solved, and per-pixel :slight_smile:


With this simple code:

if(input.norm.y<=0)
textureColor=float4(0.0, 0.0, 0.0, 0.0);

Very thanks to… me. :wink: