r/GraphicsProgramming • • 1d ago

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.

72 Upvotes

8 comments sorted by

•

u/AutoModerator 1d 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 1d 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 1d ago edited 10h 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 11h 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 8h 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 4h 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

2

u/Zionn13 1h ago

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

2

u/ConsistentFox567 11h ago

it is so satisfying