Author Topic: Object specific lightling  (Read 2071 times)

Offline lomac

  • byte
  • *
  • Posts: 9
    • View Profile
Object specific lightling
« 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?

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: Object specific lightling
« Reply #1 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.

Offline lomac

  • byte
  • *
  • Posts: 9
    • View Profile
Re: Object specific lightling
« Reply #2 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!

 :)

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: Object specific lightling
« Reply #3 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);

Offline lomac

  • byte
  • *
  • Posts: 9
    • View Profile
Re: Object specific lightling
« Reply #4 on: January 23, 2013, 10:11:50 am »
Thanks for the help, that does the trick.