Find all visible spatials

Hi

I need to get all visible spatials on scene. Visible in this case means that at least one pixel on screen belongs to this spatial.

Additional info: game has first-person camera and all spatials I need to check are billboards (camera-oriented quads like in Doom).

I’m not proficient in game enignes but as I know, there 3 steps where game engine “filters” geometry (by the way, is it correct to call all these things “culling”?):

  1. hide all that outside of camera frustum
  2. hide all backfaces (most likely it’s done on GPU, but backfaces are not critical in my case)
  3. hide all triangles that are obscured by another triangles

So looks like, engine is already does all I need every frame. Is there a way to ask engine which triangles wasn’t filtered out last rendering frame and identify Spatials associated with them?

Alternative - raycasting, but that must be much slower and I’ll need to perform some accuracy decreasing heuristics to make it fast enough… and it’s already done by engine, so I do not like this approach.

Also, maybe there are another approaches?

The engine only does 1. Everything else is handled by the GPU.

2 Likes

Thanks for clarification! That’s sad… idea seemed so powerful :frowning:

Note that in a typical rendering setup the GPU will do backface and occlusion culling (though the latter is done by fragment/pixel, not by triangle). You could achieve what you wanted with occlusion queries. My understanding is that they’re not entirely supported by the engine at the moment, but possible to do with some extra work on your part. Some others here on the forums have done some work with them, so I suggest searching the forum for “occlusion queries” and see what comes up - that should give you a starting point and some background info, at least.

2 Likes

looks very relevant. will read more about it. thanks for hint!

1 Like