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?
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.
The only way i can think of is using rays.
I think I can make that work with rays. I’ll give it a shot. Thanks!
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.
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.