Optimization: not bothering to render objects outside of viewport?

Hello.

I have a sort-of top-view game, around 40 degrees from a kilometre up (in UE4 units) in the making. It will be populated with many NPCs.

Is there some sort of optimization present in UE4 for not wasting time rendering objects that are not visible on the viewport? Or do I have to manage this myself ?

Animation and a host of other calculations for these “absent” characters could benefit from a “Don’t bother” flag until they show themselves into the viewport.

Do I set up some giant collision box that matches my viewport and set up OnBeginOverlap() and OnEndOverlap() to monitor their movements ?

Hi DrHobo,

Objects not in the viewport are automatically culled out to keep FPS high. You can go a step further though and edit this yourself in the detail settings for the objects that are in the viewport (more often done with foliage, like Grass) by setting a minimum and max distance that this should render from the camera.

Tim

Thanks for the reply.

Cool. That’s one less thing to worry about :slight_smile:

But is there some callback or variable that I can check as to whether or not the object has been culled out ? Basically, I like to add some details in the HUD about those characters (and not with a Billboard Text Render! While their appearance / disappearance would be solved automatically with the aforementioned culling process, it’s uglier, aesthetically, than straight text rendering in the HUD as the latter isn’t warped by camera perspective).

My game is in C++, so maybe I could probably check some flag in the UObject parent class to access this information ? Currently, I’m just checking for overflows / underflows while rendering to the screen (if posX < 0 or posX > screensSize, that sort of stuff).

Regards.

AActor is the subclass for all objects that appear in the level, so you can start looking there to see if the info is there.

You can iterate through all objects of a class with builtin search functions. Seethis wiki postfor some of the details