当前位置:网站首页>Unity occlusion culling

Unity occlusion culling

2022-06-11 04:21:00 Sea moon

Set the static objects in the scene as static occlusion Static Occluder And static obstructions Static Occludee.

But they have to be terrain or Mesh Renderer, Opaque , Don't move .

After setting the static occluder and the static occluded , Make sure that the camera has the occlusion removal function turned on , You can bake the occluded data .

window - Rendering - Occlusion culling , Open the occlusion culling panel

Object tab related settings

Screne Filter You can select the object type to edit , After selecting an object, you can adjust its static identification .
1. If you don't create an occluded area , Occlusion culling is applied to the entire scene by default .
2. Whenever the camera is outside the occluded area , Occlusion culling will not be applied . It is important to have a camera where the occluded area covers , But if the occlusion area is too large , It will lead to more baking expenses .
3. Occlusion Areas Applied to moving objects to be occluded .

Bake tab related settings

Smallest Occluder

The size of the minimum shelter : The smallest size that can block other objects , Anything smaller than this size will be obscured

Smallest Hole

This value represents the minimum gap between the geometry that the camera should see .

Backface Threshold

Unity Occlusion using data size optimization , Reduce unnecessary details by testing the back . The default value is 100 It is powerful. , Back faces are not removed from the dataset . The value is 5 Data will be actively reduced depending on the location with the visible back . The idea is usually , Effective camera positions usually do not see many backgrounds - for example , View below the terrain , Or views in solid objects that you should not be able to reach . Below the threshold 100 Under the circumstances ,Unity These areas will be completely removed from the dataset , This reduces the size of occluded data .

View the culled effect

After baking , Select the visualization tab , Then go to the scene , choice Visualize, You can see the effect of being eliminated

Whether to bake the occlusion elimination effect of terrain

Only the scene objects are baked , No baked terrain

This leads to redundancy drawcall

The following figure , The house is shaded by the terrain , But it hasn't been eliminated , So there is 4331 Of drawcall

After baking , The house was knocked out ,drawcall Down to 1419

Baking is a scheme that trades space for time

If the terrain is large , Baking occlusion culling data takes a long time , And the baking data will be relatively large

This may increase the memory footprint of the game

原网站

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