I am using an ATI card on Ubuntu Linux, with OpenGL as my renderer. I'm pretty new to the engine and I love its simplicity, but there's a bug that I simply cannot work with, and I want to know once and for all if there is/will be any correction for it. This bug has been filed on sourceforge, so the code maintainers will already be aware of it.
Essentially, any large, rounded structure I try to attach a shadow node to wont self-shadow correctly. I have tried with prims, checked my normals, done everything I could think of to make this stop, but it won't. When you turn to face such and object, every slight motion of the camera causes the shadows on the object to flicker wildly, seemingly randomly. It is extremely noticable and unattractive.
Wikipedia mentioned a shadow bug for ATI/OPENGL/Linux, so I assume thats what this is. Perusing the source code I noticed that ZFail is completely broken; perhaps I'm walking into the shadow, and ZPass is just going screwy for this card/OS. I tried uncommenting and recompiling, however, and it did almost the exact same thing, only the flickers were a bit higher up.
If ANYONE knows a way to circumvent this, or any knowledge about an upcoming fix, please let me know. Thank you.
Serious Shadow Flicker Problem
I tried resizing the near and far distance, but to no avail. Here's some code, in case i really am doing it wrong.
// Here's where I initialized:
device = createDevice( video::EDT_OPENGL,
core::dimension2d<s32>(800,600),
24, true,true,true);
smgr = device->getSceneManager();
device->setWindowCaption( L"Test 2" );
device->getCursorControl()->setVisible(false);
// Here's where I built the world:
// Selector: For collision detection
IMetaTriangleSelector* selector = smgr->createMetaTriangleSelector();
// Floor
IAnimatedMesh* mapmesh =
smgr->addHillPlaneMesh( "map", core::dimension2d<f32>( 40, 40 ),
core::dimension2d<u32>( 100, 100 ) );
IAnimatedMeshSceneNode* mapnode =
smgr->addAnimatedMeshSceneNode( mapmesh );
selector->addTriangleSelector(
smgr->createOctTreeTriangleSelector(
mapmesh->getMesh(0), mapnode ) );
mapnode->setMaterialTexture( 0, device->getVideoDriver()->
getTexture( "tiles.jpg" ) );
smgr->getMeshManipulator()->makePlanarTextureMapping(
mapmesh->getMesh(0), 0.01);
// A bunch of steps i made in blender. The openMesh function normalizes
// the normals since this was resized. It also automatically adds to the
// collision detection tree
IAnimatedMeshSceneNode* steps = openMesh( "steps.obj", selector,
"tiles.jpg" );
steps->setScale( core::vector3df( 10,5,10 ) );
// Player
IAnimatedMesh* model = smgr->getMesh("sydney.md2");
player = smgr->addAnimatedMeshSceneNode(model);
player->setMaterialTexture(0, device->getVideoDriver()->getTexture("sydney.bmp"));
player->setAnimationSpeed(15);
player->setPosition( core::vector3df( -70, 30, 0 ) );
player->addShadowVolumeSceneNode();
player->setMD2Animation( EMAT_STAND );
player->addAnimator( smgr->createCollisionResponseAnimator( selector, player,
core::vector3df(10, 25, 10 ) ) );
// My light
scene::ILightSceneNode* light1 =
smgr->addLightSceneNode( 0, core::vector3df( 100, 100, 0 ) );
// My Camera
camera = smgr->addCameraSceneNode();
// Main Loop contains a player controls, frame calculations, etc.
// This is the main loop though.
camera->setTarget( player->getPosition() );
if (device->isWindowActive())
{
device->getVideoDriver()->
beginScene(true, true,
video::SColor(255,100,101,140));
smgr->drawAll();
device->getVideoDriver()->endScene();
}
My shadows SHOULDNT be flickering, right? Oh and also, sometimes inside shadows, i see the unlit outline of the mesh from a top down view... whats that about?
// Here's where I initialized:
device = createDevice( video::EDT_OPENGL,
core::dimension2d<s32>(800,600),
24, true,true,true);
smgr = device->getSceneManager();
device->setWindowCaption( L"Test 2" );
device->getCursorControl()->setVisible(false);
// Here's where I built the world:
// Selector: For collision detection
IMetaTriangleSelector* selector = smgr->createMetaTriangleSelector();
// Floor
IAnimatedMesh* mapmesh =
smgr->addHillPlaneMesh( "map", core::dimension2d<f32>( 40, 40 ),
core::dimension2d<u32>( 100, 100 ) );
IAnimatedMeshSceneNode* mapnode =
smgr->addAnimatedMeshSceneNode( mapmesh );
selector->addTriangleSelector(
smgr->createOctTreeTriangleSelector(
mapmesh->getMesh(0), mapnode ) );
mapnode->setMaterialTexture( 0, device->getVideoDriver()->
getTexture( "tiles.jpg" ) );
smgr->getMeshManipulator()->makePlanarTextureMapping(
mapmesh->getMesh(0), 0.01);
// A bunch of steps i made in blender. The openMesh function normalizes
// the normals since this was resized. It also automatically adds to the
// collision detection tree
IAnimatedMeshSceneNode* steps = openMesh( "steps.obj", selector,
"tiles.jpg" );
steps->setScale( core::vector3df( 10,5,10 ) );
// Player
IAnimatedMesh* model = smgr->getMesh("sydney.md2");
player = smgr->addAnimatedMeshSceneNode(model);
player->setMaterialTexture(0, device->getVideoDriver()->getTexture("sydney.bmp"));
player->setAnimationSpeed(15);
player->setPosition( core::vector3df( -70, 30, 0 ) );
player->addShadowVolumeSceneNode();
player->setMD2Animation( EMAT_STAND );
player->addAnimator( smgr->createCollisionResponseAnimator( selector, player,
core::vector3df(10, 25, 10 ) ) );
// My light
scene::ILightSceneNode* light1 =
smgr->addLightSceneNode( 0, core::vector3df( 100, 100, 0 ) );
// My Camera
camera = smgr->addCameraSceneNode();
// Main Loop contains a player controls, frame calculations, etc.
// This is the main loop though.
camera->setTarget( player->getPosition() );
if (device->isWindowActive())
{
device->getVideoDriver()->
beginScene(true, true,
video::SColor(255,100,101,140));
smgr->drawAll();
device->getVideoDriver()->endScene();
}
My shadows SHOULDNT be flickering, right? Oh and also, sometimes inside shadows, i see the unlit outline of the mesh from a top down view... whats that about?