OctTreeSceneNode - hides shapes

You discovered a bug in the engine, and you are sure that it is not a problem of your code? Just post it in here. Please read the bug posting guidelines first.
Post Reply
Acki
Posts: 3496
Joined: Tue Jun 29, 2004 12:04 am
Location: Nobody's Place (Venlo NL)
Contact:

OctTreeSceneNode - hides shapes

Post by Acki »

Hi,
it seems there is a bug with the octtree scene node... :shock:
when I look at the scene node, then some shapes are disapearing, depending on the angle I'm looking at it:
Image
I used this mesh: map.zip (tried as .x, .3ds and .ms3d)
and this very simple code:

Code: Select all

#include <irrlicht.h>
using namespace irr;
using namespace core;
using namespace scene;
using namespace video;
using namespace io;
using namespace gui;

int main(){
	IrrlichtDevice *device = createDevice(EDT_DIRECT3D9, dimension2d<s32>(640, 480), 16, false, false, false, 0);
	IVideoDriver* driver = device->getVideoDriver();
	ISceneManager* smgr = device->getSceneManager();

	IAnimatedMesh* mesh = smgr->getMesh("map.x");
	ISceneNode* node = smgr->addOctTreeSceneNode(mesh->getMesh(0));
	node->setMaterialFlag(EMF_LIGHTING, false);
	node->setScale(vector3df(10,5,10));

  smgr->addCameraSceneNodeFPS();
  device->getCursorControl()->setVisible(false);
	while(device->run()){
		driver->beginScene(true, true, video::SColor(0,0,0,0));
		smgr->drawAll();
		driver->endScene();
	}
	device->drop();
	return 0;
}
while(!asleep) sheep++;
IrrExtensions:Image
http://abusoft.g0dsoft.com
try Stendhal a MORPG written in Java
Acki
Posts: 3496
Joined: Tue Jun 29, 2004 12:04 am
Location: Nobody's Place (Venlo NL)
Contact:

Post by Acki »

hmmm, it seems the problem is because I scaled the node...
maybe the problem goes when I recalculate the normals (I'll try this) ???

but if I use an animatedMeshSceneNode instead of the octTreeSceneNode the problem isn't there, regardless of the scale I use !?!?! :shock:

EDIT: I just tested to recalculate the normals...
and it seems to work when I create the mesh like this:

Code: Select all

IAnimatedMesh* mesh = smgr->getMesh("map.x");
smgr->getMeshManipulator()->scaleMesh(mesh, vector3df(10,5,10));
smgr->getMeshManipulator()->recalculateNormals(mesh);
ISceneNode* node = smgr->addOctTreeSceneNode(mesh->getMesh(0));
but I don't wand to scale the mesh, I want to scale the node !!! :?

EDIT2: this also happens to the q3 map from the sdk, depending on the scaling I use (scale = 10,5,10)...
while(!asleep) sheep++;
IrrExtensions:Image
http://abusoft.g0dsoft.com
try Stendhal a MORPG written in Java
rogerborg
Admin
Posts: 3590
Joined: Mon Oct 09, 2006 9:36 am
Location: Scotland - gonnae no slag aff mah Engleesh
Contact:

Post by rogerborg »

Thanks for the report. We already have a bug open for this.

I just sprained my brain trying to work through matrix4::transformPlane() / matrix4::transformPlane_new() to get a working solution, so if you feel like taking a look... ;)
Please upload candidate patches to the tracker.
Need help now? IRC to #irrlicht on irc.freenode.net
How To Ask Questions The Smart Way
Post Reply