Jump to content

Are degenerate faces safe to use for offsetting the mesh bounding box?


Frionil Fang
 Share

You are about to reply to a thread that has been inactive for 626 days.

Please take a moment to consider if this thread is worth bumping.

Recommended Posts

Example scenario: I want to have a sphere with its center of mass far from the bounding box, so it can be neatly rotated that point without any extra math and scripting.

So far my solution has been to assign tiny triangles using an entirely different material to define the bounding box area, which get set to 100% transparent in SL. This has the downside of requiring a new texture face, and despite being tiny, the faces could still end up visible in some circumstances.

I've heard of tricks of using degenerate faceless geometry (loose vertices, loose edges, or triangles without a face) to offset the bounding box, but the uploader swallows all of those completely and the bounding box snaps around the true geometry, so if that ever worked it doesn't anymore and I could've just misunderstood it having been possible either way.

Degenerate faces do seem to work (tested both a triangle with 2 vertices sharing space = 1 edge with no length, face with no area, and 3 vertices sharing space = 3 edges with no length, face with no area). The uploader is not entirely happy about it (using Firestorm): the physics model will complain either about triangles that are too small or just throw a MAV_WHATEVER_FAILED error at you until you analyze it, after which the hull-based physics model will be snapped exactly where it should be, and the uploader doesn't have any further objections.

So that brings the crux of the question.. are there some complications I should expect, and is this the method the curiously offset bounding boxes I sometimes see are accomplished? From my experiments I can't ever get the degenerate faces to glitch into visibility regardless of texture settings or using wireframe rendering or whatever, and if physics is set to "prim" type, the collision model is correct -- using "convex hull" obviously drags a convex hull spike towards the degenerate face, though. As a curiosity, a degenerate face that does have edges with length > 0 will be shown by the selection highlight, unlike the completely dimensionless one.

Link to comment
Share on other sites

The chances are that if that works now, there's no guarantee that it would work in future viewer versions (for example, viewers that implement MeshOptimizer may strip out degenerate triangles completely).

To put it in the words of LL engineers: "tweaking the dial until it works" isn't seen as content worth maintaining.

There is work going towards implementing custom pivot points, although I'm not sure where that project is, but has been mentioned a couple times as of late. That is the safest bet for what you're going for.

Edited by Jenna Huntsman
Link to comment
Share on other sites

Hm, breaking existing content that was generated with "illegal" methods doesn't seem likely to me (animations with excess priority, mesh rigged to illegal bones and megaprims still all work even if they can't be generated from scratch) and what I was mostly wondering if there are any currently existing sneaky complications anyone would know about -- if a future version of the uploader refuses that geometry, fine, I have other options. Though you're probably right, maybe it's safer to just stick with the "tiny non-degenerate triangles of a different material" when possible as they're guaranteed to stay valid either way.

Link to comment
Share on other sites

44 minutes ago, Frionil Fang said:

I've heard of tricks of using degenerate faceless geometry (loose vertices, loose edges, or triangles without a face) to offset the bounding box, but the uploader swallows all of those completely and the bounding box snaps around the true geometry, so if that ever worked it doesn't anymore and I could've just misunderstood it having been possible either way.

This still works if you use a loose vertex, but it has a catch. The first vertex won't be "swallowed" even if it's loose, so you can make it work by selecting the loose vertex and then sorting all vertices before export.

Personally I use loose triangles with zero area.

  • Like 1
Link to comment
Share on other sites

20 minutes ago, Wulfie Reanimator said:

This still works if you use a loose vertex, but it has a catch. The first vertex won't be "swallowed" even if it's loose, so you can make it work by selecting the loose vertex and then sorting all vertices before export.

That's probably along the lines I've heard before, and just forgot the crucial details. Still neat to know!

Link to comment
Share on other sites

Answering your questions in the wrong order:

1 hour ago, Frionil Fang said:

is this the method the curiously offset bounding boxes I sometimes see are accomplished?

There are four ways to offset the bounding box of a mesh in SL and this is one of the three most common.

1 hour ago, Frionil Fang said:

are there some complications I should expect (?)

As Jenna said, it's possible it'll stop working for new meshes in the future but it's extremely unlikely this will affect meshes already in SL. The locations of the vertices within the 1x1x1 m nominal bounding box is determined and fixed during upload so changing this for existing content would mean to reanalyze each and every mesh in the database. I can't for my life imagine that'll ever going to happen.

  • Like 1
Link to comment
Share on other sites

You are about to reply to a thread that has been inactive for 626 days.

Please take a moment to consider if this thread is worth bumping.

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
 Share

×
×
  • Create New...