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?
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.
@Tim Hobson could you please elaborate a bit more what is considered bounds? I hope Unreal is intelligent enough to not tak pivot position when it is outside of tight mesh bounding box, eg using workflow with baking pivot. Eg my pivot is at level origin but my actual mesh might be offseted somewhere else. In this case is bounds of object what I can see in Static Mesh Editor once i toggle this option on? Thank you.
The pivot point is not considered for bounds (unless you’re using assets in a Blueprint where the bounds is much larger then!) speaking specifically about Static and Skeletal meshes. The tight bounding box is around geometry only. The box is used to then generate the sphere bounds that touch each corner of the box.
The bounds you see in the static/skeletal mesh editors is the bounds for the mesh. You can also view this in your editor by going to show > Advanced > Bounds.
With 4.13 and the introduction of the Preview Scenes, when you enable Bounds view you’ll also see the bounds of the floor mesh along with the sky sphere, which could possibly be misleading to you. Disable these from the Preview Scene Settings or just focus on your actual geometry.
This documentation is for Unreal Engine 3, but mostly holds true with UE4 with only a few of the viewmodes not working the same in UE4. The information contained within is still good though and may help you get a better understanding of the culling system.
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 PBF: Brief Overview of Occlusion Culling - YouTube 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.