Tracking Camera and Wrong Reflection


10-12-2008 12:53:53

Hi, I have a couple of problems with Hydrax and I'll try to explain them. My english is not the best but I hope you understand

1) My main camera node is attached to another node like this
mCameraNode->setAutoTracking(true, mTargetNode);
I'm sure that I'm updating hydrax AFTER all the inputs and possible changes (by physics for example), but still the water doesn't follow the camera when i'm turning it, see that screenshot as an example.

The only thing that I'm doing in the main loop after the hydrax update is this:

2) This is best explained by the screenshot:

3) I've noticed another problem. If i go a lot high (let's say Y = 2000.0), I can se a circle in the horizon in the middle of the water. I can see this circle also at Y = 100.0, but it's almost not noticeable (you can see it in the previous screenshot). Screenshot:

I can't attach files, so I'll paste the hydrax cfg
#Hydrax cfg file.

#Hydrax version field

#Main options field
#Shader mode: 0=HLSL, 1=CG, 2=GLSL

#Components field

#Sun parameters

#Foam parameters

#Depth parameters

#Smooth transitions parameters

#Caustics parameters

#God rays parameters

#Rtt quality field(0x0 = Auto)

#Module options


#Noise options



11-12-2008 13:05:21


I've tried to set the Y of the water to 0, so now it's

Problems 2 and 3 are disappeared and everything works flawlessy. No more circle at horizon, and reflections are ok

There's any way to fix this? I have a couple of cases where I would like to set it to something more than 0, but for now I'm ok

Other infos I've not wrote in the post before:
Using Ogre 1.6.0 final with Hydrax 0.4

--- EDIT - Update2
I applied the fix in that thread: ... c&start=15
and problem 2 disappeared also with water Y = 100

Problems 1 and 3 are still there though


11-12-2008 17:21:58

Sorry for not reply quickly, i've to check some things on Hydrax code and post my opinion about the first and third problem.



11-12-2008 19:11:55

For the first problem, i had the same problem before cause i was updating hydrax in the frameEnded event, instead of frameStarted.
The second problem is explained in another post, it's due to the order the render group are agenced.


11-12-2008 19:24:58

For the first problem, i had the same problem before cause i was updating hydrax in the frameEnded event, instead of frameStarted.
I'm not using exampleapplication or frame listeners but my own loop, and I'm updating Hydrax before rendering so I think it's like frameStarted

That's my code, maybe I'm doing something wrong (Not the actual code, but just to let you understand)

//Update all other modules, like input, physx, particles, etc ...
//Update Hydrax ...


delta = timer.getMilliseconds() / 1000.0f;


29-12-2008 09:47:19

Any update on this? I still have the same problems


01-01-2009 23:46:07

I'm actually seeing all of the same issues and have the same setup where I'm running my own loop.

My terrain is a modified version of the ETM, and I'm running Caelum (HEAD from sometime in October/November timeframe). I've followed all the directions here on this forum for Caelum integration, but there's still artifacts. I'm positive my camera is updated prior to Hydrax.

I've also noticed that if I change the water height via the Hydrax::setPosition() function, then more often than not the water plane rendering stops working correctly when I move the camera (also don't like that I have to move the camera to see any of my runtime settings changes). Typically it only renders as long as the camera is facing the direction it was in when I changed the height.

For #1, it isn't that the water isn't following, but that something is wrong with the depth map and it's getting clipped out. I *think* it's a Caelum issue, though, when you are using a small near clip plane and a large far clip plane value. If you load up your system with Caelum only, no stencil shadows to prevent infinite far clip, and a 1.0 near clip, 99999.0 far clip (as suggested here in the Hydrax forum - I strongly disagree with this as a "fix"), then rotate the camera around to view the skydome, and you'll see flashes. I'm not entirely sure why other than that I've seen this with Caelum before where the near/far clip plane values are extremely different in size. I actually never noticed this until I turned off stencil shadows, which I use by default for most testing since I haven't implemented the texture shadows.

Anyway, I had to turn off stencil shadows because of Hydrax. It would be nice if this wasn't a Hydrax requirement.

For #2, my terrain is a modification of ETM, and since it's not an Ogre::Entity like the Ogre TerrainManager I added the depth technique - but this didn't fix the problem either. I've tried several tweaks to the materials, but no luck yet. I'm not entirely sure why it's happening.

For #3, as mentioned, any Hydrax setPosition() changes seem to screw up the system unless it's done immediately at load time - problem is I can and want to modify such properties at runtime. But even then, after seeing this thread I set the Position.Y to 100.0 and saw the same "ring" as shown in the screenshot.

I also see issues with the Caelum sun and moon when they are setting/rising around the horizon and my camera view is high up in the sky. I think it's related to Caelum's CameraBoundElements and Hydrax's water height not being coordinated, so that may be something that needs to be handled on the engine side.

Anyway, just wanted to let the OP know he/she is not alone. I have the same problems and more.


02-01-2009 12:52:13

Regarding your issues with how the hydrax projected grid is always lagging one frame behind, this is caused by the way Ogre tries to cache node positions and only update them when necessary. Unfortunately it can in some cases result in the derived orientation or position of a node to be incorrect.
Whenever the whole node tree is traversed the correct positions and orientations will be calculated, but unfortunately that traversal happens after the frameStarted events, and thus you get this effect.

I'm guessing that you're moving or reorienting a Node instead of the actual camera. (That's at least how my error was caused.)
The solution as I've found it is to manually call

theNode->_update(true, false);

after you've moved your node. This will force a recalculation of all derived positions and orientations.
Note that I first tried with calling Node::needUpdate(...) on the affected nodes, but that didn't help.


02-01-2009 20:44:17

Thanks for the answers.

@Azatoth: that indeed was the problem. I've added that line of code after all the node modifications and it worked, so it wasn't hydrax fault :)
@khawkins: have you tried what I've mentioned in one of my previous posts? It fixed problem #2 for me
And yes, I have the same problems when I move water, and the annoying circle is still there

Thanks again