Showing posts with label reduction. Show all posts
Showing posts with label reduction. Show all posts

Saturday, August 20, 2011

Obsess About Efficiency - Forest Path Lantern

-----------------------------------
MEA CULPA!


This post was written with bad information! The Dodie lamp shown below is actually only three prims! Just one more than my own, and that extra prim is used to make the lantern piece itself look much, much nicer than the one in my own version.


 I highly recommend purchasing this lamp, it's a phenomenal piece of sculpting and texturing, and the very model of efficiency I was trying to promote with this post! Go buy one now!


 I sincerely apologize to Dodie Snowbear for providing incorrect information about her product! It was very irresponsible of me to write about the lamp without seeing it firsthand.


- Penny Patton

-----------------------------
 I'm often asked how I can cram so much detail into so few prims.

 Honestly, the answer is to obsess over efficiency. A part of that is to constantly use scale and camera placement to allow yourself to fit more stuff into a smaller amount of space. Another part is to be completely obsessive over prim counts, using as few prims as possible while getting the most detail out of them as you can.

 When I was working on the Island of Milk & Cream I suggested lamps to light up the paths. Alyce, one of the owners, pointed me at a wonderful looking fantasy street lamp that was perfect for forest settings. I loved it, but was dismayed that the number of prims it used was not listed on the Marketplace page. Alyce went to the creator's shop to take a look and found it was 8 prims.

[D o d i e]  Log Lamp by Dodie Snowbear
 I was a bit unhappy to hear that. I's a great lamp, but I was sure I could do something very similar in well under 8 prims. Still, I loved the design, so I opened up 3D Studio Max and set about seeing just how prim efficient I could make something similar.

 This is what I came up with.

Very similar but...
 Using a cylinder sculpt shape in Prim Composer and mapping out the vertices I was able to replicate the [D o d i e] lamp in only 2 prims. It only required 2 prims due to Second Life not having any sort of tool to apply glow to specific areas of a sculpted prim, requiring you to use separate prims to apply glow or shine effects, otherwise this would be only 1 prim.

 Now, I'm not doing this just show off (Ok, so showing off was a big part of it, yes. Shush and keep reading!) or to one up Dodie, it's a gorgeous design, and I won't be selling my version to compete so unless you can make your own you're just going to have to buy the [D o d i e] version, I just want to illustrate how much you can squeeze into a smaller number of prims if you try. Being able to work with sculpts, and soon mesh, is a key part of that. Being able to see just how far you can stretch a sculpt for detail is another.

 Of course my much lower prim version couldn't be done without sacrifices. The [D o d i e] lamp has a much more detailed lantern, with a visible candle inside. For mine I decided I could do without that additional detail and replaced it with a single, flat glowing prim for the light source.

 Second Life is all about balance, putting detail where it's most needed and cutting back on detail where it matters less. In this case I decided I could do without the detail inside the lantern so that I could save prims to put elsewhere on the island, such as more lamps!

Yes, I was thinking of My Neighbor Totoro when I put a lamp there.
 Also, I need to figure out a new way to upload sculpts as mine always seem to get corrupted on upload. They'll look fine in the preview window, but then I'll upload them and they comw out looking melted. The lamp part of this sculpt suffered the most, which is obvious upon a close inspection. I used to get around this with a LibSL image uploader, which consistently managed to upload sculpts without corruption. Unfortunately I cannot seem to find a download for it anymore.

 I'll figure something out.

 Anyways, I don't always make my own versions from scratch if existing content is too many prims. I was able to take the Pre Fabulous "Old Barn" and cut the prim count to less than half by scaling it down and removing all of the prims that made redundant, then going through and replacing a lot more with sculpts. Once we get 64m prim sizes I intend to replace a lot more in that barn with sculpts, cutting the prim count to a tiny fraction of the original.

Fantastic barn, but was built WAY too large.
 I did the same for the Milker from Broken Pride Productions. I replaced most of the regular prims in the frame with a single sculpted prim, cutting the prim count from 19 prims down to 14 prims.

I also modded this one to work best for avatars around 5'7", the original worked better with much larger avatars.
 A 5 prim difference might not seem like much, but considering what I was able to do in only 2 prims that's another two and a half lamps I can put around the island! Every prim matters. If you can cut even one more prim out of an object with a little effort, do it! You'll probably find another object you can cut a prim or two out of, then another and another. Those "one or two prims" start to add up quickly and before you know it you've freed up a few hundred prims that you can start filling in with additional detail.

 So look for ways that you can reduce prims. Whether it's by making your own sculpts to replace regular prims, scaling a build down so it uses fewer prims, using megaprims where possible. Try and make a challenge to yourself not to use any regular prims unless they care cut, hollowed, twisted or otherwise manged into something far more detailed than a simple torus, cylinder or box. Look for opportunities to cut prims everywhere, return to old builds and see what can be improved!

 There's always a way to make a build more efficient, you just need to look for them!

Tuesday, July 19, 2011

A Brief Thought About Script Memory

 I have seen  a growing number of people in Second Life lately claiming that excessive script memory use does not create lag.

 I understand the argument. Theoretically, when script memory use exceeds a sim's allotted 300MB of memory (I've also heard 100MB, not sure which is the case), scripts simply cease to function, going into a queue until it's their turn to get some of the sim's limited resources. A step LL took deliberately to reduce sim lag.

 It makes sense, and yet experience tells me it's not entirely true.

Just today I was at the Island of Milk & Cream, a sim I did the majority of the building and design for, when the lag spiked terribly. With 10 people in the sim, at one point four of whom were using around 20-26MB of script memory. One of them quickly left but three remained. The avatars in range of my script memory HUD were totaling 120MB of script memory, in addition to whatever the various builds in the sim take up and the avatars not close enough for me to see.

 As the worst offenders dwindled to only one. the sim performance improved substantially. At the moment there are still 8 people in the sim totally only 38MB and the lag is pretty much gone. 

 Another sim I frequent, Doomed Ship, regularly has 10-20 people or more and yet never has lag as bad as Milk&Cream regularly experiences. Neither sim is a Homestead, they're both full sims. The difference is that Doomed Ship does not allow individual avatars to exceed 7MB of script use and runs a campaign to encourage as little individual script impact by avatars as possible. They're quite friendly and helpful about it with staff members willing to take the time to actually sit down with visitors and help them reduce scripts without losing their favourite features.

 Admittedly,  this is all based off my experiences, not hard technical knowledge of how script memory impacts sim performance. However I work closely with a number of SL's top scripting talent and they all agree that script memory use does have an effect.

 When Linden Lab first introduced the feature to see script memory use among avatars many people worried it would turn into some sort of witch hunt. In some places in SL maybe it did, but I never experienced it. Most places I have seen which even have public "script use boards" displaying avatar memory use still have no actual rules against excessive script use, but encourage people to understand that such excessive script use is a primary cause of lag.

 I think that is a good first step that should see wider use. Rather than immediately clamping down, popular areas should merely point out avatar script use and explain how it impacts the performance of the sim for everyone. Explaining how to avoid excessive script use while still enjoying the range of features people are accustomed to (lower script memory use does not mean sacrificing features, many scripted items in SL are simply scripted poorly and there are better scripted alternatives).

 LL should also make it easier for the average SL resident to check their own script memory use and what attachments contribute the most to their impact on sim performance.

 I'd go so far as to say LL should make some of the better shopping habits a part of their own suggestions to new residents.

 1. Avoid no-mod scripted items. 

 2. Look for script memory use to be listed on vendors. If script memory use is not listed, ask the creator how much memory the attachment (and any accompanying HUDs) uses.

3. Remove scripted items that you do not actually use, such as combat or role-play HUDs in areas where they serve no purpose. Or hidden attachments that you're not currently using.

4. Remove unused scripts from attachments. If you have a favourite gun you wear on your intergalactic bounty hunter avatar, but you don't actually use it's scripted features it's just for looks, make a copy and remove the scripts! Have some heavy armour filled with colour change scripts you never use? Remove those scripts! Resizable hair? After it's fitted, make a copy and remove the scripts from the copy you wear.

4. Try and keep your overall script memory use under 2,000kb.  Most places generally suggest 5,000kb but you really should be able to have all the features you enjoy and stay well under 2,000kb. Aiming for 2,000kb and lower (I'm usually around 400kb-500kb and my avatar is heavily scripted with features) will put more demand on content creators for efficiently scripted attachments and HUDs.

 Content creators themselves should remember to try and make script efficiency a feature. Advertise how little script memory your attachments eat up. Work towards reducing the number of scripts in your creations whenever possible.

 Linden Lab should take this a step further by making script memory a part of marketplace listings just like perms and prim count.

 The onus is on LL and content creators if we want people to reduce their script use. The average user just knows that they want their features, and reducing script use by sacrificing those features is not what they want. However, once low-memory alternatives are available, it becomes much easier for them. There's really no reason why having a well scripted avatar shouldn't be that easy.