errorfun
19-03-2009 07:57:56
Hi all.
I have some problem with the Hydrax depth technique.
1) I attach a mesh to the SceneNode. Then I use the code like this
to add a depth technique.But it dosn't work!The part under the water is still can see when my camera is above.
I had change the material before,but it's the same.
Is that any requirements with the transparent texture?Can anyone give me a sample texture?
2) Using plsm2 + Hydrax.I've read this topic http://www.ogre3d.org/addonforums/viewtopic.php?f=20&t=9174. And I add the code to my program as Xavyiy said.
And nothing happened.At last, I found that the mat is allways NULL.
This is my terrain config file
Sorry for my pool english.
Thanks.
Stex
I have some problem with the Hydrax depth technique.
1) I attach a mesh to the SceneNode. Then I use the code like this
MaterialPtr mat = static_cast<Ogre::MaterialPtr>(Ogre::MaterialManager::getSingleton().getByName("CONO"));
mHydrax->getMaterialManager()->addDepthTextureTechnique(mat->createTechnique(), "TransparentTexture.png", "a");
to add a depth technique.But it dosn't work!The part under the water is still can see when my camera is above.
I had change the material before,but it's the same.
material CONO
{
technique
{
pass
{
ambient 0 0 0 1
specular 0.269412 0.269412 0.269412 1 40
alpha_rejection greater 128
texture_unit
{
texture_alias Map_flag
texture flag.JPG
}
}
}
technique
{
lighting off
scene_blend alpha_blend
scheme_name HydraxDepth
texture_unit{
texture TransparentTexture.png
}
}
}
Is that any requirements with the transparent texture?Can anyone give me a sample texture?
2) Using plsm2 + Hydrax.I've read this topic http://www.ogre3d.org/addonforums/viewtopic.php?f=20&t=9174. And I add the code to my program as Xavyiy said.
int w, h;
mEscena->mSceneManager->getOption("Width", &w);
mEscena->mSceneManager->getOption("Height", &h);
Ogre::String Mapa;
Ogre::String Formato;
mEscena->mSceneManager->getOption("CurrentMap", &Mapa);
mEscena->mSceneManager->getOption("CurrentTextureFormat", &Formato);
for (int i = 0; i < w; i++)
{
for (int j = 0; j < h; j++)
{
Ogre::String NombreMaterial = Formato + "." + Ogre::StringConverter::toString(i) + "." + Ogre::StringConverter::toString(j) + "." + Mapa;
mat = Ogre::MaterialManager::getSingleton().getByName(NombreMaterial);
if (!mat.isNull())
{
try
{
// Add depth technique
mHydrax->getMaterialManager()->addDepthTechnique(mat->createTechnique());
}
catch (...)
{
}
}
}
}
And nothing happened.At last, I found that the mat is allways NULL.
This is my terrain config file
GroupName=PLSM2
LandScapeFileName=plsm_test
FileSystem=LandScapeFileName
Width=2
Height=2
ScaleX=9000
ScaleY=3000
ScaleZ=9000
Deformable=yes
VertexCompression=yes
VertexProgramMorph=yes
MaxPixelError=8
TextureStretchFactor=1
NumTextureFormatSupported=1
TextureFormatSupported0=ImagePaging
TextureFormat=ImagePaging
ImageFilename=plsm_test
NumMatHeightSplat=4
MaterialHeight1=5
MaterialHeight2=95
SplatFilename0=splatting_sand.png
SplatFilename1=splatting_grass.png
SplatFilename2=splatting_rock.png
SplatFilename3=splatting_snow.png
VisibleRenderables=75
MaxAdjacentPages=1
MaxPreloadedPages=2
MaxNumRenderables=256
MaxNumTiles=256
NumRenderablesLoading=10
PageLoadInterval=5
RenderableLoadInterval=3
IncrementRenderables=256
IncrementTiles=256
HorizonVisibilityComputing=yes
# where to put camera on load.
BaseCameraViewpoint.x=-4702.0f
BaseCameraViewpoint.y=50245.0f
BaseCameraViewpoint.z=-19140.0f
Baselookat.x=0.0f
Baselookat.y=0.0f
Baselookat.z=0.0f
Sorry for my pool english.
Thanks.
Stex