Object specific lightling

Started by lomac, January 22, 2013, 06:42:39 PM

Previous topic - Next topic

lomac

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?

EgonOlsen

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.

lomac

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!

:)

EgonOlsen

Try something like:


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);

lomac

Thanks for the help, that does the trick.