[solved] Projected grid not projected / updating


30-12-2010 18:17:26

Hi all,

thank you Xavyiy for Hydrax and Skyx, both work very good and where integrated easily!

However, the ProjectedGrid of Hydrax is not updating for my setup. When I fly around the projection is not updated and I can view a trapeze lying around, with a beautiful water simulation.

I'm using official Ogre 1.7.1 and have compiled Hydrax as written in this post (thanks Illidanz). In addition, I never move the camera anywhere else then (0,0,0), as I move everything else during frame setup. For positioning Hydrax, I call m_pHydrax->setPosition(..) and ->update(..) which work good for SimpleGrid and seem to be correct for ProjectedGrid, also, as I can dive into the water.

I've tried with ProjectedGrid::Options::ForceRecalculateGeometry, which I set before updating. But this leads to a crash somewhere deep within the Dx9 Rendersystem after several updates (like from 3 to 8 calls).

Except for an unknown texture ressource "HydraxDepthReflectionMap" the log is without error.


31-12-2010 13:57:40

Just an update on something which is maybe involved:

I set a custom view matrix to the camera using Ogre::Camera::setCustomViewMatrix(true, view).

Beneath that, I still don't have a clue. For the updating of the grid I tried with no luck changing ProjectedGrid.cpp, ProjectedGrid::update(..):

Ogre::Vector3 RenderingCameraPos = mRenderingCamera->getDerivedPosition();

if (mLastPosition != RenderingCameraPos || // this is never true in my setup
mLastOrientation != mRenderingCamera->getDerivedOrientation() || // this should be true, when I rotate
mOptions.ForceRecalculateGeometry) // see comment in first post

// --> Changed to always update this part
if (true || mLastPosition != RenderingCameraPos)
Ogre::Vector3 HydraxPos = Ogre::Vector3(RenderingCameraPos.x,mHydrax->getPosition().y,RenderingCameraPos.z);



01-01-2011 17:54:04

It is definetly the usage of Camera::setCustomViewMatrix. When I set the orientation of the camera the projection is much better, however then my camera system is messed up, as I set it wrong.

It's a bit offtopic to hydrax, but:
When I have a left handed coordinate system using rotation matrices, how do I get a right handed orientation quaternion?

If I don't get the camera right, I'll try to "fix" the ProjectedGrid::_getMinMax for my use case. Trying to only use the view matrix and not orientation, but I don't know if this is possible, as I don't know the internals of _getMinMax, yet.

BTW: Happy New Year :D


01-01-2011 21:32:01

Another update:

If someone is stumbling on this page because of left handed / right handed camera system conversion:

OgreCamera->setDirection( changeChirality( viewLHS ) )); // changeChirality: flip z
OgreCamera->setFixedYawAxis( true, changeChirality( upLHS ) );

With setting stuff like that hydrax performs better, but not yet perfect:

I've modified the ProjectedGrid::update method to also check for a change in the position of hydrax itself (replacing the "true" statement in the first post).

Now, when I move, the grid is roaming the water. However when I stop moving and only look around, the grid is misplaced. It looks like it circles around position (0,0,0) in the x/z plane.


02-01-2011 20:39:01

Ok, lets end this monologue.

I guess I broke everything myself, while trying to "fix" the code. After reverting everything and only adding the check for the hydrax position and setting the camera orientation correctly, everything looks good now.