Scene sometimes black

You are an experienced programmer and have a problem with the engine, shaders, or advanced effects? Here you'll get answers.
No questions about C++ programming or topics which are answered in the tutorials!
Post Reply
Christi258
Posts: 62
Joined: Wed Feb 06, 2013 12:11 pm

Scene sometimes black

Post by Christi258 »

Hi everyone,
I have a problem with a new map, I imported in my game. In some Positions(Rotation) of the camera(FPS) the scene is hole black and if i turn a little right or left everything is normal again.
The map is modelled by blender.
Format: DirectX (.x)
Here you can see how I load the map:

Code: Select all

 
IMeshSceneNode *node = smgr->addMeshSceneNode(smgr->getMesh("map.x"),0,0,vector3df(0,0,0),vector3df(-90,0,180),vector3df(1000,1000,1000));
node->setMaterialTexture(0,driver->getTexture(L"mtexture.png"));
node->setMaterialFlag(EMF_BACK_FACE_CULLING,0);
node->setMaterialFlag(EMF_LIGHTING,0);
 
CuteAlien
Admin
Posts: 9734
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: Scene sometimes black

Post by CuteAlien »

Strange, that sounds like your scene is clipped suddenly. For a test you can try to set node->setAutomaticCulling(irr::scene::EAC_OFF);
Although if that works it would be interesting why culling is working wrong in your scene (maybe old Irrlicht version? I remember there had been some problem in the past).
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
Christi258
Posts: 62
Joined: Wed Feb 06, 2013 12:11 pm

Re: Scene sometimes black

Post by Christi258 »

Thank you that helped,
but I'm using Irrlicht 1.8 sounds like a bug.
CuteAlien
Admin
Posts: 9734
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: Scene sometimes black

Post by CuteAlien »

Maybe enable debug boundingbox display and check how it looks like for your scene-model:
node->setDebugDataVisible(irr::scene::EDS_BBOX);
That one is used for culling to my knowledge. Did you change the model in some way after loading aside from the code posted above?
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
Christi258
Posts: 62
Joined: Wed Feb 06, 2013 12:11 pm

Re: Scene sometimes black

Post by Christi258 »

The Bounding box is also not shown.
But, mainly it runs now without Automatic Culling.
CuteAlien
Admin
Posts: 9734
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: Scene sometimes black

Post by CuteAlien »

Boundingbox not shown might be a hint actually (messed up boundingbox). I wonder if it has to do something with the scaling by factor 1000 (shouldn't, but have to test that and it would explain it).

edit: Tested (3 years later) with other models... couldn't find a bug.
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
Mel
Competition winner
Posts: 2292
Joined: Wed May 07, 2008 11:40 am
Location: Granada, Spain

Re: Scene sometimes black

Post by Mel »

That is a scale issue with no doubt, try using the mesh manipulator to scale your mesh so the scale is always 1,1,1
"There is nothing truly useless, it always serves as a bad example". Arthur A. Schmitt
zprg
Competition winner
Posts: 30
Joined: Tue Jul 31, 2012 12:29 pm
Location: Germany

Re: Scene sometimes black

Post by zprg »

or try

Code: Select all

node->recalculateBoundingBox();
?
Post Reply