The Problem is : Cube inside odther cube become invisible when the camera moving.
I set the material shader transparent.
I want to nest transparent cubes inside others. When the camera moving some cube disappear.
How solve this problem ?? z-buffer, backFaceCulling,ISceneNode::setAutomaticCulling() with EAC_OFF ??
Code: Select all
case video::EDT_DIRECT3D9:
if (UseHighLevelShaders)
{
psFileName = "media/d3d9.hlsl";
vsFileName = psFileName; // both shaders are in the same file
}
newMaterialType1 = gpu->addHighLevelShaderMaterialFromFiles(
vsFileName, "vertexMain", video::EVST_VS_1_1,
psFileName, "pixelMain", video::EPST_PS_1_1,
mc, video::EMT_SOLID);
newMaterialType2 = gpu->addHighLevelShaderMaterialFromFiles(
vsFileName, "vertexMain", video::EVST_VS_1_1,
psFileName, "pixelMain", video::EPST_PS_1_1,
mc, video::EMT_TRANSPARENT_ADD_COLOR);
// EXTERNAL
scene::ISceneNode* node1;
node1 = smgr->addCubeSceneNode(50);
node1->setPosition(core::vector3df(0,-10,50));
node1->setMaterialTexture(0, driver->getTexture("media/wall.bmp"));
node1->setMaterialFlag(video::EMF_LIGHTING, false);
node1->setMaterialType((video::E_MATERIAL_TYPE)newMaterialType2);
smgr->addTextSceneNode(gui->getBuiltInFont(),
L"PS & VS & EMT_TRANSPARENT",
video::SColor(255,255,255,255), node1);
////////////// DISAPPEAR !!!!!! ////////////////////////
// INTERNAL 1
scene::ISceneNode* node2;
node2 = smgr->addCubeSceneNode(15);
node2->setPosition(core::vector3df(10,-10,50));
node2->setMaterialTexture(0, driver->getTexture("media/wall.bmp"));
node2->setMaterialFlag(video::EMF_LIGHTING, false);
node2->setMaterialType((video::E_MATERIAL_TYPE)newMaterialType2);
smgr->addTextSceneNode(gui->getBuiltInFont(),
L"PS & VS & EMT_TRANSPARENT",
video::SColor(255,255,255,255), node2);
////////////// DISAPPEAR !!!!!! ////////////////////////
// INTERNAL 2
scene::ISceneNode* node3;
node3 = smgr->addCubeSceneNode(15);
node3->setPosition(core::vector3df(-10,-10,50));
node3->setMaterialTexture(0, driver->getTexture("media/wall.bmp"));
node3->setMaterialFlag(video::EMF_LIGHTING, false);
node3->setMaterialType((video::E_MATERIAL_TYPE)newMaterialType2);
smgr->addTextSceneNode(gui->getBuiltInFont(),
L"PS & VS & EMT_TRANSPARENT",
video::SColor(255,255,255,255), node3);