Dhanush

04-29-2015, 01:34 PM

Hi,

I was able to create water ripples on texture but the problem is even the water droplets fall as texture can anyone guide me how i can eliminate textures from those droplets..

1768

I have attached an image of what is happening.

This s the code which generates the ripple positions

for(y = 1; y < WATERSIZE-1; y++) {

for(x = 1; x < WATERSIZE-1; x++) {

n = ( water[t][x-1][y] +

water[t][x+1][y] +

water[t][x][y-1] +

water[t][x][y+1]

) /2;

n -= water[f][x][y];

n = n - (n / DAMP);

water[f][x][y] = n;

}

}

y = 0;

for(x = 1; x < WATERSIZE-1; x++) {

n = ( water[t][x-1][y] +

water[t][x+1][y] +

water[t][x][y+1]

) /2;

n -= water[f][x][y];

n = n - (n / DAMP);

water[f][x][y] = n;

}

x = 0;

for(y = 1; y < WATERSIZE-1; y++) {

n = ( water[t][x+1][y] +

water[t][x][y-1] +

water[t][x][y+1]

) /2;

n -= water[f][x][y];

n = n - (n / DAMP);

water[f][x][y] = n;

}

x = WATERSIZE-1;

for(y = 1; y < WATERSIZE-1; y++) {

n = ( water[t][x-1][y] +

water[t][x][y-1] +

water[t][x][y+1]

) /2;

n -= water[f][x][y];

n = n - (n / DAMP);

water[f][x][y] = n;

}

y = WATERSIZE-1;

for(x = 1; x < WATERSIZE-1; x++) {

n = ( water[t][x-1][y] +

water[t][x+1][y] +

water[t][x][y-1]

) /2;

n -= water[f][x][y];

n = n - (n / DAMP);

water[f][x][y] = n;

}

}

For Display function i am using GL_QUAD_STRIP and the following as vertices:

glVertex3f(j-WATERSIZE/2, (i+1)-WATERSIZE/2, water[t][j][i+1]);

glVertex3f(j-WATERSIZE/2, i-WATERSIZE/2, water[t][j][i]);

I was able to create water ripples on texture but the problem is even the water droplets fall as texture can anyone guide me how i can eliminate textures from those droplets..

1768

I have attached an image of what is happening.

This s the code which generates the ripple positions

for(y = 1; y < WATERSIZE-1; y++) {

for(x = 1; x < WATERSIZE-1; x++) {

n = ( water[t][x-1][y] +

water[t][x+1][y] +

water[t][x][y-1] +

water[t][x][y+1]

) /2;

n -= water[f][x][y];

n = n - (n / DAMP);

water[f][x][y] = n;

}

}

y = 0;

for(x = 1; x < WATERSIZE-1; x++) {

n = ( water[t][x-1][y] +

water[t][x+1][y] +

water[t][x][y+1]

) /2;

n -= water[f][x][y];

n = n - (n / DAMP);

water[f][x][y] = n;

}

x = 0;

for(y = 1; y < WATERSIZE-1; y++) {

n = ( water[t][x+1][y] +

water[t][x][y-1] +

water[t][x][y+1]

) /2;

n -= water[f][x][y];

n = n - (n / DAMP);

water[f][x][y] = n;

}

x = WATERSIZE-1;

for(y = 1; y < WATERSIZE-1; y++) {

n = ( water[t][x-1][y] +

water[t][x][y-1] +

water[t][x][y+1]

) /2;

n -= water[f][x][y];

n = n - (n / DAMP);

water[f][x][y] = n;

}

y = WATERSIZE-1;

for(x = 1; x < WATERSIZE-1; x++) {

n = ( water[t][x-1][y] +

water[t][x+1][y] +

water[t][x][y-1]

) /2;

n -= water[f][x][y];

n = n - (n / DAMP);

water[f][x][y] = n;

}

}

For Display function i am using GL_QUAD_STRIP and the following as vertices:

glVertex3f(j-WATERSIZE/2, (i+1)-WATERSIZE/2, water[t][j][i+1]);

glVertex3f(j-WATERSIZE/2, i-WATERSIZE/2, water[t][j][i]);