Can I know whether some actor is rendered or not?

Can I know whether some actor is rendered or not?
I tried AActor::WasRecentlyRendered, but it only takes into account the frustum for code based optimization purposes. It isn’t the same as occlusion culling.

I want to know whether some actor(or capsule) is totally occluded by geometry or not.
LineTraceSingleByObjectType can check only point to point.

Thanks.

WasRecentlyRendered does work with objects being occluded by other geometry. But is does not work on a visual way- What the engine does to occlude geometry is checking its bounds (which is generally bigger than the objects themselves). Is very possible that the function is not working as you intend it to work since the bounds of the objects are still visible for the camera and hence actors are still rendered.

What you can do is place a collision sphere with the same size of the bounding sphere of an object, get the closest point to the camera on that collision, trace to it (if you hit it, the bound is still visible, from that same point trace to the center of your mesh, if you dont hit it, its probably occluded). Obviously the more traces you make against an object the more precise the result will be, but due to the way the system works ther is no cheap fast way of doing it.

Do you need this information at runtime? If not you could just use renderdoc to analyse any rendered frame. You could than see if the actor is rendered or not.

Otherwise you can use the console to “freeze rendering” and then move around with your pawn. If you do not see it then the actor was either culled or occluded.

Now I’m not sure but maybe you could try using a UE_LOG maybe somthing like auto MyActor = GetWorld()->GetActorLocation().ToString() UE_LOG(LogTemp, Warning, TEXT("%s is location"), *MyActor) in the actors c++ file