Hello there!

I’m searching for a solution to calculate a reflected light vector. I want to use this to get the angle between the reflected light vector and the incoming camera vector. The resulting angle should be used with a color gradient or as a blending factor.

I know it isn’t possible to obtain a light position in Cycle. That’s why I’m using a Combine XYZ with Driver to connect one light position (sun).

The formula to calculate the reflected light vector should be:

R = L - 2 N ( L . N )

L - light vector

N - normal (of shading point)

. - dot product

To get the final angle between the reflected light vector and the camera, I’d just take the dot product between the two vectors.

I’ve translated both terms into these networks:

and

(can’t post another image, I’ll try to post it in a comment)

Unfortunately, it doesn’t work. The resulting value is somewhat dependent on both inputs (camera, light position), but it’s nowhere near the expected result. The yellow material should only be visible when the light is reflected. At least to my understanding.

Could anyone help me with this? Thank you!