Jump to content
  • Advertisement
Sign in to follow this  
vicer1234

2d water effect

This topic is 2779 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites

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.??

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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=;;

Share this post


Link to post
Share on other sites
If you would implement real simulated water you would not need the tutorial / guide from that link.

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!