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
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 )
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
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
renderManager.setSinglePassLightBatchSize().
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.