Jump to content

Size for LOD is oversize for some worn items


animats
 Share

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

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

Recommended Posts

Here's something strange that may be causing excessive rendering work.

jacketlodstatsrezzed.thumb.png.112a5b713a828a48f012a0fdd1cb78ec.png

Leather jacket, rezzed on ground. Object radius 0.730, drops to medium LOD at 6.1m at LOD factor 2.0. Fine. Full detail only in close-up.

jacketlodstatsworn.thumb.png.ce7291f1cf9542d9b24fc6516b513828.png

Same leather jacket, worn. Object radius 2.659m, bigger than the entire avatar. Drops to medium LOD at 22.2m. 3.6x the proper distance.

Is it because it's an attachment? No. Fouette gave me this mesh cube LOD test. It's a cube with a different texture for each LOD, so you see which LOD is live.

cubelodstatsrezzed.thumb.png.685db45a4259b550a4ddbcd39b23f4c9.png

Cube on the ground. Cube is 0.2m x 0.2m x 0.2m. SL object radius is 0.173m, which is half the cube diagonal, or the radius of a sphere that would just enclose the cube. That's what it should be.

cubelodstatsworn.thumb.png.ea5df992c12febcb98c5ae8d88713a21.png

Wearing the cube. Same radius as when rezzed, as it should be.

So, wearing that jacket in a crowded club impacts 13x the area it should, the square of the overexpanded radius.

So why is this? Is that a bug, or is there some reason for this? What triggers the expansion of the radius? It's not just wearing something.

I'd previously thought that all attachments to an avatar operated at the same LOD. But they don't. We can see that with this test cube. Note that both the one on the floor and the one worn are at "Medium". (That cube shows its current LOD.) Worn objects do LOD just like regular objects. Wearables only stay at high resolution if their object radius somehow gets bloated.

  • Like 1
Link to comment
Share on other sites

1 hour ago, animats said:

So why is this? Is that a bug, or is there some reason for this? What triggers the expansion of the radius? It's not just wearing something.

It's one of the three Fitmesh LoD bugs.

Beq has a good explanation of it in this thread: https://community.secondlife.com/forums/topic/419469-rigged-mesh-lod-bug/

TLDR: When worn, the object radius of a fitted mesh is set to the same as the entire avatar regardless of its actual size. And to make matters worse, the render cost calculation does not take this into account so the render cost of fitted mesh is generally way off.

  • Like 1
  • Thanks 1
Link to comment
Share on other sites

Ah. Only rigged mesh gets this big radius expansion. Regular attachments don't get this error.

The design thinking seems to be that rigged mesh has no size; it gets its size from the skeleton to which it is rigged. How true is that? Most clothing that I rez in-world seems to be approximately the right size. Will rigged clothing in totally the wrong size properly stretch to fit? Probably not, since much rigged clothing comes as S, M, L objects. So if we use the rezzed "native" size of the object, that might work.

As Beq pointed out in 2016, there's a second bug; the system calculates the diameter of the enclosing sphere and sets that as the radius. That's why we see rigged items for human-sized avatars with a "radius" of 2-3 meters, instead of being around 1m.

How hard would it be to put a debug switch into Firestorm to optionally fix this? Then we can go to some clubs and fashion events and see what happens. It's viewer side, so it only affects the person using it. @Beq Janus?

  • Like 1
Link to comment
Share on other sites

27 minutes ago, animats said:

The design thinking seems to be that rigged mesh has no size; it gets its size from the skeleton to which it is rigged. How true is that? Most clothing that I rez in-world seems to be approximately the right size. Will rigged clothing in totally the wrong size properly stretch to fit? Probably not, since much rigged clothing comes as S, M, L objects. So if we use the rezzed "native" size of the object, that might work.

If you scale down a rigged mesh to a miniscule size, or a giant 64sqm, it'll always appear its proper size once you attach it. Only your shape and the length of individual bones can change how rigged mesh looks on you.

Edit: Yes, when talking about the effect of bone lengths, I'm talking about things like clothing which are rigged to more than one bone.

Edited by Wulfie Reanimator
  • Like 2
Link to comment
Share on other sites

9 minutes ago, animats said:

Will rigged clothing in totally the wrong size properly stretch to fit?

Yes. Many makers of fitted mesh use this deliberately as a cheat to make their product seem less render heavy than they are. Other do it unintentionally. If you look at one of my replies in that thread, you'll see a top that is only 1x1x1 cm in actual size yet it fits my avatar quite well.

 

11 minutes ago, animats said:

As Beq pointed out in 2016, there's a second bug; the system calculates the diameter of the enclosing sphere and sets that as the radius. That's why we see rigged items for human-sized avatars with a "radius" of 2-3 meters, instead of being around 1m.

There's a third bug too and that's the biggest one: Fitted mesh can often greatly increase the bounding box of the avatar. Beq shows it in her fourth post.

Unfortunately there is no easy fix for it. Technically it is of course possible to correct the LoD swap distances for worn fitted mesh to match the items' actual size or correct the render cost formula to show its actual render cost. But both solutions will break so much existing content so it seems LL has just resigned.

Link to comment
Share on other sites

Just now, Wulfie Reanimator said:

If you scale down a rigged mesh to a miniscule size, or a giant 64sqm, it'll always appear its proper size once you attach it. Only your shape and the length of individual bones can change how rigged mesh looks on you.

Not sure that's right. Thought experiment: you wrap a bracelet around a wrist, and rig it to only the wrist. Will changing the size of the avatar change the size of the bracelet? I don't think so. Something attached to two joints with weights will be stretched to fit, but only in the direction between the joints. I think.

I've done this for a rigged mesh waitress tray (the only way to attach things to animesh), and it kept the same dimensions regardless of the avatar.

Link to comment
Share on other sites

I still go with my theory of double scale transformation explained in that thread. The bounding box of a rugged mesh doesn't actually change when joints scale up or down, because its shape node is the one affected, not the transform node. So basically the object itself at 64 meters in every axis stays that size when rigged and worn, it's just the geometry that adjusts the vertices to the correct relative position to their influencing joints. Since the server and simulator aren't aware of avatar animation level events, visual transformations and looks, they both see the 64 meters attachment on the avatar as such dimensions and detect an extended bounding box conforming to that size. 

As far as I could be bothered to test, if you upload the same object twice, setting their sizes at different scale factors (centimeters and meters) as much as the same meter scale object rescaled down to be tiny, not only the render weight is lower, their bounding box on the avatar IS smaller AND LoD swap distances are different, because the tiny version doesn't bloat the avatar bounding box and therefore makes use of the right size. Still bugged for the aforementioned reasons, but to a lesser extent. 

Link to comment
Share on other sites

On 5/15/2020 at 4:46 PM, animats said:

After reading the above, need to try a test case. More later.

OK, now I get it. Rigged objects do stretch if the skeleton is resized, but only in the direction between the joints. You can demonstrate this (preferably in private) by putting on a close-fitting mesh jacket, going to "edit appearance", and turning the "Fat" slider all the way up. The garment will not enlarge in width. That's what you'd expect from the way rigging works.

So,  making tiny garments and expecting them to fit large avatars won't work. Thus, using the un-worn size of mesh objects as their size for LOD purposes doesn't open a way to cheat the mesh calculation.

It looks like the current value is double the radius of the sphere that encloses the entire avatar, for all rigged objects. That's just wrong.

I'd like to see a debug switch in a viewer that let you switch to a reasonable LOD radius for rigged objects, so we could see what it looked like.

  • Haha 1
Link to comment
Share on other sites

2 hours ago, animats said:

Rigged objects do stretch if the skeleton is resized, but only in the direction between the joints. You can demonstrate this (preferably in private) by putting on a close-fitting mesh jacket, going to "edit appearance", and turning the "Fat" slider all the way up. The garment will not enlarge in width.

Like this? (Wrong slider but anyway.)

https://puu.sh/FLqUg/5505a2091a.mp4

Edited by Wulfie Reanimator
  • Like 1
Link to comment
Share on other sites

1 hour ago, animats said:

You can demonstrate this (preferably in private) by putting on a close-fitting mesh jacket, going to "edit appearance", and turning the "Fat" slider all the way up.

Look what I'm willing to do for science:

bilde.png.4918f7a5f36aa532d85780b1a956066f.png

This top is 1x1x1 cm when rezzed (and that's the size that is used for calculating it's render weight) and as you can see, it follows follows the body shape sliders perfectly even at the most extreme settings.

I think you're confusing fitted mesh with old style rigged mesh, Animats, although it's possible that you'd get the same effect with fitted mesh if it has a very simple rigging.

 

 

  • Like 2
  • Haha 1
Link to comment
Share on other sites

53 minutes ago, ChinRey said:

Look what I'm willing to do for science:

 

Laughs :D. Um .. can I grab this opportunity to apoligise for almost landing on your head in that sandbox the other month. ? When you was making them amazing trees. My platform had been auto returned and I fell from the sky, it was not deliberate.

Link to comment
Share on other sites

10 hours ago, ChinRey said:

I think you're confusing fitted mesh with old style rigged mesh, Animats, although it's possible that you'd get the same effect with fitted mesh if it has a very simple rigging.

Right. I was testing with an old-style rigged mesh item.

Link to comment
Share on other sites

10 hours ago, rasterscan said:

Laughs :D. Um .. can I grab this opportunity to apoligise for almost landing on your head in that sandbox the other month. ? When you was making them amazing trees. My platform had been auto returned and I fell from the sky, it was not deliberate.

Aww, no problem. If I had an L$ for every time that had happened to me, I'd be rich by now. ;)

Link to comment
Share on other sites

16 hours ago, ChinRey said:

I think you're confusing fitted mesh with old style rigged mesh, Animats, although it's possible that you'd get the same effect with fitted mesh if it has a very simple rigging.

What is the difference? Weighting to collision volume bones vs. just original skeleton?

Also, this 1 cm³ rigged mesh -- I assume it's rigged to an equally tiny armature?

Link to comment
Share on other sites

5 hours ago, ChinRey said:

That's still an interesting and valuable test since it explains why these bugs weren't noticed earlier.

Yes, some descriptions of this problem say "rigged mesh", but only fitmesh gets fully resized in all directions.

If we wanted to compute the actual bounding radius for an attachment, how could that be done? Sphere that encloses all the bones to which the mesh is rigged? Don't consider joint rotations, just add up the relevant bone lengths in a tree fashion. That gets the worst case radius with all the limbs splayed out.

eeb0d66333ae3c2e048de40cd4049df9_large.p

Second Life bento skeleton. Humanoids use the green bones. Yellow are for wings, red for a tail, blue for a quadruped.

From the list of bones rigged, and their lengths, it's easy to compute a maximum radius. Shoes get a small radius, boots more because they add the lower leg, and pants still more. Bracelets and necklaces are usually tied to single small bones, so they get a small radius. Which is what we want to happen. How hard would this be to do in the viewer? Can a third-party viewer do this for test purposes?

 

Link to comment
Share on other sites

Took a look at the code in the viewer which does this. Looked in Firestorm sources.

Radius for level of detail purposes is calculated in llvovolume.cpp in  function LLVOVolume::getBinRadius. There's a special case for rigged mesh. There are comments indicating it's 2x too big for some historical reason.

// Volume in a rigged mesh attached to a regular avatar.
// Note this isn't really a radius, so distance calcs are off by factor of 2
//radius = avatar->getBinRadius();
// SL-937: add dynamic box handling for rigged mesh on regular avatars.

The calculation for a rigged mesh is to take the bounding box of the entire avatar and get its diagonal. This is twice the radius of an enclosing sphere, and comments indicate that twice is wanted.

(Object radius is displayed in the edit dialog in  llpanelobject.cpp in function LLPanelObject::activateMeshFields. This, interestingly, always displays the size of the avatar for any rigged attachment. That's separate from the size actually used for LOD calculations. This may be code that should have been changed when SL-937 went in, but wasn't. So, don't fully trust what you see in the edit box for rigged attachments.)

So, yes, if it's rigged on an avatar, its "radius" is the diameter of the sphere that encloses the entire avatar. Which seems to be why small attachments don't drop to a lower LOD at distance.

 
 
 

 

Link to comment
Share on other sites

19 hours ago, animats said:

Took a look at the code in the viewer which does this. Looked in Firestorm sources.

Radius for level of detail purposes is calculated in llvovolume.cpp in  function LLVOVolume::getBinRadius. There's a special case for rigged mesh. There are comments indicating it's 2x too big for some historical reason.


// Volume in a rigged mesh attached to a regular avatar.
// Note this isn't really a radius, so distance calcs are off by factor of 2
//radius = avatar->getBinRadius();
// SL-937: add dynamic box handling for rigged mesh on regular avatars.

The calculation for a rigged mesh is to take the bounding box of the entire avatar and get its diagonal. This is twice the radius of an enclosing sphere, and comments indicate that twice is wanted.

(Object radius is displayed in the edit dialog in  llpanelobject.cpp in function LLPanelObject::activateMeshFields. This, interestingly, always displays the size of the avatar for any rigged attachment. That's separate from the size actually used for LOD calculations. This may be code that should have been changed when SL-937 went in, but wasn't. So, don't fully trust what you see in the edit box for rigged attachments.)

So, yes, if it's rigged on an avatar, its "radius" is the diameter of the sphere that encloses the entire avatar. Which seems to be why small attachments don't drop to a lower LOD at distance.

 

This is well established and I raise it often at CCUG and other meetings. The chances of it getting fixed are however small as the amount of content breakage that would occur is significant because pretty much every mesh clothing creator out there know that adding LOD models is a pointless task and therefore does not do more than the minimum. 

You can see my original Jira on this matter here https://jira.secondlife.com/browse/BUG-40665

There are further twists and turns along this path such as https://jira.secondlife.com/browse/BUG-214736

As for the general behaviour where a rigged item is linked to the body scale rather than the item scale I personally think that this is the correct behaviour. At least in an ideal world. If items were to LOD swap according to their scale then we'd find that hands and feet would deform when seen from across the room, heads too perhaps, certainly not much further away. This is not desirable, you want your body to swap as one. However, while that makes sense in the general case for bodies it does not make sense for jewellery, having the wedding ring on your finger render at high LOD half way across the region is not useful to anyone. It is however where we are at the moment. 

 

 

 

Link to comment
Share on other sites

22 hours ago, animats said:

From the list of bones rigged, and their lengths, it's easy to compute a maximum radius. Shoes get a small radius, boots more because they add the lower leg, and pants still more. Bracelets and necklaces are usually tied to single small bones, so they get a small radius. Which is what we want to happen. How hard would this be to do in the viewer? Can a third-party viewer do this for test purposes?

individuals can that's the beauty of open source. Anything more than that is likely a breach of the shared experience rule, it is certainly something I would avoid in general. Offering  debug settings to override expected behaviour is a pth that has cost us all dearly, (look at the number of places you shop that still tell you that it is not their product that is bad, but you vewier settings).

That said, some TPVs give a middle digit to the lab and do take things into their own hands. These tend to be viewers that have a specialist or niche market and thus sail under the radar; viewers that have a larger user base however get called to account far more strenuously than others.  

What I would say is that your theory seems very human biased and anything that assumes proportions derived from a human form is not reflective of a lot of the edge cases in SL. Creators repurpose bones all the time, while there are limitations (you must retain the hierachy, bones do not have to be located in human form.

 

 

Link to comment
Share on other sites

On 5/18/2020 at 2:21 AM, animats said:

From the list of bones rigged, and their lengths, it's easy to compute a maximum radius. Shoes get a small radius, boots more because they add the lower leg, and pants still more. Bracelets and necklaces are usually tied to single small bones, so they get a small radius. Which is what we want to happen. How hard would this be to do in the viewer? Can a third-party viewer do this for test purposes?

I agree with Beq in regard of the bias towards humanoid shapes. Even though the vast majority of users project theirselves into a human avatar, this shouldn't make anyone forget that there are plenty of uses for joints relocation that aren't bound to human centric uses. 

That said, I would love to see a change where the actual radius is being used, but only after an actual volume box is recalculated to reflect the true size and shape of the worn avatar. As a 6meters long quadruped, I hate to see the whole body go through walls when I rotate or walk through a door, colliding with something only when the human capsule is being touched. 

Link to comment
Share on other sites

I have just created a new feature request. This is not the answer we want, there are all kinds of holes in the thinking, but perhaps it can start helpmove things forward.

Here is the Jira https://jira.secondlife.com/browse/BUG-228780

The basic premise is that while we acknowledge that too many things are being drawn by the viewer and this has a significant impact on our performance we are caught by old bugs and old content that was unaware that they were even bugs. By creating a small number of "safe slots" we can introduce more aggressive and correct rendering behaviour while allowing users to select certain items to retain. I have suggested a single attachment point with a limit to the attachments but it can of course be implemented in other ways, concerns about stacked attachments are valid still. I picked 5 as a somewhat arbitrary number but it seems plausible. A typical human could safeguard their head hands and feet (the bodies ought not really need it they have the large volume to stay whole longer already. in non-humans the bodies tend to be in a few parts only too.

As the Jira says, it enables the user to fix their own problem and choose which items in their outfits to protect. I have no doubt it will cause untold cries and I do fear for the poor viewer support teams that would have to explain such a scheme, but if we want to get good, consistent rendering performance we need to stop sending so much unnecessary crap to the pipeline.

In discussing this with my partner Liz (@polysail) her concern is that by fixing this we encourage other bad behaviours. I don't doubt that. As consumers we demand levels of detail and fidelity from our creators that require abuse of resources (over use of large textures, high detail meshes rather than materials, etc. ) and at the same time whinge and moan at the viewer support when our viewers run slow. We all need to accept some responsibility here.

  • Like 1
Link to comment
Share on other sites

You are about to reply to a thread that has been inactive for 1409 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...