Kettle Quest

This tutorial covers the transition from “making Sculpted Prims” to “Making Meshes” . My intention is to give Sculpty makers a set of guidelines. These guidelines shall help you to decide when to make a particular object as a Sculpty or as a mesh.There are a lot of different aspects to be kept in mind, like Prim costs, behaviour of LOD, physical interaction properties, visual quality…

Chapter I: Departure

This tutorial covers the transition from “making Sculpted Prims” to “Making Meshes” . My intention is to give Sculpty makers a set of guidelines. These guidelines shall help you to decide when to make a particular object as a Sculpty or as a mesh.There are a lot of different aspects to be kept in mind, like Prim costs, behaviour of LOD, physical interaction properties, visual quality…

Maybe the most wanted (but still not available) number will be the prim cost of a particular mesh. This number will decide at the end if a mesh is well done for our online world (saleable, practicable) or not. So we will need to talk a lot about various possible “optimization possibilities” to get our work into a good “shape”.

Right now we have only a vague measurement about how good our optimization is, but as soon as the final prim costs are fixed i will update this article and adjust it to the numbers. Until then the methods introduced here are meant as just experimental.

Departure

We are first going to  measure our effort against the behaviour and the costs of a sculpted prim. I have choosen a simple Kettle. Thank you to Vivienne Daguerre for her kind offering of the blend file and textures. However a have modified the original object a bit so that it better fits into my tutorial. Here is the basic Object. It is made out of 2 separate Sculpted Prims, the pot itself and the handle. The rightmost image is a screenshot made on a Mesh-SIM (Note, the texturing will be updated, for now it is just a place holder):

The kettle has 1024 faces (sculptmap size = 64*64 pixels) and the handle has 256 faces (sculptmap size = 16*64 pixels).
The LOD is reasonably OK and the Primcost of this kettle is just 2 (for 2 sculpties).

Now let the advanture begin. Let us start our Quest and

Make a similar kettle with a mesh and with the same or even less prim costs!

If you are a plain vanilla mesh maker, please skip that part or stop grouching about how bad sculptuies are and see what they actually can do for you in a mesh world… Here we go…

Step 1 First try

Let us start clever. the kettle above and the handle are sculpties. But sculpties are meshes too, they just come along with some special constraints… Well, let us just try what happens when we take these 2 sculpties and “meshify” them . Actually all i do for now is exporting the kettle and its handle as a Collada file.

And this is the result ( i have removed the texture because we want to focus on the shape first):

So when we look very close we almost can not distinguish the two objects. Which one is the Sculpty ? Well, look what happens when we move away and LOD takes effect.Already at the first LOD jump we see a huge difference of the two Obects. Well you may think: “This is expected. Mesh is better as you can see from the LOD, Gaia made a bad Job on the Sculpty, hehe…”But… sadly the left object is the mesh and the right object is the Sculpty.WHAT ?You are irritated ? Ok, it was our very first attempt and our situation is not as bad as it looks here. We have to look at how the LOD is calculated. While for the Sculpty we have a very clear and fixed mesh topology, which btw is also optimized for automatic LOD calculations, an arbitrary mesh needs some more carefull treatment. So what we see here is the default settings for LOD generation and that is not as optimal as it can be for our particular object.And we have a lot of possibilitites for improvement. We either can configure the LOD Generator to do a better Job, or if it just can not do it well enough for us, we always have the option to create our own LOD meshes.So let us first take a deeper look into the LOD Generator and what it can do for us…

Step 2 Tweek the LOD-Generator

When you import the next time, please take a deeper look at the LOD section of the importer. Locate the Auto Generate section and there start playing with the triangle limits. You can configure each LOD level separately. You only need to select the LOD level (in the image i have selected the Medium LOD level), then adjust the triangle count to your wishes. In our case you get an acceptable LOD2 when you set the triangle limit to 1280 Tris. You can adjust each LOD level as you like, as long as each subsequent LOD level contains less vertices than the previous level:

 

Some more remarks:

Auto Generate has another option “Error threshhold”. But as far as i understand it is just another scale that you can use instead of the triangle count. The effect on the texture seems to be the same.

Build Operator, Queue Mode and Border Mode are explained briefly in the Mesh Import test page on the SL wiki. It may be worthwhile to get deeper into that later.

Generate Normals:

This feature allows you to convert a facetted surface into a smooth surface depending on the angle between its faces. This option is probably there for convenience. You will typically want to control your normals from within your 3D editor instead. Hint: A sculpty has only a smooth surface by definition. We will see later, how we can get really sharp edges on the model without using ugly tricks like duplicated loops…

Tip:
You should take care to tweek the LOD settings such that the number of vertices is reduced roughly by a factor of 4 for each LOD level. That seems to give you the least Prim costs. Later we will see that adding a Physics shape may also affect the prim costs. Exact values are currently not determinable. I will add more about prim costs when this data is available.

So after tweeking the LOD-generator, we see that we can get slightly better:

But this is still not very convenient result. So we will try next to make our own LOD versions.

Step 3 Mimic Sculpty LOD

So let us sit back for a moment and look at how LOD is calculated for Sculpted Prims. Then maybe we  want to try if we can get the same LOD behaviour as we have for the sculpty by creating our own LOD files according to how sculpty LOD is implemented ? The approach is straight forward. We still have the “old” sculpty mesh on which or kettle is based. And that mesh can be LOD reduced easily by simply removing every secnd row/column of vertices… We end up with 4 “Sculpty like” LOD levels as follows:

Ok, I “cheated” a bit. When you look at the lowest LOD0, you see that i made it slightly better than the original LOD0 level. I kept 8 faces around the circumference while the sculpty LOD0 only has 6 faces along the circumference. But hold on!

This is not “cheating”… This is “optimizing” !!! Yep. Here is the first really important thing to know about meshes:

Fact I: You can optimize the LOD behaviour to your needs.

You can decide if you want to have LOD at all.
Or you can decide to make very radical LOD settings.
Well, you could go to the extreme and even use LOD as a method
for creative artwork, like for example a box been closed when seen
from far away, but opened when approaching it…

You can do all of that with meshes. With sculpties you are bound to the automatic LOD calculations… But beware, this new freedom has a price, see further down!

For now let us procced and upload and examine how our mesh object changed after we defined the differnt LOD’s as described above. So we may expect to see a slightly better LOD when going really far away. We will later see that there is still much room for optimization here. But let us do one step after the other.

Here is our result:

So apparently we can make meshes as good as sculpties. But why would we want to do this ? Why not just keep with the sculpty and be happy ? And can we get even better with mesh than with Sculpties (yes we can, see fact I above)? And … what about the costs of this mesh compared to the costs of the Sculpty ?

As i said, one step after the other. Keep patient…

First let us check the prim costs. Rezz the kettle and see how many Prim equivalents we have to give away for it:

 

So from the block of 4 values i believe the upper left value is the one we have to look at. So this kettle has a prim cost equivalent of 4… oh, this is unexpectedly high… You may be tempted to ask: “Now after we worked hard to make all these extra LOD meshes and uploaded 4 files instead of one, we get something equivalent to a sculpted prim, but we have to pay 2 times more for it compared to 2 sculpties (kettle and handle) ?”

This smells a bit like “maybe we have overlooked something…” And yes! We need to know about one very important detail, namely the physics properties of our object.

Step 4 Physics Shapes

We did not specify any physics properties and this (currently) causes the importer to silently use a very detailed physical definition of the object. That means, your object will react on physical interactions (for example bouncing into it, walking over it…  And here we have the cause of the high primcosts. Having a very detailed and acurate physics shape will cause the physics engine on the server to do an awfull lot of calculations to determine if another object bounced on our mesh.The more acurate we define the physics boundaries of our object the more reaöistic it will react.

Fact II: You can optimize the physics shape to your needs.

You can specify how acurate the physics engine shall handle your object.
In most cases it is sufficient to use a very rough approximation of your
visual model for the physics model.
The less complex we choose the physicsl model, the less it will cost to rezz it.
You can have a very acurate physics model if you need it. But that is a real
cost booster.

Here is the Physics shape of our kettle as it is used right now:

  • The leftmost shape is what the mesh importer calculated from the LOD3 shape of the mesh. Note that the dip in the kettle has been closed and Actually what you will get is a very primitive physical shape (a convex hull) which has no holes in it but roughly follows the outlines of your object.. Having convex shapes makes object-object collision calculations very easy.
  • The middle image shows how the physics boundary is placed on the kettle
  • The rightmost picture shows that a bunch of physical objects seem to hover over the kettle and do not fall into it. That is because the physics shape is Convex

Often you do not at all need the accuracy as used by default. And sometimes you will want to have more accuracy, or even a differnet physics behaviour than predicted by the visal appearance. And fortunately you can define your own physical shape. Now  we can make te physics shape a bit easier using less faces around the circumference:

Obviously the physics mesh has got an influence on the prim costs. But still we see the costs for this mesh are more than the costs for the sculpty. Can we get further down ? I think so. Let us examine the model. It is made of 2 sculpted prims. And it translates to 2 mesh objects. Let us take a deeper look at the physics object. Do we really need the handle ? We can live without it regarding the physics. So we want to remove it. But that is not so easy! Because the handle is an object it MUST have a physics mesh. So our next level of optimization is:

Step IV: Merge the Objects

Now we have mesh. And many constraints of Sculpted Prims no longer apply. For example the number of faces is no longer limitted.

Fact III: You can use as many or as few faces as you need.

Any number of faces is allowed (from 1 up to about 64000)
You can use triangles as well as Quads
You can use submeshes (2 or more not connected meshes)

So let us get back to our model and make it one single object, then remove the handle from the physics mesh and see:

 

Step V: Optimize the mesh

Now we are at the end of Sculpted prims. Here is where we eventually enter the wonderfull world of Meshes. We already have touched a few exciting differences between Sculpted Prims and meshes (see Fact I,II,III above). Now we have to go deeper into detail. The challenge is to keep the look of the kettle as good as possible (or maybe even make it better if that can be done) but at the same time reduce the number of faces as much as possible. Here we will find a lot of play ground and a lot to learn about 3D modelling. let us begin… NOW!

First let us get rid of the most annoying issue with Sculpted Prims. The poles! We do not need them any longer. We can remove them by removing all duplicated vertices on the mesh.

Fact IV: Collapsed vertices are mostly unwanted!

You can remove the poles on your objects.
Remember that the poles are artefacts coming from the way
how sculpted prims have to be constructed.
And rember what a mess you get when texturizing around poles ?
You can forget this problem now. In almost any case it makes sense
to remove any collapsed vertices…

However there are situations where collapsed vertices make sense,
e.g. when you want to combine sharp edges with smooth faces. But
this will be discussed elsewhere (it will be adressed in the Mesh IV tutorial)

Now we can further optimize the mesh and remove obsolete faces. For example the end points of the handle use so many faces which we really do not need. We can remove them too:

Here we saved 8 faces and another 8 faces on the other side of the handle.

Fact V: Adding edge loops for LOD is not needed!

Sculpted Prims have a very clear and understandable way to handle
LOD (Each lower level removes each secnd edge loop in x, any y
and thus reduces the number of verts by a factor of 4. Hence you
need additional edge loops in order to keep surfaces from collapsing
in the next lower LOD.
This is no longer needed with Meshes. We now can create our own
highly specialised and optimized LOD meshes as we need!

However there are situations where collapsed vertices make sense,
e.g. when you want to combine sharp edges with smooth faces.
But this will be discussed elsewhere (it will be adressed in the Mesh IV tutorial)

We also can smooth the mesh as we want, because the spacial resolution of meshes is almost infinite compared to what we are used from Sculpties. In other words, we can place our vertices where we want with very high accuracy. So we no longer suffer from unexpected rough surfaces. We will get exactly what we have modelled! Here i smoothed out the handle a bit and optimized the number of used faces (the dark mesh is the original from the Sculpted Prim, the copper mesh is the new smoothed mesh (and it is still not as nice as it can be, see further down):

 

Fact VI: You can define your own face desnity.

You define where you want more faces.
Or can remove faces which are not needed for the model.

Fact VII: You can place vertices with high precision.

You have a much higher precision regarding the placement
of vertices. Now high precision is built in meshes and does not need extra effort.

Hint: As we come from a Sculpted Prim, we optimize a mesh which is already
distorted due to the constraints of Sculpted Prims. I will show you further down
how to construct the handle from scratch and get even better quality.
But be patient, we are not there…

We also can get rid of a couple of edge loops on the kettle. Those loops are there only because the Sculpted Prim needed them to ensure good LOD behaviour. But since we can define the LOD behaviour now exactly as needed, we can delete many face loops now without getting any degradation in the visual look on any LOD level.
Just removing the obsolete edge loops from the inner part and from the bottom of the kettle reduced the object from 1280 faces to 888 faces.So: Without much effort we can reduce the face count on LOD3 significantly!

After we have removed all unnecessary edge loops, the kettle looks like this:

Some Remarks:

  1. So our kettle now contains about 900 faces. But let us try to get further down with the face count without loosing shape.
  2. While we can remove the edge loops from the large flat surfaces without getting visual problems, this is not true for the vertical edge loops. We will loose a lot of smoothness particularly at the edges. But i will use a trick here. Until now we have only worked with rectangular faces (Quads). You will see in a moment where we now will need some triangles.
  3. The handle still looks a bit unpleasant and we will later want to make this better.

So we will now reduce the vertical loops, but we will keep the top edge and lower edge untouched. In the image to the left i have marked all loops which i want to cut away. Please take an extra look at the ends of the loops after the loops have been cut away (next image).

And this is the now optimized kettle:

I have highlighted the edges where i have introduced triangles. this sort of optimizations could not be made with sculpted prims, but with meshes nobody can keep us from using triangles to increase face density where we want and to decrease it where we do not need as many edges.We are now down at 700 faces which is a reduction of roughly 45 %. And still the kettle shape has not significantly degraded.Let us now take another look at the handle. I want the handle to remain smooth. So i need a lot of faces to keep it smooth. But i still can save a few. The handle now is made of 8 faces around its circumference. I think we can live well with only 6 faces.Since the handle is already a bit distorted, let us just remodel it right in place.
  • I started with a cylinder  with 12 faces along its longitudinal axis and 6 faces around its circumference.
  • i bended it into a quarter of a circle
  • then i extruded a few loops to create the 90 degree angle and the end cap (see zoomed in part on the image)
  • Finally i copied the entire mesh, mirrored it and stitched it together to create the entire handle.
  • See that i only used 3 faces on the end cap of the handle.
  • And since our final kettle shall be placed above a fireplace, we will readjust the handle to go straight upwords.

 

 

And here is our final result. This kettle has  1130 Triangles (compared to 2560 triangles for the original 2 Sculpty kettle). We have still place for optimizations here. But we have now learned a few tricks how to get a mesh face count down a bit.If you need even lower face counts, you can cut the kettle down to 600 triangles and still get something that looks like a kettle, although now we start seeing visual degradations. It is up to you how far you want to go and with how much of visual degradation you can live. For the purposes of this tutorial we are now at the end of the optimization part. The next step will be all about Creating LOD meshes.Note that i have changed the material of the kettle body to copper. So we now have 4 materials on the kettle:

  1. Handle
  2. Kettle Body
  3. Kettle interior
  4. Kettle bottom

The material settings will now become relevant.

Fact VIII: You can have up to 8 texture faces with meshes.

Remember that for your Sculpted Prim kettle you had exactly one texture face ?
Our mesh kettle has 4 texture faces! And it could have up to 8 texture faces if we needed them.

 

Step VI: Create the LOD meshes

Remember for one moment our very first try. We can take our mesh and simply let the LOD-meshes be generated automatically. That may or may not lead to acceptable results. In all my attempts to generate some reasonable and cost efficient LOD i failed so far. Maybe it is worthwhile to examine the LOD-generator in more detail. But this is another story. So let us concentrate now on how to reduce our mesh.

We have to take care about 3 issues now. Unfortunately we can not get away with them separately, so i first will introduce them here and i will recall them wherever it makes sense:

  1. Radical LOD reduction: The reduction for each LOD should be as radical as ever possible. A very good rule of thumb is to reduce by a factor of 4 for each subsequent level. So we should aim to only see about 280 triangles on LOD2, 70 triangles on LOD1 and 18 triangles on LOD0. Now we have already reduced LOD3 quite a bit, so it will become very hard to achieve those numbers and we will not be able to get there without reducing the visual experience. However in this tutorial i will not go to the limits and i will keep the LOD reductions moderate. This works quite well because the kettle is only a small object and small objects are not very expensive.
  2. Number of Material settings: We have to take care that the material settings of the kettle remain intact in all LOD shapes. That means: each material i have used on the LOD3 mesh must(!) also appear somewhere on the lower LOD meshes. This is an unbreakable rule and it will be tested by the uploader. So for example if you wanted to remove the handle of the kettle in LOD0, then the importer will complain about incompatible texture face count. The only way to get out of this is to keep at least one triangle assigned to the texture face in question. You can hide this triangle somewhere and/or make it very small, if it does not add to the visiual epxperience.
  3. UV-Unwapping: We have to take care about UV-unwrapping. It is evident to know that the UV-map used on the LOD3 mesh will be reused on all subsequent LOD levels. And that means, whatever UV-map you used for the LOD3, you have to take care,that the subsequent LOD meshes can be texturized with the same UV-map. That may sound complicated first, but (at least with Blender) it is not a big problem to get compatible UV-maps as long as the meshes look roughly similar. But since that is actually what we want, we problably are on the safe side here. However note  that you are not obliged to use the same shapes for all LOD meshes. So you could make some creative usage of objects changing their shape with distance. But that is also another story and will not be covered here in detail.

So, in order to prepare our mesh for LOD creation, we first…

Define the seams

The seams define and separate different regions of the mesh from each other. Seams are actually used in multiple ways and we will use them in our context mainly for 2 reasons:

  1. Seams are very helpfull for UV-unwrapping. In fact when we try to unwrap the kettle without defining seams, we end up in a complete mess. If you look  where i have actually set the seams you may instantly get an idea how to use them for your own objects.
  2. We have used 4 materials on our kettle. Defining seams makes it easy to keep the different material areas visible during our LOD reduction activities.

So here are the seams and these are mostly dictated by the material distribution:

Remember that the sculpted Prim has only one seam which would run from the center of the kettle bottom to the center of the kettle interior ?

Fact IX: You can have your own UV-map

With meshes you have the full freedom to define your own UV-map.
That means, you are no longer forced to reuse the given UV-map
of Sculpted Prims. And that means you can unwrap your objects
exactly as you want and according to the shape itself.
On the downside, you must know how to make good unwraps.

Please note that i have added one seam which runs vertically through the kettle body. This seam is needed to keep the UV unwrapper from doing weird things. You can try what happens without that seam and compare to the results i will show you in a moment. Also note that i have added 2 extra seams at the end caps of the handle. This is again only done to give a good hint to the unwrapper tool. The remaining 2 seams along the kettle bottom and along the kettle interior are mostly needed to mark where we have to take care on the different LOD levels. But they also help the UV-unwrapper to make a nice and easy texturizable UV-map for us.

Unwrap the mesh

After we have marked the seams, we should now unwrap the mesh. This is not relaly needed at this moment for making the LOD meshes, but it is a good idea to create the UV map now and see if the unwrap is god, or maybe we ned to tune the kettle mesh itself to get better results and avoid possible problems. Maybe we also need to add more seams.

But i have given you already a good set of seams here. I probably will make another tutorial about unwrapping and there i migt get deeper into seams…

Here is what the Blender unwrapper produces mostly automatically:

  • On the left side upper part we see the handle.
  • The small circle in the upper right is actually the kettle bottom.
    I have scaled down that part a bit, because the kettle bottom
    will not contain high detailed textures.
  • The next part of the left UV-map contains the kettle body.
    So most of the texture is reserved for the outer circumference of the kettle.
  • There is a secnd UV-map on the botton left. this is reserved for the kettle interior.
    I have separated this part into a separate UV map
    because i later want to add simple plain fotos into the interior
    and thus make my life very easy regarding
    what i am going to cook next…
  • Please note that i have tweeked the UV map by hand as follows:
    I slightly rearranged the map for the kettle body so that it is now perfectly rectangular.
    I did this only to make my life easy later, when i adjust all lower LOD-maps
    so that i can reuse the texture of the LOD3-map (this one here) with very little effort.

We are now ready to bake the texture. I use blender here and its algorithmic texture building capabilities. For the kettle body i used a copper material and for the kettle handle i used a simple clouds structure just to give it a bit of structure. Nothing special:

I will later reuse this texture as my guide for the  UV-unwraps of the lower LOD meshes. And after baking we are indeed finished with the LOD3 mesh, with the Unwrapping and even woth the texture baking. Now our only remaining task is to create the lower LOD meshes.

Create the LOD2 mesh

I first make a copy of the LOD3 mesh, then i reduce edge loops just like i already did when i optimized the LOD3 shape.

I reduced the handle from 6 faces to 4 faces around its circumference. And i removed every secnd vertical edge as marked on the LOD3 kettle (upper part of the picture). I also removed some horizontal edges. The result (seen on lower part of the image) is till very well defined. But we start seeing degradations now. But this does not make much trouble because the LOD2 mesh will only be used when the kettle gets smaller (or further away). But still be carefull. You will want to keep the overall shape as intact as possible again.

Then i readjust the seams so that they cut the kettle into the same pieces as we have used in the LOD3 shape. Now let us unwrap this new kettle and match the new UV-map to the already existing map from LOD3:

Now you can see why i have choosen to make the initial UV-map rectangular. It is not too complicated to do this adjustment and keep the kettle look almost identical on both LOD levels.

We continue as before and create LOD1. Here is the mesh and the adjusted UV map:

I have again significantly reduced thehandle and the kettle body. But still i have clearly defined the kettle shape. I will change this for the LOD0 mesh. The main reason is that the LOD-0 mesh creates the most resource costs. this is so because the LOD0 mesh is always visible independent on the distance between the camera and the object. So making this mesh very small will result in a better price.

If we take care we even can find a LOD0 which matches perfectly to the body. In our case i have oversimplified the mesh:

But it still is good enough for our purpose. We now have only 21 remaining triangles. Note that this version of the mesh has its interior at the top edge of the kettle. This is not optimal but it saves a pretty lot of triangles. And that is absolutely recommended on LOD0.

After importing this mesh and the textures to our online world, the final result looks like this:

 

Any open questions ? Then please feel free to ask. I will be happy to get any response and suggestions for enhancements or pointers to parts which need more explanation.

Cheers,
Gaia

19 Enlightened Replies

Trackback  •  Comments RSS

  1. max says:

    this is so wordy wtf

  2. Aragorn says:

    Continuing on my last question, I think I understand now that the error has to do with defining the regions that correspond to the up to 8 texture faces the a sl mesh can have. Each level of detail must have the same number of “regions” defined. I tried by setting polygon face selections and applying textures to them, but I guess that wasn’t enough because I still get the same import error, I’ll try by setting the UV seams for the 8 different areas…

  3. Aragorn says:

    Very good tutorial, I have used it to experiment with my first mesh import. I am having some difficulties however. I designed a chinese checkers board, which since it has a high number of semispheres sculpted into the top surface, starts out with a very high number of faces. I then proceed to lower the face count for the next LOD levels by sculpting half-cylinders instead of semispheres, each level with a lower face count on the half-cylinders.
    When I go to import my highest level mesh, it seems to be recognized quite well in the second life preview window. But as soon as I indicate my lower level mesh files, I get an error along the lines of:
    “there are different numbers of faces with textures for the various levels of detail”.
    (My interface is italian so the exact error is: “ai vari livelli di dettaglio corrispondono numeri diversi di faccette con texture”).
    I have no idea what this means, I have not included any kind of texture information for the time being…

  4. Shy Robbiani says:

    Yet another of your excellent tutorials. When I started the mesh-importer for the first time and realized the prim and upload costs I turned away and thought I’ll never use mesh. But now I’ve got a completely different understanding. Keep-up the good work!

    Thank you
    Shy

  5. Pix Jigsaw says:

    Thanks for the tutorial. Just the info I was looking for (and I picked up some useful blender tricks in the process). Your excellent work is appreciated.

Post a Reply

Your email address will not be published. Required fields are marked *

Top