Check if an actor is really rendered


I’m searching for how to know if an actor (or primitive component) is rendered or not. I’ve tried to check last render time but it doesn’t seems to work with occlusion culling. I made a quick test in blueprint with WasRecentlyRendered method but it returns true when actor is occluded. I also checked if it was really culled and yes, after freezing the rendering, I focused the actor in level, it was not visible.

Someone has any idea ?


Would also really love an answer to this question. am currently line tracing which is hardly good enough and still inefficient.
This info should be available inside the engine. What would it take to expose it?

Finally found, but I forgot to update my question.

Use LastRenderTimeOnScreen instead of LastRenderTime on a primitive component.

Here a function I wrote to know if a primitive component is visible:

* Returns true if this primitive component has been rendered "recently", with a tolerance in seconds to define what "recent" means.
* e.g.: If a tolerance of 0.1 is used, this function will return true only if the primitive component was rendered in the last 0.1 seconds of game time.
* @param Tolerance  How many seconds ago the actor last render time can be and still count as having been "recently" rendered.
* @return Whether this actor was recently rendered.
bool UMETA_BlueprintGenericNodes::WasPrimitiveComponentRenderedRecently(UPrimitiveComponent* _PrimitiveComponent, float _Tolerance)
	if (_PrimitiveComponent == nullptr)
		return false;

	UWorld* World = _PrimitiveComponent->GetWorld();
	return (World) ? (World->GetTimeSeconds() - _PrimitiveComponent->LastRenderTimeOnScreen <= _Tolerance) : false;