-
Among Genshin Impact Shaders, Metal Shader is being developed. When I looked up several formulas, I need to do dot(world_postion, (world_view_direction + light_direction)) Where can I get light_direction? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
This depends on whether you are using GLSL or nodes. The issue with nodes is that you don't have loops, so you can't just apply the same formula to all lights in the scene automatically. In GLSL this is straightforward, here's an example of a custom shading model: |
Beta Was this translation helpful? Give feedback.
This depends on whether you are using GLSL or nodes.
The issue with nodes is that you don't have loops, so you can't just apply the same formula to all lights in the scene automatically.
Assuming you only have one light in the scene, you could use an Inline Code node with this code:
LIGHTS.lights[0].direction
In GLSL this is straightforward, here's an example of a custom shading model:
#339 (comment)
The definitions for light related structs are here:
https://github.com/bnpr/Malt/blob/Development/Malt/Shaders/Lighting/Lighting.glsl