Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Igor_Igor
Beginner
80 Views

Using BVH for other task

Hello

A bit side question, sorry if it's misplaced. I need to find all polygons intersections in scene with some "gap", e.g. if an edge is closed enough to a poly - count this case as intersection too. A code to check polygon/polygon intersection is not a problem, but which to which polygons I have to check? Can I use Embree BVH data structures for this? If so how?  

Thx

0 Kudos
5 Replies
SvennW_Intel
Moderator
80 Views

You could use the User Geometry feature for this. Create some user geometry that implements the proper polygon intersection and returns bounds enlarged by the "gap" to Embree.

Igor_Igor
Beginner
80 Views

Hi, Sven

Can't figure out your idea. Yes, I can create some UserGeometry but whay to do with it then?

Thx

SvennW_Intel
Moderator
80 Views

Using the User Defined geometry feature you write the ray intersection function for some primitive. Best look at the Embree tutorials to see how this works. You just have to calculate bounding boxes are that slightly larger than your polygons (such that Embree will also try to intersect them is they are some gay away of the ray) and pass your special ray/polygon intersection function to the User Geometry primitive.

Igor_Igor
Beginner
80 Views

Hi, Sven

Sorry, still unclear. Let me explain what I need with images. On first all walls are "good", poly edges are match in all places of walls contact. On second one the far wall (blue wireframe) is "bad" because there are no such edges on other walls. So I need to triangulate some red and green triangles to create needed edges. There is a some "gap". For example if bluе wall is slightly moved up I still need to break red triangles (if distance to floor is less than gap).

Anyway for potenyially large scene I need a data structure like bvh to detect which polygon breaks which. Thus I want to use Embree bvh - but don't know "how"

Thx

SvennW_Intel
Moderator
80 Views

Ok, therefore you need to build your own data structure that can find neighboring triangles or edges. Using the internal Embree data structures is not easily possible.