Raytracing / Visibility problem

Hi everybody!

I am trying to use raytracing to know if a node is visible from a specific position. Now I am using maxscript "intersectRay" function. The problem is that it only takes into account 2 objects, if I want to know if B would be visible from A but there are other objects (C for example) in the middle which occlude B, they will be omitted from calculations.

Is there other way I could use raytracing that told me if the ray really arrives to the point I want to check or if it intersects with something in its way??

I hope I made myself clear,

Thanks in advance.

Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
miauu's picture

.

Fire the ray and test if it intersets all nodes in the scene. When the intersection is TRUE, collect the object, then compare the distance between the ray starting position and the nodes, that the ray intersect. You can find where node B is placed. If you have node C which is closer to node A than node B then node C occludes node B.

eduilnero's picture

Hi miauu, It sounds quite

Hi miauu,

It sounds quite good although a bit expensive to process. One main problem with this approach is that what I do to detect visibility is throw 3 rays (one for the center and 2 for 2 of the bounding box corners) according to how many hits I get I tag the object as visible or invisible. So it may be even more expensive because scenes are quite complex.

Thanks you for your help.

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.