Skip to content

How can I use light direction or any attributes? #468

Answered by pragma37
warlockhb asked this question in Q&A
Discussion options

You must be logged in to vote

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

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by warlockhb
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants