smartGL icon indicating copy to clipboard operation
smartGL copied to clipboard

how can you add light ?

Open glebzheglov opened this issue 6 years ago • 2 comments

how can you add light ? I tried to add it through "setLightParallel", but I can't do it

glebzheglov avatar Jan 14 '19 14:01 glebzheglov

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.

smart-fun avatar Jan 14 '19 17:01 smart-fun

thank you ! now I was able to add light to the scene

glebzheglov avatar Jan 15 '19 03:01 glebzheglov