Im trying to animate the height of my heightmap. Now im loading a png and render that onto a grid. Then I take the color value of the position on the heightmap and multiply that by height so its like that:
u_Position = (position.x, height * heightMapValue.r ,position.z);
now im looking for a way to animate the height so it goes from height = 0
to height =
set by user
for that i already used this:
u_Position.y = height * heightMapValue * sin(time)
now I got two problems:
- how do I make it so that it doesnt goes from
+height
to-height
like its doing right now. Basicly I want to move the sin wave up so it only goes between0 - height
. - I want that animation to take 10 seconds. The time variable already returns the runtime of the program in seconds