I'm using .x models, with OpenGL. When I add a lightnode to the scene, I get a strange problem. The lighting seems to shade each polygon, instead of shading the entire model. Ive tested many methods of lighting using irrlicht, but haven't seemed to find a good one that solves the problem.
Heres a screenshot of what I mean.
Heres my code:
Code: Select all
// Circle_House
scene::IAnimatedMesh* orval_circlehouse = smgr->getMesh("models/Orval_CircleHouse.x");
scene::ISceneNode* orval_circlehouseNode = 0;
if (orval_circlehouse)
orval_circlehouseNode = smgr->addOctTreeSceneNode(orval_circlehouse->getMesh(0));
orval_circlehouseNode->setRotation(core::vector3df(0,0,0));
orval_circlehouseNode->setScale(core::vector3df(1,1,1));
orval_circlehouseNode->setPosition(core::vector3df(5000,0,5000));
orval_circlehouseNode->setMaterialFlag(video::EMF_LIGHTING, true);
// Add Lighting
scene::ILightSceneNode* light;
light = smgr->addLightSceneNode(smgr->getRootSceneNode()
,core::vector3df(5000,1000,6000),video::SColor(255,255,255,255), 1000.0f);
scene::ICameraSceneNode* camera =
smgr->addCameraSceneNodeFPS(0,100.0f,300.0f);
camera->setPosition(core::vector3df(5000,2000,6000));
camera->setFarValue(1000);