www.jpct.net

jPCT-AE - a 3d engine for Android => Support => Topic started by: lomac on January 22, 2013, 06:42:39 pm

Title: Object specific lightling
Post by: lomac on January 22, 2013, 06:42:39 pm
I managed to create a lightmapped level and render it jPCT. (I may post tutorial on how to do this). Since the lightmaps supply the shading, I render the level with full ambient lighting and no other lights. Now if I want to add player models to the scene, I would like them to be vertex lit by lights added to the world, but not by the ambient lighting. So I want the level lit ambient only, and the player models lit by the lights only and a reduced amount of ambient. How can I do this?
Title: Re: Object specific lightling
Post by: EgonOlsen on January 22, 2013, 10:51:48 pm
You could try to lower the ambient color to the value that you want to use for the models and compensate for that on the level by setting an additional color.
Title: Re: Object specific lightling
Post by: lomac on January 23, 2013, 09:09:12 am
Sorry I'm a bit of a noob, I don't get this " by setting an additional color." I must be missing something.

Currently for the level I have

world.setAmbientLight(250, 250, 250);

For the models I want something like

world.setAmbientLight(20, 20, 20);
sun = new Light(world);
sun.setIntensity(250, 250, 250);

But they are both in the same world!

 :)
Title: Re: Object specific lightling
Post by: EgonOlsen on January 23, 2013, 09:54:36 am
Try something like:

Code: [Select]
world.setAmbientLight(20, 20, 20);
level.setLighting(Object3D.LIGHTING_NO_LIGHTS);
level.setAdditionalColor(230,230,230);
sun = new Light(world);
sun.setIntensity(250, 250, 250);
Title: Re: Object specific lightling
Post by: lomac on January 23, 2013, 10:11:50 am
Thanks for the help, that does the trick.