No Water Surface

insider

13-01-2012 13:22:57

I have setup Hydrax and its loading fine in my game.
The problem is I cant see the water surface at all.
When I move the camera to the top of level to see the water surface I guess it is culled and I can only see my game level without the water.

I noticed someone had the same problem in the url below but adding mHydrax->update(e.timeSinceLastFrame); to framestarted() doesn't solve the problem for me.

http://www.ogre3d.org/addonforums/viewtopic.php?f=20&t=13585&p=76369&hilit=underwater#p76369

Any help would be great.

insider

13-01-2012 18:59:05

Found the fix
Just have to change the code from

// Base Plane
Ogre::Plane(Ogre::Vector3(0,1,0), Ogre::Vector3(0,0,0)),


// Base Plane
Ogre::Plane(Ogre::Vector3::UNIT_Y, Ogre::Real(0.0f)),

insider

13-01-2012 19:06:35

This only works for ProjectedGrid which has a base plane.

Hydrax::Module::ProjectedGrid *mModule
= new Hydrax::Module::ProjectedGrid(// Hydrax parent pointer
mHydrax,
// Noise module
new Hydrax::Noise::Perlin(/*Generic one*/),
// Base plane
Ogre::Plane(Ogre::Vector3::UNIT_Y, Ogre::Real(0.0f)),
// Normal mode
Hydrax::MaterialManager::NM_VERTEX,
// Projected grid options
Hydrax::Module::ProjectedGrid::Options(/*264 /*Generic one*/));


I am using a SimpleGrid which doesnt take any BasePlane parameters so how do I acheive the fix with SimpleGrid.
Any Ideas?

Hydrax::Module::SimpleGrid * mModule = new Hydrax::Module::SimpleGrid(mHydrax,new Hydrax::Noise::Perlin(),Hydrax::MaterialManager::NM_VERTEX,options_struct);

ekow

20-03-2012 08:06:47

i have the similar problem, and took me few days to find out that the culprit is
mCamera->setNearClipDistance(0.01f);
i change the value into 0.1f then the water shows properly :D

azerty45

06-08-2013 10:46:26

Hello everyone,

I have exactly the same problem as mentionned in this topic and those others below. HydraX water is not visible from above. There's no water surface.
http://www.ogre3d.org/addonforums/viewtopic.php?f=20&t=9692
http://www.ogre3d.org/addonforums/viewtopic.php?f=20&t=12178
http://www.ogre3d.org/addonforums/viewtopic.php?f=20&t=12953
http://www.ogre3d.org/addonforums/viewtopic.php?f=20&t=13585
http://www.ogre3d.org/addonforums/viewtopic.php?f=20&t=11088
http://www.ogre3d.org/addonforums/viewtopic.php?f=20&t=29443


Many people are stucked with that strange issue. According to what I read in these topics, some fairly random solutions seem to correct the problem for some people, but not for everyone including my case :
- Disabling shadows or only use Texture shadows
- Changing the way the baseplane is set during hydrax projected grid module initialization
- Changing the camera near clip distance
- Decreasing the SkyBox "size"

There's no errors in the logs and the problem happens both on my Ubuntu and Windows config, whereas the Demo works fine on these platforms...

Test conditions :
- Ogre 1.8.1, HydraX 0.5.4
- Windows 7 with ATI Radeon HD 4200, problem occurs with OpenGL AND DirectX
- Ubuntu 12.10 with Graphic Chipset Intel (HydraX demos work fine ont these configs), OpenGL
- Hydrax is set exactly as in the demo, correctly updated each frame.
- I tried all the "fixes" listed above
- Tested with SkyBox, without skyBox, with SkyX, without SkyX, with Terrain, without Terrain and changing all possible initialization orders
- Release mode, optimization level O3
- No compositor enabled during tests


This bug begins to make me crazy ! Does anybody have any elucidation about this strange issue ?

insider

06-08-2013 12:14:39

Found the fix
Just have to change the code from

// Base Plane
Ogre::Plane(Ogre::Vector3(0,1,0), Ogre::Vector3(0,0,0)),


// Base Plane
Ogre::Plane(Ogre::Vector3::UNIT_Y, Ogre::Real(0.0f)),


Hi azerty45 have you tried this fix, well it worked well for me but I was using Ogre 1.7.2 at that time.
Haven't tried Hydrax in Ogre 1.8.1 yet will check it out and let you know if the same fix works.

Regards

Insider

insider

06-08-2013 12:19:44

And you can try Ogre 1.8.1 with Hydrax 0.5.1 instead of 0.5.4 as 0.5.1 was the last official release of Hydrax from Xavyiy. :)
And yes the solution I posted worked with Hydrax 0.5.1 and so I have no idea whether it will work with 0.5.4

azerty45

06-08-2013 13:46:45

Thanks for your response insider.
I just downloaded and compiled the 0.5.1 version on my two computers (Windows and Linux), but the problem is still the same : no water surface, even with your solution with the Plane definition.

I'll inspect my code in more details, but I have really no idea what it could be related to..

insider

06-08-2013 14:13:06

Thanks for your response insider.
I just downloaded and compiled the 0.5.1 version on my two computers (Windows and Linux), but the problem is still the same : no water surface, even with your solution with the Plane definition.

I'll inspect my code in more details, but I have really no idea what it could be related to..


Okay I ll try compiling Hydrax 0.5.1 with Ogre 1.8.1 and will let you know in a day or two whether it works or not and then we can see why it is not working for you.
Stay tuned and keep hunting the bug, I ll catch u after I get Hydrax working in Ogre 1.8.1.

Regards

insider

06-08-2013 15:05:51

Thanks for your response insider.
I just downloaded and compiled the 0.5.1 version on my two computers (Windows and Linux), but the problem is still the same : no water surface, even with your solution with the Plane definition.

I'll inspect my code in more details, but I have really no idea what it could be related to..


Hi azerty45, I confirm Hydrax 0.5.1 works with Ogre 1.8.1 and with SkyX 0.4.
I just compiled Hydrax and Ogre here is the screenshot.


Could you just post the Hydrax related code so that I can see if I can find the issue.
Let me know if I can be of more help. :)

Regards

Insider

azerty45

06-08-2013 18:05:09

Thank you insider for having taken the time to test. Now I see that it should work !

But as shown on my screenshots, there's still no surface :
[attachment=0]HydraXBug.png[/attachment]

Here is my HydraX related code :

void Eau::Draw()
{
// Create Hydrax object
m_pHydrax = new Hydrax::Hydrax(m_pSceneMgr, m_pCamera, m_pWindow->getViewport(0));

// Create our projected grid module
Hydrax::Module::ProjectedGrid *mModule = new Hydrax::Module::ProjectedGrid(
m_pHydrax,
// Noise module
new Hydrax::Noise::Perlin(/*Generic one*/),
// Base plane
//Ogre::Plane(Ogre::Vector3(0,1,0), Ogre::Vector3(0,0,0)),
Ogre::Plane(Ogre::Vector3::UNIT_Y, Ogre::Real(0.0f)),
// Normal mode
Hydrax::MaterialManager::NM_VERTEX,
//Hydrax::MaterialManager::NM_TEXTURE,
// Projected grid options
Hydrax::Module::ProjectedGrid::Options(/*Generic one*/));

// Set our module
m_pHydrax->setModule(static_cast<Hydrax::Module::Module*>(mModule));

//m_pHydrax->loadCfg("HydraxDemo.hdx");
//m_pHydrax->loadCfg("HydraxTest3.hdx");
//m_pHydrax->loadCfg("FastWater.hdx");
m_pHydrax->loadCfg("Hydrax051.hdx");

m_pHydrax->setShaderMode(Hydrax::MaterialManager::SM_CG);
//m_pHydrax->setShaderMode(Hydrax::MaterialManager::SM_GLSL);

// Create water
m_pHydrax->create();
}




bool Eau::frameStarted(const Ogre::FrameEvent& evt)
{

if (m_pHydrax != 0)
{
m_pHydrax->update(evt.timeSinceLastFrame);
}

return true;
}


I don't see any error when comparing to other classic ways of initializing HydraX (Demo, forums...). There's no errors in the log.
Very strange.

In case of you would have time to have a deeper look in my code, here is my atomic program which tries to run HydraX 0.5.1 on Windows :
https://dl.dropboxusercontent.com/u/17974161/TestHydraX.zip
Also, if someone could try my Hydrax DLL (in the zip) with a working HydraX program, I will then be able to deduce if my problem is related to my program or my HydraX compilation !

Thank you for your support :)

Regards

azerty45

07-08-2013 08:15:40

Thank you Insider for having taken time to test it. Now I know that it should work !

But it still doesn't as you can see in the screen below :
[attachment=0]HydraXBug.png[/attachment]


However, my HydraX related code is very basic and similar to the demo :
void Eau::Draw()
{
// Create Hydrax object
m_pHydrax = new Hydrax::Hydrax(m_pSceneMgr, m_pCamera, m_pWindow->getViewport(0));

// Create our projected grid module
Hydrax::Module::ProjectedGrid *mModule = new Hydrax::Module::ProjectedGrid(
m_pHydrax,
// Noise module
new Hydrax::Noise::Perlin(/*Generic one*/),
// Base plane
//Ogre::Plane(Ogre::Vector3(0,1,0), Ogre::Vector3(0,0,0)),
Ogre::Plane(Ogre::Vector3::UNIT_Y, Ogre::Real(0.0f)),
// Normal mode
Hydrax::MaterialManager::NM_VERTEX,
//Hydrax::MaterialManager::NM_TEXTURE,
// Projected grid options
Hydrax::Module::ProjectedGrid::Options(/*Generic one*/));

// Set our module
m_pHydrax->setModule(static_cast<Hydrax::Module::Module*>(mModule));

//m_pHydrax->loadCfg("HydraxDemo.hdx");
//m_pHydrax->loadCfg("HydraxTest3.hdx");
//m_pHydrax->loadCfg("FastWater.hdx");
m_pHydrax->loadCfg("Hydrax051.hdx");

m_pHydrax->setShaderMode(Hydrax::MaterialManager::SM_CG);
//m_pHydrax->setShaderMode(Hydrax::MaterialManager::SM_GLSL);

// Create water
m_pHydrax->create();
}



bool Eau::frameStarted(const Ogre::FrameEvent& evt)
{
if (m_pHydrax != 0)
{
m_pHydrax->update(evt.timeSinceLastFrame);
}
return true;
}


Still no water surface, no error in the log and the demo works fine on my computer. Very strange.

In case someone would have time to have a deeper look in my program, I uploaded an atomic project which reproduces this bug :
https://dl.dropboxusercontent.com/u/17974161/TestHydraX.zip
You can also test my Hydrax.dll with a working project to deduce is the issue is in my program or related to my HydraX lib compilation.

Thank you very much for your support

Regards

azerty45

08-08-2013 08:20:11

I finally get done with this problem by changing... the camera far clip distance. The issue occured when an infinite far clip distance was set.
I had never thought this hydrax bug would be related to this.

Fix :

// if (m_pRoot->getRenderSystem()->getCapabilities()->hasCapability(Ogre::RSC_INFINITE_FAR_PLANE))
// m_pCamera->setFarClipDistance(0); // ===> BUG : No water surface

m_pCamera->setFarClipDistance(99999); // ===> OK For HydraX



Works with Ogre 1.8.1, HydraX 0.5.1 and HydraX 0.5.4