How to add ripples in Hydrax


04-11-2008 09:37:13

First I'm happy that a new topic over Hydrax is born : it's an amazing add-on !!!

My problem is that I would like to create waves, ripples on hydrax water. The objective is to create a little race boat game, so I need to add waves after a boat movement.
I already try to add my own function in the noise Perlin in reference to that functions : "_readTexelLinearDual" but it makes nothing...
This is my code :

// u, v the coord and ut the value
void Perlin::_writeTexelLinearDual(const int &u, const int &v,const int &ut)
int iu, iup, iv, ivp, fu, fv;

iu = (u>>n_dec_bits)&np_size_m1;
iv = ((v>>n_dec_bits)&np_size_m1)*np_size;

iup = ((u>>n_dec_bits) + 1)&np_size_m1;
ivp = (((v>>n_dec_bits) + 1)&np_size_m1)*np_size;

fu = u & n_dec_magn_m1;
fv = v & n_dec_magn_m1;

r_noise[iv + iu] = ut;
r_noise[iv + iup] = ut;
r_noise[ivp + iu] = ut;
r_noise[ivp + iup] = ut;

Is it r_noise (or p_noise) that I need to change ?
Is that anybody have an idea or did an equivalent thing ?
Somebody could explain me the parameters of Noise class ?

Thank you very much and sorry if I wrote english mistakes :-)


05-11-2008 17:47:22

I see that nobody have any idea...

I try to do some thing and I realise little modification in ProjectedGrid.cpp when the function getValue is called and I had some values to create a hole in the water, this is the result :

And this the code I used in void ProjectedGrid::update(const Ogre::Real &timeSinceLastFrame) :

for(v=0; v<mOptions.Complexity; v++)
for(u=0; u<mOptions.Complexity; u++)
if(v < 200 && v > 150 && u > 150 && u < 200) {
Vertices[i].y = -mBasePlane.d + mNoise->getValue(RenderingCameraPos.x + Vertices[i].x, RenderingCameraPos.z + Vertices[i].z)*(mOptions.Strength-30) - 10;
} else {
Vertices[i].y = -mBasePlane.d + mNoise->getValue(RenderingCameraPos.x + Vertices[i].x, RenderingCameraPos.z + Vertices[i].z)*(mOptions.Strength);
Vertices[i].y = -mBasePlane.d + mNoise->getValue(RenderingCameraPos.x + Vertices[i].x, RenderingCameraPos.z + Vertices[i].z)*mOptions.Strength;


Do you think it's possible to propagate the hole or something like that ?
Please could you help me Xavyiy and Netskate because you seemed to know a lot of thing in this beautiful plugin !!!

Thank you very much.


05-11-2008 18:40:26

You've to modify the Hydrax::Noise::Perlin class(Not projected grid or other geometry module)

An approach is:
- Create a structure that represents a wave in 2D:
float x,y;
float power;
float vel;
float alipsed time;
float life;

- Create a funtion that return the height of all waves in a 2D world, like:
const float Hydrax::Noise::PerlinMod::_calculateWavesAmount(const float& x, const float& y)
for each wave, calculate the height of the wave in the (x,y) coord and return the Σ of the heights.

const float Hydrax::Noise::PerlinMod::_updateWaves(const float& delta){...}


I'm thinking to start an Ogre/Hydrax wave runner races game next summer, so probably I'll add the wave feature :), but this is the main idea.



16-07-2010 13:08:55

Sorry for bringing up this old post again.

I'm going to need ripple effects in Hydrax soon, and I just wanted to ask: did you eventually manage to get those ripples? Is there some other forum post I have missed (I don't think so, I've gone through them all) ?



20-08-2010 10:15:57

no sorry I can't help you besause I didn't make it. I tried but I didn't have enought time to make it real, my project wasn't enought long. Good luck, and I hope you will realize that, it would be great !!!