Hi,
i’m trying to create a custom material with some experimental procedural bump-mapping. Therefore i need to reimplement jme3 lighting in the new material. I am no expert, and this is primary a learning project, but i have some basic knowledge about lightning and shading equations, and some good books for reference.
The following questions arise while experimenting with the shader:
- How can i get access to light direction of DirectionalLight?
- How can i distinguish between DirectionalLight, PointLight, or other light types in my shader?
- Can i use the ShaderLibs somehow to reuse existing light functions?
- How would i access multiple light sources?
I tried to look into Lighting matdef and its vert and frag shaders for better understanding. There i discovered the following global uniform parameters:
uniform vec4 g_LightColor;
uniform vec4 g_LightPosition;
uniform vec4 g_AmbientLightColor;
which are not mentioned in the matdef itself. is this all i need to get the data for lighting computation, are there more such global lighting uniforms that i could use? I also don’t see any array for multiple light-sources there, so i wonder how this works for many lights.
I would love to digg deeper into this stuff and learn to make some nice shaders effects with the engine, so i would be very greatfull for some hints if there are any special things to know about how the jme3 lighting pipeline works, or where to look at to find out more. I could do it with some own custom uniforms, but using the jme3 infra structure would be awsome… Thanks