Stream: brlcad

Topic: mesh in comb with matrix


view this post on Zulip starseeker (Dec 15 2023 at 18:00):

@Sean seeing something surprising and could use your insight. When working with meshing in Goliath, I was seeing dark meshes that appear to be due to the faces being flipped. After a lot of digging, I boiled down a case independent of the meshing itself: http://brlcad.org/~starseeker/oflip.g

What I'm seeing - both of these combs are using the same BoT solid, and placing it in different locations via matrices. One of them shows the correct orientation in space, but the other is inside out. The only thing I can figure is that the matrix is turning the mesh inside out when its being read in during the tree walk, but a) should it be able to do that at all and b) if that's OK, shouldn't we be detecting it somehow and flipping the orientation flag for the internal representation?

view this post on Zulip starseeker (Dec 15 2023 at 18:50):

The value that turns it inside out is element 5 (counting from 0-15) in the matrix (-1 is inside out vs 1 being normal)

view this post on Zulip Sean (Jan 09 2024 at 15:57):

@starseeker That sounds like a reflection matrix.

view this post on Zulip Sean (Jan 09 2024 at 15:57):

I'm guessing introduced by the mirror command or some similar procedure.

view this post on Zulip Sean (Jan 09 2024 at 15:58):

I do believe the ray tracing path handles it correctly already just because there's a bit of code both in the boolean evaluator and in the ray tracer that detects when normals are going the wrong way and they get flipped on the fly.

view this post on Zulip Sean (Jan 09 2024 at 15:59):

For facetization, though, that is a conundrum. I would probably expect the tree walking code to detect it -- since that's where the matrix is defined and applied. NOT flipping the orientation flag as the primitive itself is not flipped, only the instance via comb.

view this post on Zulip starseeker (Jan 10 2024 at 20:39):

That's more or less what I ended up doing - at least for the Goliath test case, I did get facetize to work. However, there is an issue with that matrix and BoT primitives for raytracing - IIRC the CSG version of that comb does raytrace, but replacing it with a BoT geometry it vanishes.

view this post on Zulip starseeker (Jan 10 2024 at 20:42):

https://github.com/BRL-CAD/brlcad/commit/38c20325acac1e4192199b63866e9ad0d4a2b564 commit comment has more details on which part of Goliath in what configurations triggers the issue.

view this post on Zulip Kampanat Thumwong (Jan 24 2024 at 17:26):

starseeker said:

https://github.com/BRL-CAD/brlcad/commit/38c20325acac1e4192199b63866e9ad0d4a2b564 commit comment has more details on which part of Goliath in what configurations triggers the issue.


Last updated: Oct 09 2024 at 00:44 UTC