I know there is point light and spotlight, but i want more modified source of light like sun for example where the light spread from the whole surface of the sphere or box of light to stimulate various model of lamp.
Sun light like model i think will give different effect to the object.
I dont think directionalLight can representing a sun like source of light model since the direction of light are same in all position while the sun has light direction from different direction since the light source come from the whole surface that will create different light angle.
In terms of realism, you are correct, it doesn’t attenuate or spread - as a lamp would for example. but the user would not normally notice. If you really do want that kind of detail from your light, you could use a point light:
[java]
PointLight pl = new PointLight();
pl.setAttenuation(true); //we want to attenuate this light.
//attenuation is making the light die off at further distances
//from the source.
//These values determine how much loss there should be in
//relation to distance from the source. Make them smaller for
//the light to be brighter and larger for the light to be dimmer.
pl.setConstant(.1f);
pl.setLinear(.01f);
pl.setQuadratic(.01f);
[/java]
In short everything is only a approximation, and with using real-time ready methods there is no way to get a real lighting,
a real enough feeling lighting is perfectly possible however.
So funny thing. Given the distance of our sun and the size etc at this distance the rays of light are as close to perfectly straight as to indistinguishable to the human eye. But if you were saaaaaaaay on Mercury that might be a different story entirely. If you’re making a game that is thoroughly based on being on earth directional light would be “accurate enough” most likely.
To the best of my knowledge, nobody’s implemented area lights for jMonkeyEngine yet. So you’re limited to directional, spot, point, and ambient lights.
Actually i want to stimulate a realistic moon phase. For approximation point light or spot light is enough, but i think we can create an area source of light.
@srabutdotcom said:
Actually i want to stimulate a realistic moon phase. For approximation point light or spot light is enough, but i think we can create an area source of light.
I don’t understand why a moon phase cannot be simulated with a directional light. The sun is far enough from the moon that effectively all light beams are parallel. Additionally, the amount of over-hemisphere scatter on the surface is very minimal.
@pspeed said:
I don't understand why a moon phase cannot be simulated with a directional light. The sun is far enough from the moon that effectively all light beams are parallel. Additionally, the amount of over-hemisphere scatter on the surface is very minimal.
A point light casts a sharp shadow, but the moon is 0.008 radians across, so its shadows are not perfectly sharp. There’s a penumbra 8 cm across from an object 10 m distant. (Same with the sun, of course.)
I can’t see that details like this would matter in a game, unless it’s a game involving pinhole cameras or eclipses.
Actually this project is for scientific purposes. I will make some comparison first between phase using point light, directional light with the real result from nasa.
@srabutdotcom said:
Actually this project is for scientific purposes. I will make some comparison first between phase using point light, directional light with the real result from nasa.
There must be better tools for this purpose than jMonkeyEngine!