Facepunch / sbox-issues

175 stars 12 forks source link

[Shadergraph] Normal Vector + Main Light Direction #5385

Closed cmg-divined closed 6 months ago

cmg-divined commented 6 months ago

For?

Other

What can't you do?

I'd like to change the brightness based on the direction of the light by using a normal vector node which is a vector that is perpendicular to the surface of the geometry, in our case the vertices on the model (similar to Unity's) based on the main light direction (also similar to Unity's node).

How would you like it to work?

Well, normal vector should have Object, View, World, Tangent space. Main Light Direction should just grab the normalized direction of the sun light in world space.

What have you tried?

I'm not sure if there is something to try for either of these things, I looked at all the nodes and couldn't figure something out. Maybe there's something there for normal vector that I'm not seeing?

Additional context

I think the addition of these two will open up a lot more possibilities for shadergraph alone.

cmg-divined commented 6 months ago

Here's the similar nodes from Unity:

https://docs.unity3d.com/Packages/com.unity.shadergraph@7.1/manual/Normal-Vector-Node.html

https://docs.unity3d.com/Packages/com.unity.shadergraph@13.1/manual/Main-Light-Direction-Node.html

cmg-divined commented 6 months ago

Okay so apparently we can use world normal for world normal vector which is good (thanks kristi for pointing it out!), would be nice to have something for light though! 😄