smartGL
smartGL copied to clipboard
how can you add light ?
how can you add light ? I tried to add it through "setLightParallel", but I can't do it
Hello Zazolin and thanks for using smartGL.
The light feature is beta and is not documented yet (sorry), but you can use it.
If you look at the smartglapp, you'll see that it is used.
You need to use a shader that handles the lights (SHADER_TEXTURE_LIGHTS) like this:
RenderPassObject3D renderPassObject3D = new RenderPassObject3D(RenderPassObject3D.ShaderType.SHADER_TEXTURE_LIGHTS, true, true);
renderer.addRenderPass(renderPassObject3D);
then you can set 1 Parallel light:
SmartColor lightColor = new SmartColor(1, 0, 1);
Vector3D lightDirection = new Vector3D(0.2f, -1, -1);
LightParallel lightParallel = new LightParallel(lightColor, lightDirection);
renderer.setLightParallel(lightParallel);
and/or an ambient light:
LightAmbiant lightAmbiant = new LightAmbiant(0.3f, 0.3f, 0);
renderer.setLightAmbiant(lightAmbiant);
If your ambient is too much white, probably you won't see the parallel light. Try eventually different light directions.
Arnaud.
thank you ! now I was able to add light to the scene