1
$\begingroup$

I'm looking for roughly the same result.

( in the example I'm spinning the big sphere along with the small sphere ( which represents the fake light ) around the big sphere's origin. )

enter image description here

I think the algorithm below might work, but I don't understand how to implement it in Shader Graph.

The point is to take the Light source pos vector in the Vertex space of each vertex of the mesh and normalize it. Then calculate Dot product.

enter image description here

$\endgroup$

1 Answer 1

2
$\begingroup$

You can do this by using two texture corrdinates and using the object coordinates of the light for one of them. Then simply Vector Math: Dot Product.

enter image description here enter image description here

Note: There is a small problem with this setup which I haven't been able to identify the solution to. The gradient isn't perfect. It reaches 1 too early. So like if you use a color ramp after this. it probably won't work.

$\endgroup$
2
  • $\begingroup$ Here you can see that the approach and distance of the "light source" changes the gradient. It is necessary that the gradient does not change. media.giphy.com/media/… Here I showed one of the options that should work, but I don't know how to implement it. Might be worth thinking along those lines. i.sstatic.net/kRSby.png $\endgroup$ Commented Aug 22, 2023 at 13:02
  • $\begingroup$ There is also an option to take the texture coordinates of the object, isolate one of the axes through XYZ Separate and simply twist the texture coordinates of the objects somehow so that the isolated axis always looks towards the "Light source", turning in its direction when it is moved. $\endgroup$ Commented Aug 22, 2023 at 13:05

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .