Lighting Problems

Jin

16-05-2006 15:09:27

I've created a simple scene with a particle fountain, 2 boxes, and a light. the second box is supposed to cast a shadow onto the first box, but the light will not appear. This is using ODN 1.2 Final.

protected override void CreateScene()
{
mSceneManager.SetAmbientLight(Color.FromArgb(16, 16, 16));
mSceneManager.ShadowTechnique = ShadowTechnique.ShadowTypeStencilAdditive;

SceneNode pnode = mSceneManager.CreateSceneNode("PSystemNode");
pnode.Position = new Vector3(0, 50, 0);
mSceneManager.GetRootSceneNode().AddChild(pnode);
ParticleSystem psystem = mSceneManager.CreateParticleSystem("PSystem1", "Examples/PurpleFountain");
pnode.AttachObject(psystem);

Entity box = mSceneManager.CreateEntity("Box1", "cube.mesh");
mSceneManager.GetRootSceneNode().CreateChildSceneNode().AttachObject(box);
box.MaterialName = "Examples/Rockwall";

Entity box2 = mSceneManager.CreateEntity("Box2", "cube.mesh");
box2.CastShadows = true;
mSceneManager.GetRootSceneNode().CreateChildSceneNode(new Vector3(-200, 50, 0)).AttachObject(box2);
box2.MaterialName = "Examples/Rockwall";

Light light = mSceneManager.CreateLight("Light1");
light.Type = Light.LightTypes.Point;
light.Position = new Vector3(0, 75, 0);
light.DiffuseColor = Color.White;
light.SpecularColour = Color.White;
}


The problem is that the light will not show up, it said that by default the light should illuminate about 1000 world units, but it is not there. Also, how do you set the range of the light? Maybe it's just something I'm doing wrong in the code, I don't know.

rastaman

18-05-2006 19:49:22

your light is inside the first box. try:
light.Position = new Vector3(0, 75, -100);

rastaman

18-05-2006 20:45:06

Hmm somthing is werid here. The point light seems to be acting like a directional light. I put it in a node didn't set a position on the light just changed node position. If it has a positive z, the light shines into negative z and vise versa.

I wander if the value of the enum is not going to ogre correctly.

Jin

19-05-2006 15:59:25

Is this some sort of error caused by SWIG? Or is it something else?

rastaman

23-05-2006 04:17:22

Is this some sort of error caused by SWIG? Or is it something else?
No, it is how Ogre is working, I tried in c++. Things on zero Z axis will not be lit if the light is at zero Z axis. Move everything to +/- say 100 on Z axis and see what you get.