octree and shadows

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
acropole
Posts: 17
Joined: Tue Feb 08, 2005 2:59 am
Contact:

octree and shadows

Post by acropole »

Hi,

Int the specialFX tutorial there is this :

Code: Select all

IAnimatedMeshSceneNode* anode = 0;
anode->addShadowVolumeSceneNode();	
smgr->setShadowColor(video::SColor(220,0,0,0));
but I'm using Octtree with this tutorial by ChristianClavet.
The collision function use ISceneNode instead of IAnimatedMeshSceneNode.
So it's not possible to add shadows to the octtrees.

How can I do ?

thanks
Jgoldnight
Posts: 31
Joined: Thu Jun 07, 2007 6:23 pm
Location: New York
Contact:

Post by Jgoldnight »

If you take a look at the Irrlicht documentation, IAnimatedMeshSceneNode inherits from ISceneNode; thus, I don't think there is an error in the Irrlicht Design in regards to shadows. However, I'm not sure until you post some code detailing how you're using Christian's code.
Computer scientist by day...
http://www.mrjoelkemp.com
acropole
Posts: 17
Joined: Tue Feb 08, 2005 2:59 am
Contact:

Post by acropole »

this is the code

Code: Select all

void amhEventReceiver::generateCollision(ISceneNode* n, IMetaTriangleSelector* meta ) 
{ 
	if (n->getType() ==   ESNT_OCT_TREE){
		IAttributes* attribs = device->getFileSystem()->createEmptyAttributes(); 
		if (attribs) {// get the mesh name out 
			n->serializeAttributes(attribs); 
			stringc name = attribs->getAttributeAsString("Mesh"); 
			attribs->drop(); 
			// get the animated mesh for the object 
			IAnimatedMesh* mesh = smgr->getMesh(name.c_str()); 

			if (mesh){ 
				ITriangleSelector* selector = smgr->createOctTreeTriangleSelector(mesh->getMesh(0), n, 128); 
				n->setTriangleSelector(selector); 
				metaSelector->addTriangleSelector(selector); 
				selector->drop();

//				IAnimatedMeshSceneNode*iamsn = smgr->getSceneNodeFromId( n->getID());
				n->addShadowVolumeSceneNode();	
			} 
		} 
	}  
  // now recurse on children... 
  list<ISceneNode*>::ConstIterator begin = n->getChildren().begin(); 
  list<ISceneNode*>::ConstIterator end   = n->getChildren().end(); 

  for (; begin != end; ++begin) 
    generateCollision(*begin, meta); 
}
and this is the error :

f:\abyss\abyss\abyss\amheventreceiver.cpp(180) : error C2039: 'addShadowVolumeSceneNode' : is not membre of 'irr::scene::ISceneNode'
kornwaretm
Competition winner
Posts: 189
Joined: Tue Oct 16, 2007 3:53 am
Location: Indonesia
Contact:

Post by kornwaretm »

ESNT_OCT_TREE or octTreeSceneNode is design for level usually a huge mesh. so i think its design not to have any shadow, we get shadows from lightmaping only. dynamic only for animated mesh because it's moving and off course the shadow change while it animates. no design error i think.

P/S:
for collision in game industry they using 2 mesh collision mesh and the one that rendered. since level mesh usually very complex with large amount of vertex. it's better to make second mesh with less vertices, get the triangle selector, apply to animators and hide it.
acropole
Posts: 17
Joined: Tue Feb 08, 2005 2:59 am
Contact:

Post by acropole »

If lights move map's shadows moves too. Since HL² and Doom 3 there is dynamic shadows on BSP.

Code: Select all

for collision in game industry they using 2 mesh collision mesh and the one that rendered. since level mesh usually very complex with large amount of vertex. it's better to make second mesh with less vertices, get the triangle selector, apply to animators and hide it.
I know. But my meshes are large with large polys and collide with small objects. So it require exact match between rendered and coliided shapes.

And it's not possible to add lightmap on octrees in irrEdit.

It seems that the solutions are to add two times the mesh (one for collision, one for rendering...) or to change irrlicht code.


Try this and you'll see what I mean

Keys : ZQSD (or WASD on english keybord) to move, SPACE BARR and CONTROL to move up and down, A and E (or Q and E on english keybord) to roll and mouse movement to pitch and yaw.
acropole
Posts: 17
Joined: Tue Feb 08, 2005 2:59 am
Contact:

Post by acropole »

so anyone know how to fix this design issue ?
Post Reply