콘텐츠로 건너뛰기

URP BoatAttack URP Research Report – Part 2 – Gerstner Wave

Original Resources from Unity3D with Unity Korea.

Documents Organizing by JP.Leeleegoonz@163.com

summary.

We analyze the features used for the rendering of the sea surface.

The Unity version uses 2019.3.7.

The sea implementation system has four major parts.

  1. A sea mesh that is quantized for moves along with the camera.
  2.  Be careful points when integrating Packages into other projects. 
  3.  Implementation and concept of the Gerstner Wave. 
  4. URP Reflection system for water mesh.
The sea surface rendering feature is implemented in Water.cs.
The basic rendering of water starts here.

Instead of using a mesh renderer, the mesh is rendered using the graphics API of SRP directly.

 Specifically, the wave expression itself is implemented using the Job system.

See GerstnerWavesJobs.cs.

It inherited the interface to use the Job system.

The GerstnerWaves formula has been implemented for a very long time.

GPU GEMS 1 has a more detailed formula.
Let’s understand it more simply.
GerstnerWaves uses Sin and Cos.
Use Sin for the Y-axis and Cos for the X.

Assigning it this way can make a circle move.

Let’s look at the movement by copying 100 objects with 0.2 moving in the X-direction.

Each object has a circular motion, but on the whole, it will look like it is forming a certain wavelength.

The actual GerstnerWave Class has a similar structure.

The job system and ECS are completely separate systems.

In general, when these two are used together, object-oriented design is possible, but it can be used alone.

Water.cs

Looking at the code, both GPU processing and CPU (Job system) are implemented. It is branched according to the intended use.

Also, in GersnerWavesJobs, it was not used for the movement of each vertex of the wave.

It was used to realize the buoyancy effect of objects floating on the sea surface.

If you look at Player Class or other floating object classes, you can see that Update () uses GersnerWavesJobs to update location data.

And Tessellation is performed using ComputeBuffer. It is defined not to be used in Android hardware.

You will use the GerstnerWaves algorithm implemented with the vertex shader of GerstnerWaves.hlsl.

Comparing the GerstnerWaves structure implemented with the Job system to the GerstnerWaves structure implemented with the shader, it is almost similar because the same algorithm is used.

In conclusion, it can be said that the sea surface is being processed by the shader and the job system is used to transfer values to objects floating on the sea surface.

LOD processing of mesh for wave expression is not done in real-time.

It does not operate with tessellation and does not use the ROAM method.

The water plane mesh is pre-made.

The closer to the center of the plane mesh, the higher the vertex precision.

And this mesh is implemented by continuously following the Player camera in real-time.

We will record how the water plane mesh follows the camera in the next post.

https://www.patreon.com/posts/36245203

태그:

댓글 남기기

%d 블로거가 이것을 좋아합니다: