Water shader in Unity and Unreal Engine Comparison - vostrenkoff/WaterShaderUnreal GitHub Wiki

Description

Water shaders are a common thing in modern game development since most 3D games contain oceans, lakes, rivers etc. Unity and Unreal Engine are two of the most popular game engines that developers use to create games with water elements. In this comparison, we will explore and evaluate the water shader performance of Unity and Unreal Engine. We will take a closer look at their features, capabilities, and limitations, and provide an analysis of how each engine handles water rendering and simulation.

Let's discuss differences between engines. Unity is known for its ease of use and accessibility, Unreal Engine is known for its advanced features and graphics capabilities, making it a preferred choice for AAA game development. In terms of graphics and performance, Unreal Engine has a slight edge over Unity. Unreal Engine uses its own rendering pipeline, which allows it to render more realistic and detailed graphics. However, Unity has made significant improvements in recent years, and both engines are capable of producing high-quality visuals.

Both shaders were made in Unity and Unreal engines Shader Graph tools were provided by them. These tools have lots of differences, although I tried to make both shaders as similar as possible. During tests both shaders will have the same amount of vertices, but different mathematical formulas controlling them. Unreal shader was made using lots of different tutorials on YouTube, they are specified in Source section.

Tests will be conducted to compare the performance using these different approximate numbers of vertices:

16 | 22k | 71k | 269k | 1.1m | 4.2m | 16.8m (k = 1.000, m = 1.000.000)

Performing tests

In both engines, Water Shader material got attached to the same plane during each test. For Unity Engine, I wrote a script that exports FPS into Excel file every second, and calculates average. For Unreal Engine I just used built-in average FPS counter, since I couldn't manage how to export data correctly due lack of knowledge of the Unreal Engine.

Justification

I decided to compare Unity and Unreal Engine performace using water shader, because I already have a water shader made by myself a while ago for Personal Portfolio course, so decided to create Unreal shader as similar as possible to improve my Unreal knowledge and make performance test.

Evaluation proposal: Implement water shader in Unity and Unreal engines, test it performance and compare FPS. Implement refraction into Unity water shader, test performance with Opaque Texture settings.

Technical specs.

  • CPU: Ryzen 5 3600
  • GPU: Geforce RTX 3060Ti
  • RAM: 16 GB
  • SSD: 512 GB

Comparison

Vertices amounts comparison

Analysis

From the beginning, we can see that FPS in engines are not in the same level, although FPS lock is disabled in both engines. I couldn't figure out why Unreal has way much FPS than Unity, but all lighting effects such as ray-tracing, fog, rays and shadows were disabled. For this test in both engines low water height was chosen, as well as frequency and water speed. In this test framerate of FPS level of boths engines stays stable while amount of vertices is less than 1.1 million.

After 1.1 million it was hard for engines to handle shaders according to FPS count. Unity's FPS didnt significantly dropped (from 155 to 130), but Unreal's dropped from 95 to 55. We can see that in each test, Unity shows slightly more FPS than Unreal, but at the end when amount of vertices hits 16.8, their framerate is almost the same.

Conclusion

In conclusion, our comparison of water shader performance in Unity and Unreal Engine showed that both engines have completely different and unexpected test results. However, it is important to remember that both engines have completely different architecture and programming languages. When it comes to handling water rendering and simulation, Unity shows better results, but things may change in other comparisons. Unity Engine showed higher FPS counts in all three tests, while Unreal struggled with FPS drops in some tests. However, it is important to note that the results may vary depending on the specific settings and hardware used. Although, mostly FPS dropped when water was unrealistic, for example water is too fast, or waves are too high. Developers should carefully consider their project needs and resources before choosing which engine to use. Overall, both Unity and Unreal Engine provide powerful tools with lots of possibilities for creating realistic water effects in 3D games.

Opaque Texture Downsampling tests using refraction

Analysis

In this test, I implemented refraction into the water shader in Unity and created four planes with a total of 16.8 million vertices in the scene. As anticipated, with refraction turned off, the average frame rate was 47.2 frames per second. However, upon further observation during the continued test, it is evident that the FPS count remains the same regardless of whether downsampling is disabled or set to 4x downsampling.

Conclusion

After analyzing the tests I have conducted, it appears that there are several reasons why downsampling does not have a significant impact on FPS. One of the main reasons could be that the GPU in my laptop is powerful enough to handle refraction rendering without difficulties. Another factor to consider is the implementation method of the refraction shader, which may not impose a heavy workload on any GPU. To obtain more accurate testing results, I would use more advanced and complex refraction shaders.

Important note: Test results may vary when using different systems or hardware. Additionally, the results can be influenced by background system processes.

Source