Sign in to follow this  
Followers 0
Penny Patton

Building a Better SL

21 posts in this topic

First things first, if you're in SL just to have fun, do that! Not everyone is building interactive environments for RP sims. Not everyone considers themselves a "professional" content creator, making a living selling avatar accessories on the marketplace. A lot of people just want to have fun slapping prims together and seeing what they can do.

There is absolutely nothing wrong with that and don't let anyone tell you otherwise.

By all means read this post. If you learn something useful, fantastic! But don't fret if my recommendations are outside your abilities.

This is primarily aimed at content creators, sim builders, and people who are comfortable slapping prims together, working with sculpts and mesh, and who want to get more out of SL.

Finally, I'm sure many of you have seen me talk about all of these things before. I'm also sure there's many who haven't. If even one person learns something new, then it's worth sharing tips like these.

~

We all have our complaints about SL. The lag. The lack of visual fidelity. Poor framerates. The unreliable scripts. The lag. The expensive land. The lag!

I'm sorry to say there is no "silver bullet" to solve these problems. There is no single problem LL can fix that will magic the lag away. That's reality, and applies to the virtual world no matter how hard you click the heels of your no-mod ruby red slippers, with 600 resize/texture change/colour change scripts in each, together.

However, there are little things you can do to alleviate these issues somewhat. The more people who follow these tips, the better SL looks and runs for everyone.

 

Some of these run a bit long, so I'm going to separate each part into its own post.

5 people like this

Share this post


Link to post
Share on other sites

Use fewer (and smaller) texture maps!

This is a big one that few seem to consider.

Textures eat up bandwidth to download, processing power for the sim to retrieve them from the asset server and deliver them to your viewer, and then your videocard needs to store them in memory and render them. Too many large textures are one of the biggest reasons SL gets such poor framerates.

Here's some numbers for you, to help illustrate why slapping 1024x1024 textures on everything is bad;

64x64 : 16kb
128x128: 65kb
256x256: 262kb
512x512: 1MB!
1204x1024: 4MB!

Most people only have 512MB of VRAM and Second Life refuses to use more than that for textures regardless. ( Although, SL will eat up all of your VRAM. Nobody knows what it does with the rest.)

There is a really bad trend with mesh content. People using 1024x1024 textures on every surface, large and small. Often only utilizing small sections of these textures, the rest being unused data that you never see when looking at the object in-world. This is usually the result of applying the same texture to every surface in the 3D modelling program, using offsets for smaller surfaces, then baking shadows and exporting the full 1024x1024 textures even though the model only uses a small visible area.

I've seen this on everything from houses to drinking cups. I bought a bar counter, basically a wooden box, which turned out to have eight unique 1024x1024 textures. In the same bar set was a tip jar, a small drinking cup with a sign reading "Tips" leaning against it. It used three 1024x1024 textures, a 1024x512 texture and a 512x512 texture. Everything in the set was like that. When I rezzed the set in an otherwise empty sim, my framerate dropped from 75fps to 5fps and remained that way until I removed all of the textures. With the geometry alone, my framerate shot straight back up to 75+.

From another store I purchased a simple, one room house. Not counting the two windows and the single door, the house uses eighteen 1024x1024 textures. Realistically, this house could have been textured with no more than three 512x512 textures and looked more or less identical.

Outside of the "Daikatana arrow" you never see texturing that inefficient in a videogame, and that is a part of why much prettier videgames run much more smoothly than SL. The performance impact of so many huge textures cannot be understated.

 

People should also try to combine textures, use ALL the space in a texture map and wrap it around the visible surfaces of your mesh. Especially if you're working in mesh, there is no reason not to do this!

texture wrapping.jpg

Reuse textures where possible. If you have one room house where two of the walls are identical, use the same texture on both!

"But what about ambient occlusion?" you say? Fake it! Whenever possible fake it so you can cut redundant textures! If said house has a support beam at each corner, try and use the same texture on all four! Make a wall texture that appears to use ambient occlusion but can be applied to EVERY wall in the room!

Speaking of fake shadows, if you use prim or mesh surfaces to apply a translucent shadow texture, there's rarely any need to make such a texture larger than 64x64. Maybe 128x128 for more complicated shadows. Anything larger is a waste, no one will be able to tell the difference.

Just like you should challenge yourself to use as few polygons as possible, challenge yourself to use as few textures as possible!

"But I don't want to sacrifice quality!", you say? You're creating content for an environment, not every drinking cup needs to be a ten million triangle work of art with fiften high-res texture maps! No one is going to look that closely at a drinking cup, but they'll sure as hell notice their framerates dropping to single digits as their computer struggles to render your perfectly textured minor background detail and everything else competing for their attention.

If you're that worried about quality, keep this in mind! Skyrim, a AAA blockbuster videogame with graphics that put SL's to shame uses fewer, smaller texture maps for objects that likely look as good if not better than what you're making for SL.

 I've tried my best to reduce texture use at an island build I've been working on lately. Since I did not make all of the assets from scratch, I used a number of items I've purchased, I've been limited in what I can do, but I've still managed to cut the equivalent of about fifty 1024x1024 textures out of the island and saw a drastic performance increase.

 It's an adult sim, but feel free to visit and see how much this sacrifice in quality has hurt the visual quality of the island.

milk and cream screenshot.jpg

And don't think this only applies to mesh! Those of you who work in prims and sculpts! Same deal!

The prim buttons on your favourite 2007 sculpty coat? They don't need 512x512 or 1024x1024 textures. For something as small as a button if you're using a texture larger than 64x64 it's too big!

A good rule of thumb, if a surface is smaller than 10x10m, use a 512x512 texture or smaller! Avatar attachments almost never need textures larger than 512x512 and rarely need textures even that large! Aside from my three skin/clothing layers, my SL avatar has only one 512x512 texture. There's some 256x256 textures but most are 128x128 or smaller.

 

3 people like this

Share this post


Link to post
Share on other sites

I know this is the building forum, but this goes right along with the topic so I figure I'll keep it all in one place.

Use fewer, more efficient scripts!

Full disclosure, I am not a scripter. I go cross-eyed when trying to cobble scripts together from code on the LSL wiki. If I'm wrong about anything, it will be in this section, but this is my understanding from years of managing sims and working extensively with very skilled scripters in SL. I've run these same recommendations past some of SL's top scripters and they agree with my assessment.

Every script is a virtual machine which uses memory and processor time.

Every sim in SL has a set amount of memory set aside for scripts. Now, relatively recently, LL did some things which give sims more memory for scripts, but it is still not an infinite amount! 

While there is memory available, scripts compete with each other for resources so a lot of scripts will, at first, only result in scripts themselves running slower. When the scripts running in that sim exceeds the amount of memory the sim has available, the server has to start using the swap file and that slows the sim down drastically.

 

There are tricks to manage the amount of memory each script uses, but generally speaking the more scripts you use, the more memory you're using. This is why single script resizers are encouraged over putting a resize script in every prim of an object.

Mermory isn't the only thing. There's also processor time to consider. This is how much of the CPU resources scripts are using. Believe it or not, sims in SL do not have infinite processing power. So the more of a server's CPU time scripts are eating up, the less CPU there is for other scripts in the sim. This can make scripts run slowly, or not at all.

So, if you can combine scripts, that's generally a good idea. If you have the option of using multiple scripts or one single script to do the exact same thing, use one single script even if it's more work to write.

You'd be amazed at how many features you can cram into a single avatar without exceeding 500k of script memory.

Granted, we don't all script. I know my own avatar uses WAY more script memory and time than it should, but just being conscious of your script use, whether for your avatar or for things you build in the environment, can help you see ways to reduce your scripting footprint.

 A good rule of thumb is to check new purchases for scripts. I'm primarily talking items that may have scripted features for resizing, retexturing, etcetera, not scripted features you would use in regular, every day use of the item.

Make a copy to wear around SL, and a copy to keep in your inventory in case you need the scripts later. Delete all of the scripts inside the attachment. Some TPVs make this easier. I believe Firestorm has a "delete all scripts in selection" feature which makes this as easy as a single click. Now use the script-free version as the copy you wear and you'll be sparing yourself, and everyone around you, potential lag.

2 people like this

Share this post


Link to post
Share on other sites

Build small!


"Oh, Penny! You're such a broken record! Why do you always go on about this?"

Because it works!

The call for "realistic scale" isn't some irrational desire for everything to be "realistic", this is about design and it is about resource management.

Constantly people complain about the cost of land! "Land is too expensive! LL should reduce tier!" Maybe so, but STOP BUILDING SO HUGE AND YOU CAN DO MORE WITH THE LAND YOU HAVE NOW!

You cannot resize land. You want more? You gotta pay!

If you know that much then it is crazy to blow things up to the sizes most people build at in SL. Larger objects eat up more space! That's not rocket science, that's 7th grade geometry. You can fit four times as many 10x10m squares as you can 20x20m in a given area.

Most people build to around double scale (give or take), far exceeding the scale of most avatars contrary to the belief that everything is consistently scaled to the "average" avatar size). This is partially due to the default SL camera, partially due to people just eyeballing things and not even thinking about scale. This means your average SL sim holds only 1/4th a sim's worth of content. Or, to put it another way, if you build to scale you can fit about four times more content into a given space.

"That's not true, Penny! What about prims? When you shrink stuff it uses the same amount of prims! You'll just wind up with an empty looking sim!"

If you ONLY use prim content made after the release of mesh, then you kinda, almost, have a point. However, that describes almost nobody.

Before mesh arrived along with the prim size increase to 64, prims were restricted to 10m to a side. Because of that, legacy content made before mesh is often bloated with redundant prims, far more than this content would have needed were it made to scale. Sometimes as much as four times as many prims.

Now that we have mesh this isn't an issue, provided you're building your own content or have the skills to cull redundant prims from old prefabs. However, mesh itself increases in land impact cost the larger it is.

When working with mesh, whether it's furniture or full buildings, you can substantially reduce the LI cost simply by shrinking it down closer to 1=1 scale. This makes it easy for anyone, regardless of skill level, to reduce their LI footprint simply by reducing the size of their mesh objects.

"Enough to make up for the 3/4 land area you free up in the process?"

 You tell me.

 The floating island build below uses 1/4th of a sim, the island pieces themselves push right up against the parcel boundaries, leaving not much empty space between them. Several of the island pieces themselves are mesh, and being so large eat up a considerable amount of Land Impact.

milk and cream example.jpg

There are avatars in this screenshot, one is right out in the open in the foreground on the left side of the screen. Can you see it? Near teh wilted looking tree. That should give you an idea of how large 1/4th of a sim really is.

Now here's some detail shots from standing in the island itself.

milk and cream screenshot.jpg

dungeon_001.jpg

cream 1.jpg

cream 2.jpg

You can also visit the island  itself and see it firsthand. Again, it's the same adult sim I linked to earlier, but you can visit it here.

In addition to all of that, there were still enough prims/Land Impact left over that 500m below the island is another island with a club and vendor area.

cream 4.jpg

There's an avatar standing right in the middle of this island, on the path in front of the pink tree, which can again give an idea of the size of the island.

 

 All of this, and more, squeezed into 1/4th of a sim. Using about 3600 prims/Land Impact.

 The issue a lot of people worry about in building to a more reasonable scale is that many of SL's avatars are huge and may not be able to squeeze into such small environments. This worry is exaggerated somewhat, again people tend to build to a much larger scale than even SL's avatars tend to be.

  You can also design buildings so that larger avatars can squeeze through smaller doors by making doorframes phantom, making doors into teleporters, etcetera.

 The only real issue is the SL camera. The default camera placement is just plain bad. It was set up in 2002 or earlier, and LL has never updated it despite the strides the videogame industry has made in third person camera placement.

 Thankfully, it's a problem that is easily solved. There are simple instructions for getting a much improved camera placement, with explanations which make it easy for you to tweak the camera to your personal liking.

 Also, third party viewers have begun adopting better camera placement, starting with the popular Nirans Viewer, known for it's visual improvements to the SL experience.

If you'r concerned about having traffic rates affected, the example I give here has very respectable traffic, then there are also Doomed Ship and 1920's Berlin. Both popular RP sims which have featured being built to scale for years.

 

 Now, if you're selling stuff there is an understandable concern about people being able to use your content right out of the box. If you're worried, I'd recommend including large and small copies of your items and letting the customer decide which to use.

 The up side is, since the LI of mesh is reduced at smaller scales you can use that as a selling point.

 

 This is less of an issue for avatar attachments. You should always, always, design attachments around the smallest possible size simply to make it useable by the largest potential market. It is easy, especially with resize scripts,  to make an attachment larger, but it can be incredibly difficult to squeeze an attachment smaller when it was built around a larger size initially.

 Of course, this is also less of an issue with regards to mesh attachments.

2 people like this

Share this post


Link to post
Share on other sites

Now, I just want to wrap this up with a few words on Draw Weight.

Draw weight is by no means a perfect metric for how much of a burden your avatar is on anyone's hardware, but generally speaking if you can get your draw weight down you increase the framerates for yourself and those around you.

 The average SL user is often at the mercy of content creators as far as their ability to do so, and a lot of content creators do not provide much in the way of options.

I'm going to pick on a couple of examples here but these are items I use myself, I think the creators did great work, I'm just trying to draw attention to efficiency issues very, very few people in SL ever even think to consider.

penny hair and harness.jpg

There's me, out on adventures. I love this hair, I purchased it at Wasabi Pills, great shop. I've bought a tonne of stuff there. I do have a couple issues with it, tho.

 See the dark hairband? That originally had a 1024x1024 texture. That's pretty ridiculous. It's just a shaded cloth texture. I replaced it with a 64x64 texture that looks more or less the same unless you zoom in so close it fills your screen. 

 Credit where due, the base hair texture is only 256x256, which is reasonable. Most people use 512x512 or 1024x1024 which is horrendously excessive. The alpha layer on this hair, however, is 512x512 and that's not really necessary at all.

Then there's one more texture! Inside my head is a box with a 512x512 Wasabi Pills store logo on it. Neither the prim nor the texture are necessary, both are entirely hidden yet place just as much extra rendering burden on the videocards of everyone who can see me as if it were a giant box on my head.

 People love those store logo root prims. I'm guilty of it, too. back when I was making avatar accessories before I got all efficiency concious. They're unecessary and just add to the pile of things SL is trying to make your hardware render.

 One prim and one 512x512 texture might seem small, but my hair doesn't exist in a vacuum. Every avatar you see has probably at least one attachment like that. If you're in a sim with thirty avatars, that's thirty 512x512 textures dumped into your video RAM and thirty extra cubes your videocard is processing.

 Chances are, those avatars have multiple attachments like that. A pair of sunglasses, each shoe! Maybe a hat, or even the root prim of their shirt or any prim body parts they're wearing. Suddenly, in a sim of thirty avatars you're already exceeding your texture memory just on textures you never even see on screen!

 That's before getting into the textures they're wearing that you can see! Let alone the sim itself!

 Content creators can help by ditching this bad habit!

 Alright, now look lower! Not that far! See the metal chain on the leather weapon harness I'm wearing? (Great looking work, by the way, I got it at Dark Prophet Designs.)

 The chain is a set of sculpts. Each link is a separate prim. Not great, considering you could do multiple links in a single sculpt, but what really shocked me was examining it to find that each link in the chain uses a separate, yet nearly identical 256x256 texture for each half of the chain. That's a total of thirteen unique 256x256 textures, which look identical. Even worse, each of those thirteen prims also uses a separate sculpt map.

 Now, I took the time to remake that chain using just one of the prims, and replaced the texture with a 64x63 texture that looks identical unless you zoom in so close the chain fills the screen.

 What's more, the rest of the harness is loaded with 1024x512 textures. Nothing in the harness needs a texture that large to look good, especially with the quality of the design.

 

 Now, being someone who can do graphics reasonably well, I can make my own replacement textures, I can rip apart prims and put them back together more efficiently. The average consumer cannot. Most of them don't even think about these things.

 The people who make these things can, and I'm hoping that by making these issues more widely discussed, more content creators will make a point of working more efficiently.

 Make it a selling point! Advertise how little your work adds to avatar draw weight! When it's pointed out to people as a feature like that, it is likely to influence their buying habits in a positive way and we all benefit with the performance boost that comes with more efficient content and avatars.

3 people like this

Share this post


Link to post
Share on other sites

Nice thread, very informative. I don't agree with everything but I don't want to sound like a broken record myself...so I'll let that be.

One thing though...


Penny Patton wrote:


Most people only have 512MB of VRAM and Second Life refuses to use more than that for textures regardless. ( Although, SL will eat up all of your VRAM. Nobody knows what it does with the rest.)

Really, nobody does? VRAM is used for storage of vertices and faces, the more geometry on screen, the higher the memory use. VRAM is used for anti-aliasing, a multiplier of 2x makes your gpu draw a picture twice as large, increasing memory use by a factor 4, just like the textures stored. 4x AA draws a picture that uses 16x more memory, 8x AA uses 64 times more video memory. At a screen resolution of 1920x1200 memory use is about 9MB without AA. With 8x AA that adds up to more than the total texture use of 512 MB that SL is limited to.

VRAM is also used for shadows, which use their own additional maps. Triple buffering (something I use in combination with vertical synch to keep the fps at a reasonable 60fps instead of 100+) uses VRAM. A high screen resolution uses more VRAM.

Creators only have control over the geometry of course, but any user can lower VRAM use with the above in mind. Running out of VRAM can have serious consequences, since your video card will use your slower RAM to compensate. If you are already running low on that, the result can be even disastrous, because if you run out of that, the again slower hard drive will be used for swapping.

2 people like this

Share this post


Link to post
Share on other sites

I've been reading your posts here and on other forum and must say you have a good point, so I want to ask you is it possible to meet with you in-world and ask some questions? I need advice on how to set my place so its not heavy to load for some people. Like I have this house, looks beautiful and its filled with tons of stuff but all I see are people bumping into walls and leaving after a minute. Am willing to pay for your time and effort, just need few advices from someone who knows what to do. Thanks in advance for your reply:)

Share this post


Link to post
Share on other sites


Kwakkelde Kwak wrote:

Nice thread, very informative. I don't agree with everything but I don't want to sound like a broken record myself...so I'll let that be.

One thing though...

Penny Patton wrote:

 

Most people only have 512MB of VRAM and Second Life refuses to use more than that for textures regardless. ( Although, SL will eat up all of your VRAM. Nobody knows what it does with the rest.)

Really, nobody does? VRAM is used for storage of vertices and faces, the more geometry on screen, the higher the memory use. VRAM is used for anti-aliasing, a multiplier of 2x makes your gpu draw a picture twice as large, increasing memory use by a factor 4, just like the textures stored. 4x AA draws a picture that uses 16x more memory, 8x AA uses 64 times more video memory. At a screen resolution of 1920x1200 memory use is about 9MB without AA. With 8x AA that adds up to more than the total texture use of 512 MB that SL is limited to.

VRAM is also used for shadows, which use their own additional maps. Triple buffering (something I use in combination with vertical synch to keep the fps at a reasonable 60fps instead of 100+) uses VRAM. A high screen resolution uses more VRAM.

Creators only have control over the geometry of course, but any user can lower VRAM use with the above in mind. Running out of VRAM can have serious consequences, since your video card will use your slower RAM to compensate. If you are already running low on that, the result can be even disastrous, because if you run out of that, the again slower hard drive will be used for swapping.

That bit about nobody knowing what SL does with the rest of VRAM was a joke. Sorry, it was like 2am when I wrote that.

Feel free to send me a private message on the parts you disagree with.

Share this post


Link to post
Share on other sites


Tamara Artis wrote:

I've been reading your posts here and on other forum and must say you have a good point, so I want to ask you is it possible to meet with you in-world and ask some questions? I need advice on how to set my place so its not heavy to load for some people. Like I have this house, looks beautiful and its filled with tons of stuff but all I see are people bumping into walls and leaving after a minute. Am willing to pay for your time and effort, just need few advices from someone who knows what to do. Thanks in advance for your reply:)

Feel free to message me in-world.

Share this post


Link to post
Share on other sites


Penny Patton wrote:

 

That bit about nobody knowing what SL does with the rest of VRAM was a joke.

Ok, well that is the bulk of what it's used for anyway, as shown potentially higher than texture memory.

Share this post


Link to post
Share on other sites

Kwakkelde Kwak wrote:

Ok, well that is the bulk of what it's used for anyway, as shown potentially higher than texture memory.


More information available to content creators is always a good thing!

Share this post


Link to post
Share on other sites


Penny Patton wrote:

Here's some numbers for you, to help illustrate why slapping 1024x1024 textures on everything is bad;

64x64 : 16kb

128x128: 65kb

256x256: 262kb

512x512: 1MB!

1204x1024: 4MB!

 

I always have a hard time to believe that those numbers are valid. 4MB for a 1024x1024 is the size of a Targa with alpha channel. Converted to SL's JPEG2000 format, it's a few hundred KB though.

Share this post


Link to post
Share on other sites


arton Rotaru wrote:


Penny Patton wrote:

Here's some numbers for you, to help illustrate why slapping 1024x1024 textures on everything is bad;

64x64 : 16kb

128x128: 65kb

256x256: 262kb

512x512: 1MB!

1204x1024: 4MB!

 

I always have a hard time to believe that those numbers are valid. 4MB for a 1024x1024 is the size of a Targa with alpha channel. Converted to SL's JPEG2000 format, it's a few hundred KB though.

Your video card doesn't know what what jpg2000 is, it doesn't know what compression is.

A 32 bit texture uses 4 bytes per pixel

1024 x 1024=1048576 pixels

4 x 1048576 = 4194304 bytes

4194304 / 1024 / 1024 = (exactly) 4MB

1 person likes this

Share this post


Link to post
Share on other sites

It's good to have all these points made clearly and together here. Concerning texture capacities, I look forward to another installment when the materials project gets released!

Share this post


Link to post
Share on other sites

Oof! I'm guilty of that " full-size, hidden root logo texture" one. Of course, it makes perfect sense when it's laid out like this; I had just done it because I'd seen it done in products I liked.

 

Share this post


Link to post
Share on other sites


arton Rotaru wrote:

Yeah, but we don't download 4MB for each 1024.

 Here's a great write-up by Chosen Few explaining the difference between file size and texture memory being used on your videocard.

At the end of the day, what matters is "do these suggestions actually provide the benefits they claim", which is precisely why I linked to an in-world build I am currently working on.

I ripped about fifty 1024x1024 textures' worth out of the island I linked to and saw a substantial performance increase, 10-20fps higher in the areas where I'd previously been experiencing the worst framerates and a drastic reduction in the amount of times SL would freeze up due to shifting large numbers of textures in and out of VRAM.

I still see a lot of areas I can optimize around the island, but I'm confident the performance people experience there is more convincing than anything I could write here on the forum.

Share this post


Link to post
Share on other sites

I don't argue about your statements. I'm almost 6 years in SL myself, I certainly know that less is more, regardless of what it is.

Share this post


Link to post
Share on other sites


arton Rotaru wrote:

Yeah, but we don't download 4MB for each 1024.

That's right, downloading a 1024x1024 costs a couple of 100 kb as you said.

Even my statement about video cards not understanding compression isn't 100% accurate, they don't understand jpg compression though. And if I'm not mistaken a 1024x1024 uses over 5MB, not 4MB, because of mip mapping (4MB + 1MB + 256kB + 64kB + 16kB etc)

Anyway, keeping texture size low is very important for performance.

Share this post


Link to post
Share on other sites

Penny,

You should get with Builders Brewery and give an ongoing class about this.  Especially for the new beginners learning about texturing.  Teach them from the get go how to properly texture and build items to get the best look with the lowest impact on peoples viewers.  I know I would attend.  Just in this thread I learned a few things I did not know or considered before.  Excellent thread and discussion.  Two thumbs up as they say.

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  
Followers 0