How does object occlusion and culling work in UE4?
Hey everyone! I am still relatively new to Unreal 4 and I was wondering if someone here can either explain in detail or point me to a good learning resource for how object occlusion works in this engine? I have not been very successful in finding any info on how it works or how to set it up. What little I have read makes it seem like it is an automatic system? If that is the case it is not working for my scene. I want to occlude objects with other objects ( i.e. objects that are compleatly hidden behind a wall should drop out and not render for one example ) Is there a setting that needs to be enabled to make object occlusion work? In older versions of Crytek, and other proprietary engines I have used, artists place occluder meshes inside of their static assets so that when assets bounding volumes are totally obscurred by the occluder mesh, they don't draw, or they can also place occluder helpers in the scene that occlude everything behind them. Does UE4 have anything similar to this? Is there some kind of volume that can occlude objects behind it? I am at a bit of a loss on how to get objects behind walls to not draw. I tested if this is automatic by running the game in the editor then viewing in wireframe and I can see that everything is drawing, so if it is supposed to be automatic, then it doesn't work, unless testing in wireframe is not the correct way to do it??? Is there a way to capture the camera's frustum and see what is being drawn?
Any help would be most appreciated.
Thanks - Jason!
asked Oct 03 '15 at 07:15 AM in Rendering
Unreal Engine 4 uses an automatic process for culling that uses Scene Depth and the bounds of an object.
When using the Wireframe viewmode, this is not a good method for testing if an object is occluded in UE4. You can use the (Editor only) console command r.visualizeOccludedPrimitives 1 to view the occluded objects. This will render a green bounds box for any objects that are occluded. Adjusting the bounds scale will increase the green bounding box and can cause the mesh to be rendered even when it's not in view.
In the project settings you can disable Occlusion Culling completely if you need, but in most cases this is not needed.
There is an alternative method of occlusion in the engine that is not on by default. It's less strict than the currently default method. You can enable this by using the console command r.HZBOcclusion 1
This uses an approximation with occlusion culling. It will occlude the mesh dependent more on size and bounds scale than strictly on bounds scale. This can be useful in some instances, but problematic in others where it would cause meshes to be rendered that you wouldn't necessarily wan to be when hidden. This is largely why it's not on by default at the moment.
Using the first console command above is the best solution right now for debugging what's being occluded and what's not for the time being.
I hope this helps.
answered Oct 05 '15 at 03:37 PM
Tim Hobson ♦♦ STAFF
This went over my head, Im more of a visual learning. Only thing I figured out was activating the Bounds. I hit play viewing the other viewports. I didn't see any meshes disappearing. I feel like this is a subject that is lacking. I can't find any videos for Unreal on setting up good optimization with occlusion culling. Unity has tons of info and video on this. I finally found this vid https://youtu.be/6MhsdwTW3SQ I would like to it go in depth with custom created meshes on setting up scenes when moving from area to area on how that works.
answered Jul 29 '17 at 12:55 AM
Follow this question
Once you sign in you will be able to subscribe for any updates here