Making Your World Shipshape

Courtesy of Stacee

We have a number of modelers, builders, and world owners out there, and the constant problem all of them end up facing is, "How can I reduce lag and download times in my world? Not to mention, how did I ever run out of space on my object path!!!" I don't think I've ever seen a really good list of tips, tricks, and guides listed in full all in one spot and yet it's something that comes up so often in so many ways. While this will not be a complete list, it will be a good start.

1. Textures. Believe it or not, this more than anything seems to be the biggest offender I've seen for long download times, as well as eating up valuable object path space. Most of us get our textures from off the wonderful world wide web and there's no doubt that some of them are awesome. Unfortunately, most are never optimized for use in AW. Having textures that are huge, whether in file size or pixel size, will create a number of issues.

This article http://www.activeworlds.com/newsletter/0102/010206.html is one of the best I've ever seen detailing the ins and outs of efficient textures. Following those guidelines will reduce download time, sometimes in half, and will also open up a huge chunk of space on your object path. I cannot stress enough how important this first tip is.

2. Polygon count
. I think this one is something that most people are unaware of. For those who are not modelers, polygon count is the number of faces an object is made up of. This can be in triangles or quads, but they play an important part in how much lag will be in your world .I quote this next part from an internet game source: "This is especially true when you have to carefully limit the total number of polygons in a mesh, as you do in a real-time 3D game. Probably the most essential skill to building 3D models in polygons is learning to make the most of the available polygon budget and to optimize the appearance of low-poly surfaces to make the most of what you’ve got." Hmm, in English perhaps? Essentially, for real-time 3D environments (AW is one of these), it is best to make objects as low-polygon as you can, making up for what you lose in smooth definition with well-done textures.

Why? Because in a real-time environment, it has to render all those faces and detect collision on them on the fly, as well as what textures they have and if they are masked. The more polygons it has to do this on, the harder it has to work to render something, slowing down the framerate. Something that is high-polygonal may look really great, but in a 3D environment, it can bring things to a standstill. Most high-polygonal models are made for artists intent on making detailed, photo-realistic pictures...they were not designed for 3D environments. An occasional hi-poly object, say something that is 1000 polygons, is okay. But if you have numerous items that have an extreme polycount, not only will your download time be long, many people will only be able to crawl in your world.

For you modelers out there, this was an article that was posted in the past on what to consider when making objects:
http://www.activeworlds.com/newsletter/0801/08013.html

I'd like to add something to number 4 in that article that has been a
valuable trick to me in helping to reduce polygon count. Take into account, when making an object, some faces will not be seen by anyone, because they are inside something else on the object.


We'll use this chair as an example. Note it has 78 faces (polygons). By either deleting the hidden faces (marked in bright green), or painting a texture named delete on those faces so we can identify which ones to take out in the .rwx later, we can eliminate 8 polygons on that chair. Doesn't seem like much, does it. But let's now say you use 10 of those chairs in a room in your world. You just saved the AW engine from having to render 80 unnecessary polygons. And if you do this on every object you make, there is no telling how many polygons you'll save on.

Now, another trick I'd like to share: Know that globe in the Gate? It is a lot rounder, less jagged, then we had in the past. How did we get away with having something hi-poly like that without lagging everyone that's in there? We made use of a command in the .rwx file called Collision Off. This is why no one is able to stand on it, because we took the collision
detection off it. But by doing this, it allows the browser to basically ignore all those polygons because it doesn't have to check collision on all of them. If you wish to have a few hi-polygon objects in your world and basically want to cheat the browser into thinking it isn't there, this is a great way. It will lower lag greatly, while allowing you to have a few
beautiful sculptures or objects. I might also add, if collision is something you'd like for the object, why not encase it in an invisible cube or low-poly globe. a lot easier on the browser to check collision on a cube with 6 polygons then it is a 5,000 polygon object. Here's an example of where to place the command in the .rwx. Most times it will be placed near the end.

Triangle 2 5 4
Triangle 3 2 1
ProtoEnd # sphere_0_0
ClumpBegin
Collision Off
Rotate 0 1 0 180
Rotate 1 0 0 -90
Scale .1 .1 .1
ProtoInstance sphere_0_0
ClumpEnd
ModelEnd

3. Lighting. There has been endless debate on how many lights AW can render at one time. Regardless of how many it CAN handle, the more important issue should be how many would be reasonable to put in one area. The more you add, the more processing power is eaten up on your computer. Quoted from the help pages for the light command: "Note that light sources require additional CPU time to render and thus should be used sparingly. Each new light source added to a scene will reduce the frame rate by a small amount. Excessive use of extra lights can severely impact the performance of an area or world. Some graphics cards or drivers may limit the number of light sources which will render at the same time on a given computer system." Lights, especially those with large radii or brightnesses can cause quite a hit. Moderation, and tricking the eye, is the key. Instead of putting a light source on every lamppost or light, try putting it on every other one, or even better, use one that is centered in the middle of the group on an invisible object. This will give the impression that the lampposts are lighting the area, while you save on processing power by using only one or two lights.

This article is great for modelers who would like to learn some tricks to lighting objects WITHOUT using any in-world light sources. It can have a profound impact on your objects in the dark, and it's not limited to just white light. Experiment with various prelighting colors. http://www.activeworlds.com/newsletter/1201/1206.html

Below is an example of using the Prelight command.

ModelBegin
ProtoBegin sphere_0_0
TextureModes Lit
OpacityFix off
Transform 15.546917 0. 0. 0. 0. 15.531262 0. 0. 0. 0. 15.5 0. 0. 0. 23.9 1.
Vertex 0. 0. 1. UV 0.014286 0. Prelight 0. 0. 0. # 1
Vertex 0.088199 0.016006 0.995974 UV 0.028571 0.028571 Prelight .02 .02 .02 # 2
Vertex 0.089639 0. 0.995974 UV 0. 0.028571 # 3
Vertex 0. 0. 1. UV 0.042857 0. Prelight 0. 0. 0. # 4
Vertex 0.083923 0.031497 0.995974 UV 0.057143 0.028571 Prelight .02 .02 .02 # 5
Vertex 0. 0. 1. UV 0.071429 0. Prelight 0. 0. 0. # 6

Note the Prelight 0. 0. 0. is no prelighting at all, and Prelight 1. 1. 1. is 100% lit. If you want to light an object with all the same prelight setting, it is only necessary to put the command on the #1 vertex(tices) and it will apply it automatically to all the vertices that follow it. And to see how awesome something can look with Prelight, here's a picture of a tiki hut house....no light sources were used to achieve this effect, not even for the little lanterns. All prelighting.


4. Coronas. How many people remember the times before the AW cleanup around GZ last spring and summer? Remember all those coronas the size of your screen that blinded you no matter where you went? Or how about the hit to framerate you experience when you come to an area where there are a flock of coronas, all circling and gyrating here and there. There are endless uses for coronas, and they definitely add a lot of effect, but like anything else, there can be overkill, resulting in decreased framerate for some, and computer crashes on those with older video cards that can't handle the barrage those 30+ coronas are putting on them. So moderation really is the key when using those incredible coronas.

5. Transparencies. One of the hardest things to balance in AW is the use of what we call transparencies, or alphas. Trees, sprites (facers), plants, windows, glass, water, and numerous other objects take advantage of this feature. As if it wasn't hard enough just to make them all play nice together (I think all of us have had our share of experiences in trying to get masked objects to not have issues when they are near each other), it's also true that masks can cause lag. It's a lot for the engine to render, because it's busy cutting out parts of objects and letting other objects behind it show through. The more polygons it has to do this on, the worse the framerate will be. That's why if you walk into a huge forest of trees, your framerate can drop drastically. Therefore, try to take this into account when building and when making models that will use transparencies.



Whew! You as tired as I am? Lots of info to take in there. Maybe all these points are new to you and you are overwhelmed by it all. Try one or two of them out for starters. You'll be glad you made the effort. As ever, if you have questions about the articles, or have something you'd like to see answered in here, please email me at:

stacey@activeworlds.com

 

We Wanna Hear From You!

If you would like to write an article for the newsletter or have a project you would like to share with the community through this newsletter, please contact us (newsletter@activeworlds.com) to find out more about participating.

Send us feedback on our new look! E-mail comments to newsletter@activeworlds.com.