[Tuto] How to get Hydrax working with Ogre 1.7 and up

Max98

07-02-2015 23:04:20

Hello there, so after I've been debugging, reading and doing whatever is possible to get Hydrax working, I wanted to make a thread about the solutions so you people won't have to redo the same thing and AFAIK, most of you abandoned.

1 - Water is looking wired and flickering, sometimes is invisible until you move the camera.. etc
From my experiments, I believe that this is caused by the setFarClipDistance of the used camera.
We all know that setFarClipDistance(0) make the camera render to the infinite. The problem here is that Hydrax, for some reasons, doesn't like it.
Solution: use setFarClipDistance(9999) instead. (9999 can be changed with a higher or lower number if needed)

2 - Depth technique is not working with Ogre::Terrain
This is where my head went like boom.
Things changed when the old terrain system was deprecated.
Solution:
Use the code snippet to add the depth technique to the terrain:
//Apply depth technique to the terrain
TerrainGroup::TerrainIterator ti = geometry_manager->getTerrainGroup()->getTerrainIterator();
while (ti.hasMoreElements())
{
Terrain* t = ti.getNext()->instance;
MaterialPtr ptr = t->getMaterial();
hw->GetHydrax()->getMaterialManager()->addDepthTechnique(ptr->createTechnique());
}

And then, do not forget to set UseVertexCompressionWhenAvailable to false.
terrainOptions->setUseVertexCompressionWhenAvailable(false);

3 - Everthung underwater is invisible
Very easy to fix, you have to change few values.
Solution: Go to your hdx config file and tweak those values:

#Depth parameters
<float>DepthLimit=70
<float>DistLimit=90


I might have forgot few other things, so please, tell me in this thread and I will update this post.

Annd for the end, here's a nice Screenshot of the game i'm working on (Rigs of rods):