Saturday 25 August 2018

Why did my LI just explode, I only linked in two simple prims?

Another tale from the tavern

The long-suffering bar staff at the builders' tavern can share many a tale heard over the sobs of a builder, driven to drink by the seemingly implausible accounting of Second Life. One of the more common tales is "the case of the lunatic link set". There are a few variations on this tale, but the underlying story remains the same.

TLDR; 

Too lazy to read? Simple summary, when building link sets of prims be wary of mixing "new" features and the potential knock-on effects on seemingly innocent prims.

Once upon a time

Our happy builder starts his day merrily slinging prims as he builds a new home. Carefully avoiding linking any meshes to the link set (he's been caught by that before) he finishes around midday, and step back to look at his pretty little 28LI home. He muses over the building as he nibbles a cheese and pickle sandwich.

"You know what?" he says to himself, "it's just missing that little something extra. A little finesse on the front porch."

Putting aside his lunch, he quickly knocks up a couple of simple decorative columns from cylinders, popping on a normal map to give them some nice fluting, he links them into the build. 30LI, very nice, but the columns look unfinished and then he realises, they need a base and capitol. He quickly whips out a couple more prims, one torus top and bottom of each, 4LI extra, still a decent count for a prim house. He links them together and carries on working, it isn't until he stops for a tea break in the afternoon that he looks up and sees that his house now has an LI of 290.

In shock and denial, our builder paces up and down scratching his head. He checks every link in the link set, no meshes, not even a sculpt, (he never really trusted those). He unlinks and relinks, changes colours (cos why not?), restarts the region and moves to another sandbox. So distracted, in fact, that he lets his cup of tea go cold. In frustration, he downs tools and heads for the tavern.

So what is it that drives up the LI and the profits of virtual pub landlords?

He recounts the tale to the ever-patient barmaid. Explaining that he checked every single prim in the build, unlinked the entire thing and reassembled it, no single part has an LI more than 1 and yet when the 34 prims are linked the LI is many times more than the sum of the parts.

The barmaid smiles and pulls him another pint.

"You've used materials, 'aven't ya m'dear?", he blinks, she looks at him; "That'll be 2 Lindens please"

"What? oh!" He pays for the beer, "yes, yes, I used a little normal map, gives these lovely fluted effects to the columns, but even with the normal map those are only 1LI"

"Aye, but I bet you've got some toruses in there, right?" He blinks again, she's not wrong, but what on earth has that got to do with anything.

"I do, of course, but I checked them they are only 1LI too"

"Go back and look again, but look closely this time." She writes a little note on the beer mat, it simply says "Ask for more info"

Back to work

Somewhat puzzled he heads back to the cottage and once again starts to look through the prims, all at once he notices the "more info" link hidden on the object details.


His toruses are costing him 72 LI each, or so it says, but he checks again and sure enough, it says 1LI, what is going on? All of a sudden a distant memory comes to mind. It's not just Meshes that cause the LI to go mad. It's other stuff too... He hunts around and finds a long forgotten post on the community notice board.



The builder stares for a moment, taking in the new information.

"So," he muses, "the normal map on the cylinders may have seemed innocuous because their cost never changed, but it forced the entire link set to use the modern mesh accounting, which means that my pretty torus plinths are costing me a fortune because of the number of tiny triangles." Reinvigorated by new knowledge our builder hero, edits the link set and carefully sets the physics shape of the 4 toruses to be "none" eliminating the physics overhead, reducing the load on the physics engine and making the world a better place in all ways,.

And they all lived happily ever after...

Until the following morning, when while glazing the windows, the builder chose to use alpha masking (because it's better all round right?) and was later found sobbing into another pint of Builder's Bane.


Afterword

The moral of this story is that any link set that uses a post-2011 feature such as mesh, materials or alpha masking will remove the legacy prim accounting cap from the entire link set. The most common case is linking to another Mesh but be aware it is more nuanced than that, as our merry builder friend discovered. Take heart though, all is not lost, you can use those whizzy new features, just take care to minimise the side-effects. Often this means you just need to find the culprits (the firestorm "show physics shape" can help here) and set their physics to none.

No comments:

Post a Comment