Author Topic: I can't find direct light, it is not be supported?  (Read 2563 times)

Offline nill

  • byte
  • *
  • Posts: 7
    • View Profile
I can't find direct light, it is not be supported?
« on: November 03, 2016, 05:25:08 pm »
if i set up an ambient light, the scene looks like this:  the surface of the cube all are brightness , see attachment bad.png
i want it looks like good.png , but i can't find direct light to implement that effect.

help me out pls

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: I can't find direct light, it is not be supported?
« Reply #1 on: November 03, 2016, 07:22:12 pm »
There's a Light class for lights. Just turn down the ambient light and place a light source in front of the cube. Depending on the object, that might still not create such sharp edges. If that's an issue, post again.
« Last Edit: November 03, 2016, 07:24:32 pm by EgonOlsen »

Offline nill

  • byte
  • *
  • Posts: 7
    • View Profile
Re: I can't find direct light, it is not be supported?
« Reply #2 on: November 04, 2016, 01:54:18 am »
I turn down the ambiant light of the world, and setup a light (seems a  spot light).
here are the code:

world.setAmbientLight(1, 1, 1);

Light light = new Light(world);
light.setIntensity(128, 128, 128);
light.setAttenuation(800);
light.setPosition(new SimpleVector(-100, 0, 100));

obj.setAdditionalColor(Color.blue);
world.addObject(obj);

is better ,but the sharp edges still not show up. :(

Offline MichaelJPCT

  • float
  • ****
  • Posts: 264
    • View Profile
Re: I can't find direct light, it is not be supported?
« Reply #3 on: January 03, 2017, 08:25:36 am »
i think the Light in JPCT is omni light (light ball, all directional).
if you want to simulate sunlight shining on earth, place a light 100000 units away, and make its intensity not fade.
if you want multiple lights with multiple directions in one scene, i don't know how.