Please correct me if this is the wrong section.
Alright, so I'm working on this game, on which I made a globe and a sun. Basically its super sexy and all, but if you make the globe bigger(definitely needs to be bigger), the sun disappears from the horizon, althrough the LightState still effects.
I took a few pictures from the "space", which pretty much shows what I'm talking about.
/*
- Just disappered.
/
/
- Moving a tad bit forward, and it reappears.
*/
My sun node:
/**
* Constructs a new sun.
* @param display The DisplaySystem - to create a light state with.
* @param globe The games globe / planet - used to set the light diffuse.
* @param time The server / client time.
*/
public Sun(DisplaySystem display, Globe globe, Time time) {
super("Sun");
this.globe = globe;
this.time = time;
/*
* We create a point light (no need to light in more than one direction - towards our globe).
*/
PointLight pl = new PointLight();
/*
* We make sure its enabled.
*/
pl.setEnabled(true);
/*
* Create and attach the light to a lightState and the lightState to rootNode.
*/
lightState = display.getRenderer().createLightState();
lightState.setEnabled(true);
lightState.attach(pl);
/*
* We create a light node, as a bridge between nodes
* and lights.
*/
ln = new SimpleLightNode("Sun Light Node", pl);
/*
* We set it a good bit our in the space.
*/
ln.setLocalTranslation(new Vector3f(0, globe.getRadius() + globe.getRadius() * 0.15f, 0));
/*
* We attach the light node to this sun node.
*/
this.attachChild(ln);
/*
* We create a sphere to emulate a sun. It doesn't
* have to be super detailed or anything, as its barely seen anyway.
*/
Sphere sun = new Sphere("Sun", 20, 20, 35);
/*
* We give our model bounds.
*/
sun.setModelBound(new BoundingSphere());
sun.updateModelBound();
/*
* And attach it to the light node.
*/
ln.attachChild(sun);
/*
* We set the current angle of the sun, based on the time from the server.
*/
currentAngle = getAngleForTime();
/*
* We make sure the sun is at this angle, simply by rotating it there.
*/
Quaternion rotation = new Quaternion();
rotation.fromAngleAxis(FastMath.DEG_TO_RAD * currentAngle, Z_AXIS);
setLocalRotation(rotation);
}
Simple class extending node.
The sun node is attached to a landscape node (simple class that extends node + uses a ZBufferState)
Have anyone experienced the same thing? Is there any way to forcerender just this single node from a larger distance?
Thanks in advance. ;)
- Mikkel.