Water... can you sample the surface height for buoyancy simulation, etc?

If there a means of obtaining the vertical height of the water surface at various points, say to act as input to a buoyancy simulation of ships and boats on the waves?



tone

I guess you are talking about the WaterFilter.

There is no easy way of doing this, but, water height is sampled from a heightmap in the shader, maybe you could sample it to get the height…

look at the heightTexture in the WaterFilter.



Also, for a starter using the getWaterHeight and just approximate the height of the wave with a sine function could do the trick…

Hello,



I was able to sample the heightTexture, but all the bytes inside its buffer are constant in time.



I also tried to sample the surface with rays, but they do not collide with the water surface.



Suggestions are welcome, thank you !



[EDIT: ok, I begin to understand, this is a fixed heighmap, translated in the winds direction & following a sine in the vertical direction. I have everythin I need now!]