Thursday, September 20, 2018

Feature: Visual Size Display in Appearance Editor

One of my very first posts was about avatar size. It's an issue that's been around since the beginning of Second Life.

 After a discussion with Vir Linden at today's Content Creation group meeting, I've submitted a Jira requesting a new feature for the SL appearance editor.

(Everything below just recaps everything already in the Jira.)

 I submitted a Jira in 2011 pointing out that the height currently displayed in LL's viewer is incorrect. Like, not even close to your avatar's actual height. Unfortunately, there are some problems to consider here:

  • Deformers and attachments can alter an avatar's size in ways the viewer and server cannot account for.
  • SL's own broken existing system for checking an avatar's size is tied to too many other features to be fixed this late in the game.

So rather than fixing the inaccurate height currently display, why don't we just get rid of it entirely and use a visual scale. An inworld overlay just like the object editor uses.

Put height information right there, next to the avatar.
This completely circumvents the issues that make fixing AgentSize impossible, and it works for all avatars, even those who use attachments and deformers to alter their avatar's size.

But why even worry about this?

It's a visual design issue. 

When creating any content in Second Life, from a house to your own avatar, it helps to have this information in front of you otherwise you end up with visual inconsistencies that negatively impact how good Second Life looks and how you interact with your environment.

It is also a content creation issue.

 Nearly all content creators use their own avatar as their sole point of reference for scale when creating content. This is true whether you're talking animations or houses. This can result in houses where the windows are way above the average avatar's heads, or staircases where each step comes up to their knees. Or animations created for specific avatar sizes but incorrectly labeled when sold due to the existing confusion.

We see problems like the above every day in Second Life. Fixing this now would lead to generally better consistency for new content going forward.

Monday, September 17, 2018

Optimization Tutorial: Creating Your Own LOD Models!

Creating Your Own SL LOD Models


Before we begin, this is not a "how to learn Blender" tutorial. You should already have a basic grasp of Blender to get the most out of this tutorial. If you're looking to learn how to use Blender, there are many of those tutorials online which already cover that topic better than I ever could! If you're a Blender Beginner, or someone who has never even touched Blender before, then I recommend "Blender for Beginners" by Blender Guru. It's a super friendly, super easy to follow tutorial that will have you creating your own mesh content in no time!

A lot of SL users are worried that if Linden Lab ever attempted to reign in unoptimized content, it might push content creators away. So beginning today I want to start showing  you just how easy optimization is. The first thing we're going to look at is creating your own LOD models using this milk can model I created.

What is LOD?

 "LOD" stands for "Level Of Detail", it's a trick game engines use to reduce the rendering load by swapping out your close up, high detail models, with increasingly lower poly models the further away the object is.

Bonus Tip: Smaller items transition to their lower LOD states over shorter distances than larger items, which is why mesh uses less Land Impact when you shrink it! Smaller objects are easier to render!

 Of course, in Second Life LL provides the option to let the mesh uploader automatically generate LOD models Unfortunately it's not very good at this, leading people to try and use their highest detail model for High, Medium and sometimes even Low detail settings, while sacrificing Low and Lowest to offset the LI increase. The results are not pretty, worse yet content creators often tell customers to increase their object detail to compensate for the poor LOD of their creations.

At Medium detail, the uploader generated model is already falling apart!

No Second Life user should ever need to set their Object Detail up higher than 2.5-2.75. When you tell others to increase their object detail to see your work properly, you've done something wrong and you're basically telling them to sacrifice their FPS to cover for it.

 But this does not mean you're stuck with awful pre-generated LOD models, or forced to increase the Land Impact cost of your content! SL also gives you the option to upload your own LOD models!

Nearly half the triangles and it still looks great!
 Done well, no one will even notice the transition between detail levels! Here's my milk can at every Level of Detail!

It more or less holds it's shape until the lowest LOD when it becomes a box. And that's fine because at Low and Lowest levels the milk can will be far enough away that you shouldn't notice that it's beginning to lose it's shape.

 And if you're wondering, the Land Impact cost of the milk can is 0.5, meaning you can link two together and it will still only be 1 LI.

Creating Your Own LOD Models

How much extra work is it to create your own LOD models over letting the mesh uploader generate them for you? Not nearly as much as you might think. Let's hop over to Blender to see how it's done!

1. I started here, with my full detail model.

2. In Edit mode I make sure no vertices are selected to start. Then, holding down the Alt Button I begin selecting vertices down a line, until Blender selects the full line of vertices I want. Blender can be finnicky, and it might take several tries before the row you want is selected. Just keep holding Alt and clicking on vertices along the row you want.

I decided to start vertically, the blue line shows the vertical row of vertices I've selected. This row of vertices is called an "Edge Loop".

3. Now I press the X Key to bring up this menu shown below.

See at the bottom where it says Edge Loop? That's what we want. (Dissolve Edges can also work, but sometimes leaves stray vertices behind.)

4. Selecting Edge Loop removes the entire row of vertices but leaves the model itself intact. (As opposed to deleting triangles or vertices, which would have left an enormous hole down the side of our model.)

5. I did this all the way around the model until I'd deleted half of the edge loops. Then I did the same to the two small side handles. This effectively cut the triangle count of the model in half while retaining the overall shape.

 That gave me my Medium LOD model. As a rule of thumb, you generally want each LOD level to be about half of the one before it. That's not a hard rule, of course. Use your judgement.

 You can do horizontal Edge Loops, too! Which is how I reduced the can further for my Low LOD model.

Hold Alt, select vertices until the row you want is selected, then hit X to bring up the delete menu.
Delete the edge loop to simplify the model.
Again, use your judgement! This is what separates you from the automated LOD generator. Where can you remove details that won't be noticeable at that distance? Again, keep in mind that larger objects will retain their higher LOD levels over greater distances. It may even take a little trial and error before you get the hang of it, but once you do then creating your own LOD models won't take long at all! It only took me minutes to create the LOD models for this milk can.

Physics Bonus!

As an extra benefit to handling LOD this way, when setting up the physics for your mesh object you can use one of your LOD models as the physics box, which can result in a yet lower Land Impact cost than using Mesh Uploader model generator.

 And there you go. That is all there is to creating your own LOD models for Second Life. Now get out there and start creating content that doesn't fall apart the moment someone moves a few feet away from it!