Water depth problem?

Iceman1540

16-07-2009 13:51:15

Hello, I am using Hydrax .05 and Caelum 0.4.0.
I have a ship in the water and an aircraft with a camera attached to it.
The camera is controlled my a joystick, and sometimes when I pitch the camera up and down
the ships hull is shown. How can I make it so you never see any part of the ship that's under water?

Here is a video showing this.

http://www.youtube.com/watch?v=kR8VzMsXU28

and my Hydrax settings

#Hydrax cfg file.

#Hydrax version field
HydraxVersion=0.5.0

#Main options field
<vector3>Position=0x0x0
<float>PlanesError=10.5
#Shader mode: 0=HLSL, 1=CG, 2=GLSL
<int>ShaderMode=0
<float>FullReflectionDistance=1e+011
<float>GlobalTransparency=0
<float>NormalDistortion=0.075
<vector3>WaterColor=0.139765x0.359464x0.425373

#Components field
Components=Depth

#Depth parameters
<float>DepthLimit=1

#Rtt quality field(0x0 = Auto)
<size>Rtt_Quality_Reflection=0x0
<size>Rtt_Quality_Refraction=0x0
<size>Rtt_Quality_Depth=0x0
<size>Rtt_Quality_URDepth=0x0
<size>Rtt_Quality_GPUNormalMap=0x0

#Module options
Module=ProjectedGridVertex

<float>PG_ChoopyStrength=3.75
<bool>PG_ChoppyWaves=false
<int>PG_Complexity=264
<float>PG_Elevation=9.5
<bool>PG_ForceRecalculateGeometry=false
<bool>PG_Smooth=false
<float>PG_Strength=8.75

#Noise options
Noise=Perlin

<int>Perlin_Octaves=8
<float>Perlin_Scale=0.05
<float>Perlin_Falloff=0.79
<float>Perlin_Animspeed=2
<float>Perlin_Timemulti=1.27
<float>Perlin_GPU_Strength=1
<vector3>Perlin_GPU_LODParameters=0x50x150000

Thanks in advance

lansglenn

19-07-2009 11:50:49

I'm thinking your "Base plane" definition is set to some value not at 0. Try to modify your code chunk to something similar to this:

// Create our projected grid module
Hydrax::Module::ProjectedGrid* mModule
= new Hydrax::Module::ProjectedGrid(// Hydrax parent pointer
mHydrax,
// Noise module
new Hydrax::Noise::Perlin(),
// Base plane *SET 2nd ARGUMENT TO BE A ZERO 3D VECTOR*
Ogre::Plane(Ogre::Vector3(0,1,0), Ogre::Vector3(0,0,0)),
// Normal mode
Hydrax::MaterialManager::NM_VERTEX,
// Projected grid options
Hydrax::Module::ProjectedGrid::Options(/*264 /*Generic one*/));


In that Base plane definition, it tells Hydrax to face the water upwards, and the water level starts at 0 elevation in the global space. (I think)
For some reason to my experience, if the Y component of that 3DVector isn't 0, it'll clip your scene/images directly proportional to how big the Y value is. At least for me it does.

Try changing that 2nd argument to be something like Ogre::Vector3(0, 300, 0)) for some crazy weird water clipping on your camera.

Iceman1540

19-07-2009 17:39:57

I think I have that ok.

// Create our projected grid module
mModule = new Hydrax::Module::ProjectedGrid(// Hydrax parent pointer
mHydrax,
// Noise module
new Hydrax::Noise::Perlin(/*Generic one*/),
// Base plane
Ogre::Plane(Ogre::Vector3(0,1,0), Ogre::Vector3(0,0,0)),
// Normal mode
Hydrax::MaterialManager::NM_VERTEX,
// Projected grid options
Hydrax::Module::ProjectedGrid::Options(264));