Friday, January 19, 2018

Better SL Living Through Modding - CRAnQ Scrapper's Retreat

I do a LOT of modding. It's safe to say I have modded every modifiable item I've ever purchased in SL, and so I'm going to be posting a series of articles where I showcase some of the items I've modded, how I did it, and what the benefits were!

This first article features a wasteland shack in a sim I was commissioned to build. It's the Scrapper's Retreat from CRAnQ. A gorgeous looking piece, but out of the box it has a few problems. Namely, it's 241 LI cost and the fact that it uses about 360MB of VRAM in textures alone.

 Up front I want to say that none of this should be taken as a negative view of the creator's work. It's a gorgeous looking building and, sadly, these issues are not widely discussed in SL's content creator community so a lot of people simply don't realize they're issues at all. What you should instead take away from this the awesome thing CRAnQ did, selling the building with modify perms! That is what allowed me to take this great wasteland piece they put together and make it even better, and I thank them for giving me that option.

 In addition, I hope that if they see this article they are able to see what I've done, see how it improves the SL experience, and are able to work these improvements into their future creations!

Reducing Land Impact

 Now, Land Impact cost is easy to understand for anyone who owns or rents land in SL. You only have so much so you want to reduce LI wherever you can so you can fit more content and more detail in your sim. Luckily, this shack is copy/mod so I was able to do exactly that, and easily!

 First, the shack comes with an array of light sources. They're scripted and add a really great effect but a nearly identical lighting effect can be achieved by replacing the 40 light projectors with 4, and giving the side projectors a light map that mimics multiple sources. (Maybe I'll show how to di this in the future!) I went the simpler route for now and just got rid of the light projectors and did some simple local lighting, but recreating the original light effect is on my to-do list.

 Second, the lightbulbs strung along the side were each individual objects. Even worse, they're sculpted prims! If you're not aware, each sculpted prim costs 2 land impact points when linked to mesh! I replaced those with a string light mesh I bought off the marketplace. Took seconds to swap them out. Saved a bunch of LI. In addition, the wall mounted lamps on each side of the roof used a prim sphere overtop a mesh lightbulb, possibly because they didn't know how to script fullbright/glow changes to only the lightbulb part of the lamp mesh. I got rid of the prims and just set the mesh bulbs to glow manually.

 All of this means I lose the scripted lights on/off feature but I don't really need it.

 Next, I realized that by setting the entire building to "no physics" and replacing the physics with an invisible shell of box prims set to "convex hull" I was able to save yet more land impact.  This doesn't always work, but it works often enough to give it a try and here it ended up saving me a tonne of Land Impact points.

 And finally, the building was way too large so I shrunk it down to proper scale for the sim, reducing the land impact even further. Larger mesh objects cost more LI because they retain their higher LOD levels over greater distances the larger they are. Most content is made around twice the size it should be if everything is to scale with inworld measurements. Shrinking your avatar to human sizes and adjusting your camera so it doesn't need so much more space for you to see properly really helps you save a lot of space and money. If you ever thought land in SL was too expensive, this is the easiest way to cut the cost of land drastically.

 Doing these simple things I reduced to LI cost of the structure from 241 to 123. About half. Still a lot for a single structure, but given the sheer amount of detail I'm a lot more comfortable with it.

Reducing VRAM/Texture Use

 VRAM/Texture Memory is less common knowledge in SL but I'll try and summarize. Your graphics card has a set amount of memory to use rendering what you see in SL. All the textures you see have to be in that memory to be displayed, but so much more relies on that memory so you cannot max your card's memory out on textures alone or you see massive framerate losses and "texture thrashing". Texture thrashing is when you see textures going blurry and re-rezzing. You also have to download all these textures, which contributes to lag and slow rez times.

 360MB might not sound like a lot of memory, but it's only one building in an entire sim and then you throw avatars and their memory use into the mix. My videocard only has 2GB of VRAM. It's a midrange card, a few years old. Newer, more expensive cards have up to around 8GB. Onboard graphics have very little, if any, dedicated memory.

 Following so far? Ok, good!

This scrap house is covered in various unique corrugated metal panels. They're not identical. Out of the box there's like 6-12 different panels each with it's own texture, spec map and normal map. All of which are 1024x1024.  Each texture uses 4MB of memory on its own and it's simple arithmetic to see how that adds up.

 What I did was remove every type of panel except 2. Then I copied the remaining 2 panels to replace each of the panels I removed. Not difficult, but a little tedious and time consuming. But worth it! I was able to reduce the memory load of the house from 360MB down to 207MB. Here's a screenshot from the marketplace listing showing the original texture variety so you can compare. Yes, it's a little more detailed, but that detail comes at a cost in framerates, lag, and texture thrashing. What's more, are people going to notice the difference? Those who saw this building in my sim before and after did not notice the change until I pointed it out to them myself.

 You might be able to do the same if you notice items in your sim are similar, yet use different textures! Many SL buildings, for example, will have nearly identical textures for walls, floors, etcetera, where the only differences are slight variations in shading or colour that most people will never even notice! You can compare textures in the preview window of the texture chooser tab of the SL editing panel and see if this is the case, then it's a simple matter of unlinking pieces, and copying the one instance to replace the pieces with the redundant textures! In some buildings this is easy, in some buildings all of the walls may be a single mesh object which means you'll have to look for an alternative solution, such as replacing the textures entirely with one of your own.

 I also noticed that this house used the same stair kit as another building I have in the sim, but different textures. I swapped out the stairs with the identical stairs from the other house to reduce the sim's VRAM load further! And other buildings in the sim also use corrugated metal panels, I replaced them all with one of the two metal panels from this house and probably cut another 100-200MB of memory out of the sim. All of this means visitors to the sim get to experience higher framerates, less lag, little if any texture thrashing and fast rez times!

 And I hope the rest of you are able to implement these ideas into your own homes, clubs, RP sims, and other environments and improve your own SL experience! I'll be posting more articles like this, showcasing modifiable content that I've purchased and found ways to improve. Until then, take care and keep fighting the good fight!

No comments:

Post a Comment