hii!
“oh noez not yet another lighting topic…!”
Since I don’t think this is related to the previous lighting stuff I posted I made a new topic. Maybe it’s just something I did not consider or forgot some code; the issue is following: I experienced that when I use large boxes, or imported models and scaled them larger => the light does not work correctly anymore. This may be a mistakenly wrong interpretation from my side because I guess it’s some kind of “shading mode” in JME:
In detail:
There is a small box on the left side and a very large box on the right side. Both boxes are in equal distance from the light source.
Picture 1: You can hardly see the large box on the right, but you see the nice red light on the small box.
Picture 2: Just to show that there really is a large box on the right. Again - only the small box is lighted.
Picture 3: Now that’s what I would have expected as a result.
Any explaination :?
import com.jme.app.SimpleGame;
import com.jme.bounding.BoundingBox;
import com.jme.bounding.BoundingSphere;
import com.jme.light.PointLight;
import com.jme.math.Vector3f;
import com.jme.renderer.ColorRGBA;
import com.jme.scene.Spatial;
import com.jme.scene.shape.Box;
import com.jme.scene.shape.Sphere;
public class HelloWorld extends SimpleGame{
public static void main(String[] args) {
HelloWorld app=new HelloWorld(); // Create Object
app.setConfigShowMode(ConfigShowMode.AlwaysShow);
app.start(); // Start the program
}
protected void simpleInitGame() {
this.lightState.detachAll();
Box b=new Box("My box",new Vector3f(0,0,0),new Vector3f(2,40,40)); // Make a box
b.setModelBound(new BoundingBox());
b.updateModelBound();
b.setLocalTranslation(5,-20,-20);
rootNode.attachChild(b); // Put it in the scene graph
Box b2=new Box("My box",new Vector3f(0,0,0),new Vector3f(1,1,1)); // Make a box
b2.setModelBound(new BoundingBox());
b2.updateModelBound();
b2.setLocalTranslation(-5,0,0);
rootNode.attachChild(b2); // Put it in the scene graph
Sphere LightSphere = new Sphere("lp", 10, 10, .25f);
LightSphere.setModelBound(new BoundingSphere());
LightSphere.updateModelBound();
LightSphere.setLightCombineMode(Spatial.LightCombineMode.Off);
LightSphere.setDefaultColor(ColorRGBA.red);
rootNode.attachChild(LightSphere);
PointLight pl = new PointLight();
pl.setDiffuse(ColorRGBA.red);
pl.setQuadratic(0.01f);
pl.setAttenuate(true);
pl.setEnabled(true);
lightState.attach(pl);
rootNode.updateGeometricState(0,false);
rootNode.updateRenderState();
}
}