2d water effect

Started by
6 comments, last by vicer1234 12 years, 11 months ago
Hi,
I want to make a 2d game in which the character moves in the water and ripple effect are shown as the character moves in the water.
the effect should be somewhat as shown in this video My link


I want to know : 1 ) What approach i should take to implement it, is there any specific fluid simulation algorithm that i have to go through??
I want to implement it in a simple and quick manner.

I am using C/C++ and SFML

All suggestion are welcome.
Advertisement
You double posted this but I'll answer it here. In the description of the youtube video there is a link: http://freespace.virgin.net/hugo.elias/graphics/x_water.htm
On this page it is fully explained how the algoritm works. Suggest taking a look at that.
If I've helped you in any way please push the reputation button, thanks!

Abstraction is my choice of words.
Portfolio: http://www.0x3a.com/
Blog: http://blog.0x3a.com/

You double posted this but I'll answer it here. In the description of the youtube video there is a link: http://freespace.vir...ics/x_water.htm
On this page it is fully explained how the algoritm works. Suggest taking a look at that.


yeah i saw that link. But that is for creating the ripple effect, but first i want to know how to implement the water simulation, then i can use that approach for the ripple's.
What type of algorithm should i use it for 2d water simulation.??

yeah i saw that link. But that is for creating the ripple effect, but first i want to know how to implement the water simulation, then i can use that approach for the ripple's.
What type of algorithm should i use it for 2d water simulation.??

What do you mean exactly? The ripple effect and the 'water simulation' are one and the same, more or less, so it seems to me the algorithm described in the linked article is exactly what you're looking for.

yeah i saw that link. But that is for creating the ripple effect, but first i want to know how to implement the water simulation, then i can use that approach for the ripple's.
What type of algorithm should i use it for 2d water simulation.??


I think you are confusing something here or not expressing yourself not clearly enough. What do you mean by a water simulation? If it's creating the ripples then the provided link quite clearly describes how to generate ripples on a 2D surface. (If you make it blue and name it water then it's ripples on water). It's not a water simulation by any means. It's just a background image with ripple effect generated on it. If you want to simulate the behavior of water completely then it's a different question from how to make an effect.

Edit: Ninjaed =w=;;
If you would implement real simulated water you would not need the tutorial / guide from that link.
If I've helped you in any way please push the reputation button, thanks!

Abstraction is my choice of words.
Portfolio: http://www.0x3a.com/
Blog: http://blog.0x3a.com/
Hi,
I am trying to implement the algorithm as shown in the link http://freespace.virgin.net/hugo.elias/graphics/x_water.htm.

I am having some doubts in the implementation logic such as:

1) I have displayed a .tga file with water image -> I can click on it and get the clicked position.
Then using some calculation I determine a DEPTH value using the clicked position.

MY DOUBT = How this depth value and the pixel of the image to be related.????
What should i do with the depth value been calculated?

2) Pixel are composed of value (r,g,b). Then should i change the value of (r,g,b) for each pixel.???

3) Do I have to display the images pixel wise??
as I am using SFML it has the option of directly displaying the image like:

sf::Image.LoadFromFile("Water.tga");
sf::Sprite* sprite = new sf::Sprite(Image);

Game.Draw(*sprite);


4) The two buffers to be used like
char* buf_read;
char* buf_write;

should it be stored with pixel values of the image eg ( Water.tga) in the beginning?? The ProcessWater() as mentioned in the algorithm of the link
should i store the pixel values in the buffers in this function???

All suggestion are welcome. ( pretty much confused :( ) ..What should be the step by step logic to be followed
..

This topic is closed to new replies.

Advertisement