Improved shadow renderer

Thanks Momoko_Fan, i guess global parameters would be nice but they aren’t really necessary here.

I do have most things working, i updated the git repository.
If you want to run the test app you can switch between different light types with “space”, switch between new shadow renderers and old ones with “1” and stop the shadow light from moving with “2”.

A picture of the spot light:

I’m currently using new classes for the lights which extend the old light classes (They only implement an empty interface).
The other thing i did was to extend the material class where i use updateLightListUniforms() to find the shadow casting light and set the material parameter for the shader.
(Well and obviously new shadow renderers)

This isn’t optimal but that way it’s working without having to modify jMonkeys core.

Now one thing i don’t know if there already is a better solution but my shader file does look rather messy:

My problem is the vertex and fragment shader nodes have a lot of inputs and outputs and most of them are just parameters which will be set by the different shadow renderers.
It would be really great if there was an option to pre define the parameters so that the user would have only two inputs and one output for the shader node instead of twenty which always have to be configured the same way.
Another slightly annoying thing is the node editor does sometimes remove my defines from the j3md file (i couldn’t reproduce reliably when it does happen, but i think it was usually after the shader failed to compile).

For my own use case everything is working good enough now, so i’ll move on to creating a few shader nodes to support hardware skinning, instancing, normal mapping and all those things (which I’ll also upload, since as far as i can tell most of those are missing from the provided shader Nodes).

7 Likes