Scalling , Light , NormaliseNormals not working


25-02-2008 20:52:45

SceneManager mgr = mRoot.CreateSceneManager(SceneType.ST_EXTERIOR_CLOSE,"MainScene");
mgr.AmbientLight = ColourValue.Black;
Entity ent = mgr.CreateEntity("robot", "robot.mesh");
SceneNode node = mgr.RootSceneNode.CreateChildSceneNode();
ent.NormaliseNormals = true;
node.SetPosition(100, 100, 100);

node.Scale(0.2f, 0.2f, 0.2f); //<----- damn robot gets dark

Light light;
light = mgr.CreateLight("Light1");
light.Type = Light.LightTypes.LT_DIRECTIONAL;
light.Direction = new Vector3(-100,0,-100);

So here it is It's my CreateScene routine,I'm also rendering terrain and sky. but i have excluded it from code.

Do you notice node.scale line. When i try to scale my "robot" it gets darker (probably becouse of ambient light) I set normaliseNormals on robot entinty to true but i'ts not working, and btw. there is NormaliseNormals property in my SceneNode but it is false, do i have to set it to true ?? and how to do this, this property is read-only.

And this is my first post Welcome Everybody. Ogre/Mogre is great good work (even if setting it up [not default directory] on my computer wasn't just "plug and play" :P)


14-04-2008 17:28:18

Hello Koirat.
I 've the same problem as you and i hope you 've already found a way to solve it ;-)
I recently change from Ogre to Mogre. In Ogre i had that problem before some time, an i solved it by calling:

C/C++-Code with standard Ogre:
SceneNode node ...;

As you in Mogre/C#, i wanted to change the only possible (to me) way: the property "NomaliseNormals":

SceneNode node...;
node.NormaliseNormals = true;

But as you, there ist no way to do so. I suggest there is no set-methode..
I tried out the changeable property of the entity:

entity.NormaliseNormals = true;

...without any effect :-(

Maybe there is a Methode of another class. But i couldn't find some right now. Can someone, or you meanwhile, help me out?

Here my complete method:

void SceneCreating(OgreWindow win)
SceneManager mgr = win.SceneManager;
ResourceGroupManager.Singleton.AddResourceLocation(rootDirectoryOfAllRessources, "FileSystem", "Material", true);

mgr.AmbientLight = new ColourValue(1.0f, 1.0f, 1.0f);

Entity ent = mgr.CreateEntity("SchrankTest", MeshFS.FoundMeshFilesNames.Dequeue().ToString());
ent.NormaliseNormals = true; //<--- looks like there is no effect at all

SceneNode node = mgr.RootSceneNode.CreateChildSceneNode("SchrankTestNode");
//node.NormaliseNormals = true; //<--no access - looks like a protected property.
//at this position in normal ogre the function "node->NormaliseNormals();" works.

node.Scale(100, 100, 100);


By the way:
-> this compile in my program without any problems.
-> there are no .NET runtime-error.
-> ogre.log says: the corresponding material-file is loaded.
-> ogre.log says: there was no error by attach the materials, correspondig to the embedded material-information in the mesh. Don't wonder and suggest i 've forgotten "SetMaterialName(..)". In normal Ogre it's not necessary - i think in Mogre that hasn't changed.

Thanks & Ciao, Noise.


15-04-2008 22:48:15

Okay, it's done. The Problem, i described, wasn't caused by mogre.
"NormalisedNormals = true" works fine.

The Problem was caused by my mesh-file. A buggy format-conversion reversed all normals. So they point into structure and the mesh looks grew.

Here is my advice: when you have a similar problem, you should use for example Blender to checkout the meshs normals. In Blender you can easily see, which direction a normal has. When you see a yellow point at the base of a normal-vector, everything is okay. If it's not: select structure and use function "flip normals". Done.

Ciao, Noise.