Hydrax is extremely slow in my app, but demos work fine

Kosmos

20-08-2011 09:20:11

hello.
Anybody know how to solve that problem?
all hydrax demos work fast enough, but when i adding hydrax to my application, it works very slow. so slow, that when you rotate camera, you can see at sides undrawn ocean space like that on attachment.
i am tried hydrax 0.5.1 and currently trying hydrax 0.5.4
i am used hydrax editor to customize scene and it work fast there, but work slow in my application.
removing sindba and island does not help.

that's how i creating it:
Hydrax::Hydrax *mHydrax = new Hydrax::Hydrax(_sceneManager, camera, window->getViewport(0));

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(0,1,0), Ogre::Vector3(0,0,0)),
// Normal mode
Hydrax::MaterialManager::NM_VERTEX,
// Projected grid options
Hydrax::Module::ProjectedGrid::Options(/*264 /*Generic one*/));

mHydrax->setModule(static_cast<Hydrax::Module::Module*>(mModule));

mHydrax->loadCfg("for_arcadia.hdx");

mHydrax->create();


shadows turned off.

config file:
#Hydrax cfg file.

#Hydrax version field
HydraxVersion=0.5.4

#Main options field
<vector3>Position=1500x-500x1500
<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=0x0x0

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

#Module options
Module=ProjectedGridVertex

<float>PG_ChoopyStrength=3.75
<bool>PG_ChoppyWaves=true
<int>PG_Complexity=264
<float>PG_Elevation=50
<bool>PG_ForceRecalculateGeometry=true
<bool>PG_Smooth=false
<float>PG_Strength=35

#Noise options
Noise=FFT

<int>FFT_Resolution=128
<float>FFT_PhysycalResolution=32
<float>FFT_Scale=0.25
<vector2>FFT_WindDirection=4x5
<float>FFT_AnimationSpeed=1
<float>FFT_KwPower=6
<float>FFT_Amplitude=1


does anyone know how to speedup things? :(

Kosmos

21-11-2011 18:27:03

two months passed without any activity in hydrax section (no new threads or posts)
does hydrax dead and no one using it?
could anyone tell then how to make endless ocean effect? i don't understand how that work in hydrax :(
making extremely big plane isn't solution for me, because i have kinda flight simulator.

RcALTIN

11-02-2013 02:50:29

Hi, I know this is very late answer but this may help somebody who gets this problem. Problem is that, you probably calling addTime function of sinbadCharacterController in your "frameRenderingQueued" func. after calling update func. of hydrax. So hydrax delayed one frame because of this calling sequence...

To solve the problem, you can change your calling sequence like this:

bool SampleApp::frameRenderingQueued(const Ogre::FrameEvent& evt)
{
bool ret = BaseApplication::frameRenderingQueued(evt);

// sinbad character controller
mChara->addTime(evt.timeSinceLastFrame);

// update hydrax
mHydrax->update(evt.timeSinceLastFrame);

// update skyx
mSkyX->update(evt.timeSinceLastFrame);

// enviromental calculations
Ogre::Vector3 sunDir = -mBasicController->getSunDirection();
float point = (-sunDir.y + 1.0f) / 2.0f;
mHydrax->setWaterColor(mWaterGradient.getColor(point));

Ogre::Vector3 sunPos = mCamera->getDerivedPosition() - sunDir * mSkyX->getMeshManager()->getSkydomeRadius(mCamera) * 0.1f;
mHydrax->setSunPosition(sunPos);

Ogre::Vector3 sunCol = mSunGradient.getColor(point);
Ogre::Vector3 ambientCol = mAmbientGradient.getColor(point);

mHydrax->setSunColor(sunCol);
//mSceneMgr->setAmbientLight(Ogre::ColourValue(ambientCol.x, ambientCol.y, ambientCol.z));

Ogre::Light *sunLight = mSceneMgr->getLight("SunLight");
sunLight->setSpecularColour(sunCol.x, sunCol.y, sunCol.z);
sunLight->setDiffuseColour(ambientCol.x, ambientCol.y, ambientCol.z);
sunLight->setPosition(sunPos);

Ogre::Light *shadeLight = mSceneMgr->getLight("ShadeLight");
shadeLight->setDirection(sunDir);

return ret;
}