Shaders in JME and Shader Nodes

I’m currently trying to wrap my head around the Shader/Material system in JME. I think I get it for the most part, but there’s still some stuff I don’t quite get.

There are some Uniforms used in Shaders (like g_LightColor,g_LightPosition, g_AmbientLightColor) I can’t find in the documentation; Where are those coming from? Are they from the engine and available everywhere?

If so, how do I use them in Shader Nodes? I can’t add them as world parameters or attributes. Do I use material parameters or are they just always there… if so, where do I find all the other engine supplied uniforms?

I feel like the documentation is still a bit thin here.

Which documentation did you look at?

I did a search for “LightColor” and this was the only hit:
https://wiki.jmonkeyengine.org/legacy/doku.php/jme3:advanced:jme3_shaders

Scroll down to the global uniforms section.

Huh, I searched for it several times, I even looked at that page, but I didn’t see it.
Maybe they should be in a table like the attributes farther down that page, because I saw those :smiley:

Now that I know how to get to them, why are they different from the other global uniforms? Why do I have to declare something as simple as a projection matrix and those light uniforms are just available?
Seems confusing from where I am.

I don’t think they are there unless you have lights in your scene. I guess they are different from other global variables because they are different for each pass in multipass lighting. The other globals will be the same for each pass.

It could be that they are automatically included if you specify multipass lighting in the shader… which would make sense to me. I don’t know if they are still available in something like Unshaded which doesn’t do lighting.