Problems with the normals

The place for artists, modellers, level designers et al to discuss their approaches for creating content for OGRE.
Post Reply
Janete
Kobold
Posts: 34
Joined: Wed Mar 15, 2006 5:41 pm

Problems with the normals

Post by Janete »

Hello!

I have some problems with the normals.

Here's the deal:

I developped a facial mesh in blender.
I exported with reimpell script preview-latest and see it mesh viewer and it was ok.

Problem:
Then I added some vertex keys animation and I tryed it facial_demo (that comes with ogre) and in the meshviewer and I couldn't see the materials in the mesh. It becomes black... or maybe very very dark, because I've added some red and I can see a dark red.

I can see it moving (I can see the information aboutr FPS) but I can't see the materials of the mesh.

When I'm running the Reimpell script, I also get this "Warning: error in normalize! Face of mesh "facial" too small."


Question
I think the problem is with the normals. Maybe it's not well calculated and it becomes very very dark.

So, does anyone knows a method to recalculate the mesh normals outside? In blender or Ogre... I just need it to have some colour. Or does anyone knows a solution for this?

It is very important...

Tnx**
reimpell
OGRE Contributor
OGRE Contributor
Posts: 570
Joined: Mon Mar 01, 2004 10:35 am
Location: Hamburg, Germany

Re: Problems with the normals

Post by reimpell »

Janete wrote:So, does anyone knows a method to recalculate the mesh normals outside?
Check the normals inside blender (draw normals in edit mode) before exporting and use

Code: Select all

Ogre::Entity::setNormaliseNormals(true)
Janete
Kobold
Posts: 34
Joined: Wed Mar 15, 2006 5:41 pm

Post by Janete »

Check the normals inside blender (draw normals in edit mode) before exporting and use
Code:
Ogre::Entity::setNormaliseNormals(true)
Hi!

I had also some problems with the camera, so now I puted autotractking and I can see my mesh.

I checked the normals in blender and they are outside. I've tryed to put this code but is still not working. Here's what I have done:

void createScene(void){

// Set ambient light
mSceneMgr->setAmbientLight(ColourValue(0.5, 0.5, 0.5));

// Create a light
Light* l = mSceneMgr->createLight("MainLight");
l->setPosition(20,80,50);
l->setDiffuseColour(1.0, 1.0, 1.0);

// Create a light
l = mSceneMgr->createLight("MainLight2");
l->setPosition(-120,-80,-50);
l->setDiffuseColour(0.7, 0.7, 0.6);

MeshPtr mesh = MeshManager::getSingleton().load("Face.mesh", ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME);

Animation* anim = mesh->createAnimation("manual", 0);

VertexAnimationTrack* track = anim->createVertexTrack(4, VAT_POSE);

manualKeyFrame = track->createVertexPoseKeyFrame(0);

// create pose references, initially zero
for (int i = 0; i < SI_COUNT; ++i){
manualKeyFrame->addPoseReference(poseIndexes, 0.0f);
}

// setup GUI system
mGUIRenderer = new CEGUI::OgreCEGUIRenderer(mWindow,
Ogre::RENDER_QUEUE_OVERLAY, false, 3000, mSceneMgr);

mGUISystem = new CEGUI::System(mGUIRenderer);

CEGUI::Logger::getSingleton().setLoggingLevel(CEGUI::Informative);


Entity* head = mSceneMgr->createEntity("Face", "Face.mesh");
head->setNormaliseNormals(true);

speakAnimState = head->getAnimationState("Ao_calhas");
speakAnimState->setEnabled(true);

manualAnimState = head->getAnimationState("manual");
manualAnimState->setTimePosition(0);

SceneNode* headNode = mSceneMgr->getRootSceneNode()->createChildSceneNode();

headNode->attachObject(head);


mCamera->setPosition(20, -50, 0);
mCamera->setAutoTracking(true,headNode);

(...)

} //createScene(void)



I don't know if that's ok, but I searched for other examples and it was similar to this... I can't find what it's wrong...

Tnx anyway :)
Post Reply