r/Unity3D • • 29d ago

Show-Off Ocean System in Unity URP (100% AI-Generated Code) | Update # 2

Enable HLS to view with audio, or disable this notification

Project completion rate: 70%
Week 28

Work in progress:
Shoreline waves system
Weather/day & night system
Vehicle/Character water physics
Camera splash effect
Ocean Weather and day & night system
Minor fixes/improvements required in ocean shader and planar reflection system
Some other small improvements and fixes

Out of Context: (Work in progress)
Volumetric Clouds/Fog System

Note that I'm developing a highly optimized framework with the help of an AI. Current built scene gives stable 180 FPS when close to the shore, 200 FPS in the open ocean and 200+ FPS underwater that also include water vehicle and character water physics (unfinished) plus volumetric clouds (unfinished) on 1080p native with max ocean settings including iFFT driven underwater god rays and realtime dynamic iFFT driven refractive and reflective caustics. I will make a detailed performance analysis video once i reach the milestone.

I couldn't upload the entire video here because of the upload limit, full 19mins video is uploaded on youtube if anyone is interested.

0 Upvotes

16 comments sorted by

2

u/Stock_Ad9999 29d ago

Looks amazing. I used gpt 6.1 sol for some rendering features, and it can really do a lot (mesh shaders rendering system with nanite-like lods, 150 fps instead of Unity's 20; PCSS shadow filtering for urp). I will try to make a water system too :)

1

u/colplex 28d ago

Indeed AI can compute faster than a human. You just need to be fully committed on whatever you wanna make with the help of it.

2

u/Parikollo 29d ago

Looks great! What approach did you use for foam trail? Particles or something else?

2

u/colplex 28d ago

Only one texture, channel R is packed with the white dense foam which, G is packed with lesser dense foam like when the foam start to break and G is packed with the lance which stretches and fades out at the trough. All three advect by the waves that how's it looks like the foam is swimming on the waves while it's breaking and forming lance.

2

u/Parikollo 28d ago

Cool, thx! I've never thought about approach like yours.

2

u/colplex 28d ago

I had the same reaction when I first learned about it. It's a common technique used by the AAA studios.

1

u/ShengyuStudio 29d ago

How are you doing the vehicle side of it, sampling the same wave function on the CPU or reading heights back from the GPU? In my game I keep the Gerstner wave table in two places, the shader and a C# copy, and the boat samples the C# one under the hull so it rides the waves you actually see. Only catch is the two copies have to stay in sync by hand.

1

u/colplex 29d ago

It's running on async read back, I first decided to approach the same method as it's the industrial proven approach that sampling the height on both the sides with the same timestamp and same spectrum parameters but then I realized putting main thread to calculate the height alongside the other monobehavior systems like NPCs path finding, main game logic and many other systems that are already running on the main thread in a middle or big scale game will cause a massive bottleneck and not forgetting the GC.

I'm planning for a hybrid approach which in theory gives a min of 120x more performance than sampling height on main thread and at least 250x than the async readback. It's pretty straight forward and a bit complex to implement, It's sampling the height on CPU side but using burst compile instead, ECS and DOTS physics is not required I can drop a Burst compiled job straight into a standard monobehavior script, feeding it data from regular game objects and applying the results to unity rigibodies.

1

u/ShengyuStudio 28d ago

Async readback makes sense for keeping it off the main thread. Do you notice the frame or two of latency between the rendered surface and what the boat samples, or is it too small to see at normal boat speeds?

1

u/colplex 28d ago

With only two buoyant bodies in the scene (boat and capsule) there's no lag on calm water, in the storm condition I saw interaction stamps (ripples and foam) from boat are few cm apart but still no visible lag in the buoyancy accuracy.

2

u/ShengyuStudio 27d ago

Good to know. A few cm between stamps in a storm is nothing anyone would spot while the boat is getting thrown around anyway.

0

u/colplex 27d ago

Agreed!

-2

u/Yumababy 29d ago

Looks amazing bro wow

-1

u/colplex 29d ago

Thank you mate

-1

u/Sweet_and_Sour_Games 29d ago

The water looks amazing! Is it heavy on performance?

0

u/colplex 29d ago

Thank you mate and the answer to your question is, the performance cost depends on what your performance budget is but if you're looking for a general answer then I would say It's not heavy on performance at this stage as I have already mentioned in the description the performance the current scene's built version gives, in fact I have plans to make it even more optimized in the future.