Object Obstruction Detection

Hello,

I am trying to detect whether an object is partially obstructed by another object on screen. Is there an easy way to do this?

There are many ways. Could you explain a little more? What are these objects? Do you intend to use a physics library? How and why are they colliding?

Edit: i may have mis-interpreted. Do you mean one is in front of the other?

I’m trying to determine whether a pedestrian model is partially visible from the perspective of a specific camera (ie. blocked by a car). The objects are not colliding.

1 Like

The only way i can think of is using rays.

1 Like

I think I can make that work with rays. I’ll give it a shot. Thanks!

1 Like

If you need the informations if any pixel from your model is visible and you are a bit into opengl you can render the person the car and use a query object with the ANY_SAMPLES_PASSED target.

https://www.khronos.org/opengl/wiki/Query_Object

Depending on the application, it could be done on the GPU using a technique similar to shadows, render the scene depth from the car perspective, then when drawing the pedestrian, checking against the depth buffer.