当前位置:网站首页>Unity's ASE achieves full screen sand blowing effect

Unity's ASE achieves full screen sand blowing effect

2022-07-07 15:07:00 PassionY

Preface

Recently, I was working on a desert environment 2D game , It needs to add a full screen special effect of sandstorm , Originally, we used particle effects , But later I found , There are a lot of particles , Performance consumption is very high . And because it is full screen sandstorm , When the particle effect area is too large , When there are too many layers , Caused by the overdraw An increase in , Can make cpu More stressful . Even eventually, our game will get stuck when switching between front and back stages .
therefore , We finally plan to use shader To achieve a sandstorm effect , Although it can't completely simulate the effect of particles , But basically restore 90% The wind and sand effect .

Look at the renderings first :
 Insert picture description here

Realization principle

1. Realization of wind principle : Use a flowing noise map , Realize the image of clouds UV Disturbance .
2. Sand realize principle : First let the grainy or strip picture translate in the wind , Then use a noise map R The channel kicks out the translation result of sand , Finally, multiply by a superimposed color .

Noise interference

The flow principle of noise map is shown in the figure below :
 Insert picture description here

Attribute setting of wind

 Insert picture description here

Attribute setting of sand

原网站

版权声明
本文为[PassionY]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/188/202207071301516701.html