[SOLVED] Shader node - WorldParam.LightColor / AmbientColor

Hello there,

I’m playing with ShaderNode system which seems to be just great,
but i ran into issue when trying to add some world lighting color.

Is there something more to add to my fragment shader node in order to use AmbientColor or LightColor, found in WorldParam ?
Maybe something related to technique ? I’ve read something about “Multipass” needed when using Ligthing incomming color. Any clues about that please ? Maybe @Nehon could make it clear ?
Thank you

Those params will be automatically added to the shader if the technique specify a LightMode (multipass or singlepass)

btw are you using 3.0 or 3.1 alpha?

3.1 with your ShaderNode system.

How or where do I specify this line ?

You have to edit the material definition directly (in the code) and add LightMode Whatever inside the Technique block
See how it’s done in the lighting.j3md

Ok thank you I’ve fix it and it works as expected.
As the use of AmbientLight and LightColor relies of the specification of this simple line, maybe you could put this option in gui, juste like you do for WorldParam or Attribute. Perhaps something on right click like “Add a light mode for Lighting shader”.

Btw thank you for your quick reply and keep up your nice work on JME (should be expend to both core members and contributors of course :slight_smile: )

Yep it’s in the todo. I want to add some Light mode combo with “unshaded”, “Multipass” and “Singlepass”.
But figured it was not top priority since you can easily edit it in the material definition.
But yeah… provided you know what to write and where to write it :wink:

edit : and thanks for the kind words :wink:

1 Like

And can you explain the difference between these two mode “Multipass” and “Singlepass” ? or maybe there is some wiki I missed…

I’ve heard some things changed with lighting pass in jme3.1.
Is Multipass still required ?

Well I have yet to make proper doc about that…

So in a nutshell :
Multipass renders a geometry once for each light it’s affected by. The result are blended in a modulate way. That’s the mode used in jme 3.0. This means that if a geom is affected by 10 lights it will be rendered 10 times.

Singlepass renders a geometry once for a batch of lights. This batch is just an array of lights with associated data. The max number of lights can be set using


If the number of light exeeds the size of the batch, the renderer will make an additional pass with the remaining lights.
So for example, we still have that geom affected by 10 lights, and we set a batch size to 5, this geom will be rendered twice.