r/GraphicsProgramming • • 3d ago • Bravo 1

Video Wave simulation

Long-time lurker here. Watching GTA VI’s water system in action inspired me to write a wave simulation testbed.

I tried FFT but eventually settled on Gerstner waves (see Tessendorf’s paper) as they’re faster to calculate. For ripples I use pre-rendered waves in a number of tileable textures that I offset over time and tessellate in real time.

Foam uses Gerstner crest information. Still lots to do here.

The lighting is pretty straightforward.l: A Fresnel term with reflection from the cubemap, and irradiance calculated from the cubemap pre-integrated as a function of surface normal. Then there is a transmission term based on water depth. I came up with a cool trick to get a light transmission effect for thinner parts of waves. I’ll write this up properly at some point.

The ocean mesh is a geometry clipmap style thing that moves with the camera. Eventually I will LOD this based on camera height from sea level.

Waves and ripples are affected by wind via a wind flow map overlaid over the ocean’s area. This is still rudimentary. Eventually I want to add a current flow map which will form the basis for coastal waves and rivers.

Here’s one wave configuration in three different lighting conditions.

Still lots to do but it’s starting to look pretty cool I thought!

I use Codex to assist with writing code.

117 Upvotes

12 comments sorted by

•

u/AutoModerator 3d ago

Recently updated rules. Please check that your post is in compliance with Rules 1, 4, 5, and 6 on the sidebar. TL;DR:

  • No showcases.
  • Disclose AI usage in post or project.
  • Present a topic to talk about, e.g. how something works.

I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.

8

u/AhmedSamy_Offical 3d ago

Amazing for real but i think it’d be better to write all the code instead of using codex,
However if you already knows what you are doing and can edit anytime on anything you are doing it right 😃

Also is that UI built in custom or is that imgui and it’s edited ?

3

u/whdeboer 3d ago edited 3d ago

Thanks! Yes I’ve been a graphics programmer working in the games industry since the late 90s, published papers, shipped AAA games. I use AI to iterate on ideas quicker and write boilerplate 😊

1

u/ConsistentFox567 3d ago

hey. i am a 15 yo graphics programmer currently working on neural rendering (https://github.com/parth-satija/Project-Unrasterize). any advice?

1

u/whdeboer 3d ago

Hey, your project looks really cool. Keep it up. Have fun! If there is any specific advice you’re looking for let me know

1

u/ConsistentFox567 3d ago

i just wanted to know how to get a professor to mentor me for the research work, since that would be good for my uni applications

1

u/Zionn13 2d ago

then why not use FFT? or at least use pre-computed gerstners?

1

u/Specific-Animal6570 21h ago

How did you know he was using Codex? Lol, that's a surprise for me.

2

u/No-Wishbone7899 1d ago

very nice, i worked also on a ocean engine, but could never get the overhanging waves right,
it breaks the mesh i tried many science papers around this but never got it right .
Mabye time to try again.

1

u/whdeboer 1d ago

Thanks! Yes coastal waves is something I want to dive into. It’ll probably involve authoring wave shapes and morphing that onto a Gerstner wave maybe. With this project I’m mostly interested in having it look good and perform at <2ms than being strictly physically accurate. We’ll see..

1

u/No-Wishbone7899 1d ago edited 1d ago

The waves i made where FFT-based,three wave bands plus a separate field for disturbance

3

u/ConsistentFox567 3d ago

it is so satisfying