Hi, I have a very newbie question XD
I have created a customSceneNode that draws a plane.
Then, I use the scenemanager to add a cube an place it over the plane.
But, the plane is always drawn over the cube, no matter which angle the camera is, and both are only seen when you look at the scene from the profile (the plane doesn't touch the cube).
Any suggestions? code are pretty similar to the customscenenode tutorial.
I'm stuck.
Thanks!
[solved] Strange zbuffer problem
[solved] Strange zbuffer problem
Last edited by ferdy182 on Sun Sep 02, 2007 9:21 am, edited 2 times in total.
-
- Admin
- Posts: 14143
- Joined: Wed Apr 19, 2006 9:20 pm
- Location: Oldenburg(Oldb), Germany
- Contact:
You seem to have set up your scene node's material in a wrong way. Be sure to have zbuffer enabled (also writing). For a plane it could be useful to have backface culling of to see the other side of the plane, too.
Did you add the plane to the scene manager or do you render it manually?
BTW: Irrlicht has a hill plane node which you can instantiate without hills and with arbitrary tesselation.
Did you add the plane to the scene manager or do you render it manually?
BTW: Irrlicht has a hill plane node which you can instantiate without hills and with arbitrary tesselation.
Hi,
It still doesn't work, I have uploaded a video demonstration to youtube here because I explain very badly XD http://youtube.com/watch?v=B9KfU__tAoM
Cube is still always behind the plane T_T
Zbuffer is enabled and writable. I post the code here, even with hillplanemesh, it doesn't work at all and I need to finish this ASAP T_T
Thank you for the interest
Code:
It still doesn't work, I have uploaded a video demonstration to youtube here because I explain very badly XD http://youtube.com/watch?v=B9KfU__tAoM
Cube is still always behind the plane T_T
Zbuffer is enabled and writable. I post the code here, even with hillplanemesh, it doesn't work at all and I need to finish this ASAP T_T
Thank you for the interest
Code:
Code: Select all
int main(void){
device = createDevice(video::EDT_DIRECT3D9,dimension2d<s32>(800,600),16,false,false,false,0);
device->setWindowCaption(L"Escena 3D");
driver = device->getVideoDriver();
smgr = device->getSceneManager();
guienv = device->getGUIEnvironment();
guienv->addStaticText(L"Bienvenido a UjiToys Basket!!", rect<int>(10,10,200,22), false);
ICameraSceneNode *irrcamera = smgr->addCameraSceneNodeMaya();
irrcamera->setPosition(vector3df(160,172,323));
irrcamera->setTarget(vector3df(160,0,50));
irrcamera->setAutomaticCulling(scene::E_CULLING_TYPE::EAC_OFF);
irrcamera->setFarValue(1000.0);
irrcamera->setNearValue(0.0);
IAnimatedMeshSceneNode *cancha = smgr->addAnimatedMeshSceneNode(smgr->addHillPlaneMesh("cancha",dimension2d<f32>(240,320),dimension2d<s32>(1,1)),0,-1,vector3df(160,-1,120),vector3df(0,-90,0));
cancha->setAutomaticCulling(scene::E_CULLING_TYPE::EAC_OFF);
cancha->setMaterialFlag(video::E_MATERIAL_FLAG::EMF_LIGHTING,false);
cancha->setMaterialFlag(video::E_MATERIAL_FLAG::EMF_BACK_FACE_CULLING,false);
cancha->setMaterialFlag(video::E_MATERIAL_FLAG::EMF_ZBUFFER,true);
cancha->setMaterialFlag(video::E_MATERIAL_FLAG::EMF_ANISOTROPIC_FILTER,true);
cancha->setMaterialFlag(video::E_MATERIAL_FLAG::EMF_TRILINEAR_FILTER,true);
ITexture *tex = driver->getTexture("court.png");
cancha->setMaterialTexture(0,tex);
ISceneNode *spheres[4];
spheres[0]=smgr->addSphereSceneNode();
spheres[1]=smgr->addSphereSceneNode(5,16,0,-1,vector3df(320,0,0));
spheres[2]=smgr->addSphereSceneNode(5,16,0,-1,vector3df(320,0,240));
spheres[3]=smgr->addSphereSceneNode(5,16,0,-1,vector3df(0,0,240));
for(int i=0;i<4;i++)
spheres[i]->setAutomaticCulling(EAC_OFF);
ISceneNode * cubo = smgr->addCubeSceneNode(10,0,-1,vector3df(160,10,50));
cubo->setAutomaticCulling(EAC_OFF);
while(1){
if(device->run()){
driver->beginScene(true,true,SColor(255,255,100,101));
smgr->drawAll();
guienv->drawAll();
driver->endScene();
}
}
device->drop();
}
Another anoying video
http://es.youtube.com/watch?v=OuB29lslaiA
http://es.youtube.com/watch?v=OuB29lslaiA