Page 1 of 1

Maya OBJ Hidden Surface problem

Posted: Tue Sep 12, 2006 6:01 pm
by KertDawg
Hello,

I'm a newbie to both Irrlicht and Maya. I can run the HelloWorld tutorial just fine. I'm using MSVC++ 2005 and Windows XP.

I want to create a model in Maya 7 and use it in Irrlicht. I created a model consisting of a number of polygon cylinders to make a very simple rocket ship. I did not add materials or color in Maya. I exported the ship to an OBJ file. The ship appears and rotates nicely. However, certain polygons appear to be backward. That is, they do not appear when they should, but they do appear when the polygon should be facing the other way. The strange thing is that I created the entire model the same way; I there is nothing special about the polygons that don't appear correctly.

When using DX8 or DX9, it behaves as I explained. When I run it with the Solftware2 renderer, it works almost the same way. Fewer polygons behave this way, but some still do.

Here's some relevant code:

Code: Select all

int main(int argc, char **argv)
{
	IrrlichtDevice *MyDevice;
	video::IVideoDriver* MyVideoDriver;
	scene::ISceneManager* MySceneManager;
	gui::IGUIEnvironment* MyGUI;
	scene::IAnimatedMesh* ScoutCruiserMesh;
	scene::IAnimatedMeshSceneNode* SCNode;
	scene::ISceneNode* LightNode;
	float Yaw=0.0f, Pitch=0.0f, Roll=0.0f;


	MyDevice = createDevice(video::EDT_SOFTWARE2, core::dimension2d<s32>(1024, 768), 32, false, false, false, 0);
	MyDevice->setWindowCaption(L"Irrlicht Demo");
	MyVideoDriver = MyDevice->getVideoDriver();
	MySceneManager = MyDevice->getSceneManager();
	MyGUI = MyDevice->getGUIEnvironment();
	MyGUI->addStaticText(L"Hello World! This is the Irrlicht Software engine!", core::rect<int>(10, 10, 200, 22));
	ScoutCruiserMesh = MySceneManager->getMesh("SomePath\\Scout.obj");
	SCNode = MySceneManager->addAnimatedMeshSceneNode(ScoutCruiserMesh);

	MySceneManager->addCameraSceneNode(0, core::vector3df(0, 40, 40), core::vector3df(0, 0, 0));
	LightNode = MySceneManager->addLightSceneNode(0, core::vector3df(40, 40, 40), video::SColorf(1.0f, 1.0f, 0.7f, 0.7f), 40.0f);
	LightNode = MySceneManager->addLightSceneNode(0, core::vector3df(-40, 30, 20), video::SColorf(1.0f, 0.7f, 1.0f, 0.7f), 40.0f);

	while(MyDevice->run())
	{
		Roll += 1.0f;
		while (Roll > 180.0f)
			Roll -= 360.0f;

		SCNode->setRotation(core::vector3df(Yaw, Pitch, Roll));
		MyVideoDriver->beginScene(true, true, video::SColor(0, 0, 127, 0));
		MySceneManager->drawAll();
		MyGUI->drawAll();
		MyVideoDriver->endScene();
	}


	return(0);
}
If you'd like to see screenshots or the Maya model, I'd be glad to post them somewhere.

Does anybody have any idea why this is happening? Thanks for any input.

Posted: Wed Sep 13, 2006 2:52 pm
by Phxx
Please post some screenshots.
Maybe it's a problem with the normal direction