Terrains and caustics/weird coloring effect

Discussion area about developing or extending OGRE, adding plugins for it or building applications on it. No newbie questions please, use the Help forum for that.
Post Reply
ofcaveman
Gnoblar
Posts: 10
Joined: Sat Mar 10, 2012 2:30 pm

Terrains and caustics/weird coloring effect

Post by ofcaveman »

Ok, I have hydrax demo working, added a terrain using the tutorial 3, and this post http://www.o-openuniverse.org/story/add ... in-ogre-17. I modified the terrain so it is sand colored, and changed the scaling a bit so it wasn't so mountainous. I was wondering how these work, BTW:
defaultimp.layerList.resize(3);
defaultimp.layerList[0].worldSize = 100;
defaultimp.layerList[0].textureNames.push_back("sand_1_diffusespecular.dds");
defaultimp.layerList[0].textureNames.push_back("sand_1_normalheight.dds");
defaultimp.layerList[1].worldSize = 30;
defaultimp.layerList[1].textureNames.push_back("grass_green-01_diffusespecular.dds");
defaultimp.layerList[1].textureNames.push_back("grass_green-01_normalheight.dds");
defaultimp.layerList[2].worldSize = 200;
defaultimp.layerList[2].textureNames.push_back("growth_weirdfungus-03_diffusespecular.dds");
defaultimp.layerList[2].textureNames.push_back("growth_weirdfungus-03_normalheight.dds");

Does this make the mountains different textures depending upon what the altitude is? I am guessing this case, there is grass on the lowest level, then sand, then weird fungus?

I then lowered the terrain into the water using:
Ogre::Vector3 lcTerrainVector(0.0, -800.0, 0.0);
mTerrainGroup->setOrigin(lcTerrainVector);

Now, before I even changed to the sand texture, that caustics were not being applied to any of the terrain - only to the underwater sand of the island.

I tried to fix the caustic by using something from another post:
TerrainGroup::TerrainIterator ti = mTerrainGroup->getTerrainIterator();
while(ti.hasMoreElements())
{
Terrain* t = ti.getNext()->instance;
MaterialPtr ptr = t->getMaterial();
mHydrax->getMaterialManager()->addDepthTechnique(ptr->createTechnique());
}

I also noticed that once the terrain was lowered into the water, the terrain turned white, and at the edge of the island, there is a white strip of border (perhaps the terrain?), and when I try to move the camera past it, the strip seems to widen.

Any ideas on what I am seeing, or how to fix it? I am very new at this, so just trying to understand it all...

Thanks,

-Kevin
ofcaveman
Gnoblar
Posts: 10
Joined: Sat Mar 10, 2012 2:30 pm

Re: Terrains and caustics/weird coloring effect

Post by ofcaveman »

I figured this out. I had the ordering of my functions incorrect. I moved the terrain stuff to be much later (just prior to the palms code). The following snippet I moved to the very end:

Code: Select all

TerrainGroup::TerrainIterator ti = mTerrainGroup->getTerrainIterator();
while(ti.hasMoreElements())
{
Terrain* t = ti.getNext()->instance;
MaterialPtr ptr = t->getMaterial();
mHydrax->getMaterialManager()->addDepthTechnique(ptr->createTechnique());
}
Post Reply