Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How does Unity do several Wheels of fluid Physics

2025-01-15 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/01 Report--

Editor to share with you how to do fluid physics Unity a few wheels, I believe that most people do not know much about it, so share this article for your reference, I hope you will learn a lot after reading this article, let's go to understand it!

The internal implementation is Liquidfun

Metaball implementation is also provided (although 2D metaball really has nothing to say)

Half4 frag (v2f I): COLOR {half4 texcol,finalColor; finalColor = tex2D (_ MainTex, i.uv)

If (finalColor.a < _ botmcut) {finalColor.a = 0;} else {finalColor.a * = _ constant;} return finalColor;}

The principle is to discard the pixels outside the threshold according to the transparency threshold, and the actual range of the disc will be more protruding than shown. If the protruding parts of the two discs are stacked together, the transparency will exceed the threshold and become able to display. It looks like the two water droplets will stick together instead of independent circles.

But 3D water can not only consider the density, but also consider the normal. And the density in 3D space can not be simply superimposed by Blend, and 3D space can not be as extravagant and wasteful as 2D space because of the limitation of texture size, which leads to a completely different algorithm. 2D water rendering is actually a very simple example of looking complex, while 3D water rendering is probably an example of looking complex and actually more complex.

However, to my surprise, most of the examples in Liquidfun do not use metaball technology, but draw all the particles directly with AlphaBlend. It uses particles close to the pixel size, and then directly colors the particles according to the physically calculated fluid density (the water surface and foam are white because of the low density, and the bottom is dark because of the high density). Enough ideal results can be obtained.

If you think about it, it's like metaball remapping according to transparency, it just puts the part of the cumulative density directly into the physical, and then draws the dots directly on the screen.

Its final weight demonstration fully demonstrates its coloring principle.

These are all the contents of the article "how to make a few Wheels of fluid Physics in Unity". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report