#### Archived

This topic is now archived and is closed to further replies.

# Meters as world coordinates and Water shader

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

## Recommended Posts

Hi, I actually have 2 questions but I don''t want to hog space on the forum so I''ll just post them as one thread... I was wondering, does anyone know if it would be possible to write a shader that manipulates the vertices of a square grid, to make realistic water ripples? Like, the way I have usually seen water rendering done is that you have some simulation like Navier-Stokes or FFT or whatever, and more or less it spits out a heightmap which you have to re-process into a "terrain" every frame. Meaning you have to lock your VB, update all the heights, and unlock it, as well as update all the normals on the CPU. The problem is with a vertex shader, you would have to do something much more limited... But I don''t know, maybe someone here is really creative and might know a way to do it I was thinking you could have some 2d function: f(x,y,t) = some height value And every frame, you would send t (time) as a constant to the shader and it would calculate a new height for every vertex based on some sinusoidal function or some noise function... Anyways that''s the idea, does this sound at all possible? (or even worth doing?) I''m guessing it would be possible to get a basic version of this going but it''d look really crappy compared to fancier water simulation techniques. OK second question A lot of games have it so that their world coordinates are in meters. This is really helpful not only conceptually, but also if you want to use 3D sound, FMOD for example will only produce correct Doppler effects if you use meters. I''m not quite sure how to enforce this in code though. Is it just an approximate thing, like you could say "hmm, let me try setting this guy''s velocity to 6 mph and then see if it looks like he''s moving at jogging speed." Also for artistic reasons, the scaling between objects aren''t always exact. For example, in RTS games, the size ratio between buildings and units is really small. Thank you! Raj

1. 1
2. 2
Rutin
24
3. 3
4. 4
JoeJ
16
5. 5

• 14
• 29
• 11
• 11
• 9
• ### Forum Statistics

• Total Topics
631773
• Total Posts
3002270
×