handmade.network » Forums » Water/ice surface rendering in 2D
leonardo lucania
42 posts


#12216 Water/ice surface rendering in 2D
1 year, 1 month ago

Hi all, I'm studying a system that would allow interesting interactions between water, fire, wind, electricity ecc.
"locically" speaking, the server handles those surfaces as simple rectangles, so that it can detect collision, handle overlapping and merge them, and do all sort of things: every "surface" will be defined by some physical attributes and the dimensions of the rectangle.

For example, a water surface could have a "deepness" attribute, that can be used for all the gameplay stuff, a "fire" surface could have instead another attribute that specifies what the height of the flame is at that point.
This will allow me to have a nice and clean logic about those surface: for example, if a fire surface and a water surface are overlapping, I can decide to reduce the height of the flame and to reduce the deepness of the water.

The problem is that I have absolutely never studied how to render these kind of effects, so I would like to be pointed to some good resources on the subject, to understand the theory and then be able to apply it.

Furthermore, I want the rendering of these effects to be absolutely dynamic: a small lake can evaporate under the sun effects, so the water surface reduce is dimensions until the entity is deleted or something like that: I want to render that change continuosly, frame by frame, instead of at discrete timestamps.
I guess that merging is also quite tricky... for example, what happens if it's raining and a water splash is spawned near a lake? logically it's really easy to merge them... but how can I render them in this situation?

How would you approach the problem?