www.jpct.net

jPCT - a 3d engine for Java => Support => Topic started by: nill on November 03, 2016, 05:25:08 pm

Title: I can't find direct light, it is not be supported?
Post by: nill 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
Title: Re: I can't find direct light, it is not be supported?
Post by: EgonOlsen 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.
Title: Re: I can't find direct light, it is not be supported?
Post by: nill 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. :(
Title: Re: I can't find direct light, it is not be supported?
Post by: MichaelJPCT 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.