Author Topic: Lighting that is not bound to a position  (Read 947 times)

Offline MadsPH

  • byte
  • *
  • Posts: 3
    • View Profile
Lighting that is not bound to a position
« on: October 05, 2014, 10:45:30 pm »
Hi!

So far I've only found methods to add point lighting to the World. I would really like to use directional lighting, though. How do I achieve this? Also, are spotlights supported? 

Thanks in advance. :)

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11748
    • View Profile
    • http://www.jpct.net
Re: Lighting that is not bound to a position
« Reply #1 on: October 05, 2014, 10:50:10 pm »
By default, you get point lights and ambient lighting. For anything else, you would have to write your own shaders, i'm afraid. What do you want to use the directional light source for?

Offline MadsPH

  • byte
  • *
  • Posts: 3
    • View Profile
Re: Lighting that is not bound to a position
« Reply #2 on: October 05, 2014, 11:47:29 pm »
Lighting up all the Object3D's in the scene, so that objects in a huge scene are still lit up.
Adding point lights for every objects is taxing and not very pretty in the long run.
Ambient light is not very pretty either, or at least not as pretty as two or three directional lights on all the objects.

I'm a little afraid to use shaders because of limitations. This line (from "Advanced Example" on the wiki): "When using a shader, the fixed function pipeline is disabled completely for this object", scares me. Also, theres the things about shaders only working on compiled objects.

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11748
    • View Profile
    • http://www.jpct.net
Re: Lighting that is not bound to a position
« Reply #3 on: October 06, 2014, 07:39:12 am »
Just place a point light "far away" from the scene and set both attenuation and discard distance to -1. I'm doing it this way to create a sun, for example.

Offline MadsPH

  • byte
  • *
  • Posts: 3
    • View Profile
Re: Lighting that is not bound to a position
« Reply #4 on: October 06, 2014, 08:40:27 pm »
Ah, that's great. I did not realize that was an option. I can use that instead of directional lights. Thank you.