Accessories v1.2
Accessories are products that can attach themselves to a bone in an avatar’s skeleton. This means that you now have the power to make watches, halos, wings, PETS. Anything! The power is in your hands.
NOTE: It is very important that you work from and save all of your files to IMVUtools/Previewer/Examples. This is because certain products (like Avatar Body Patterns and all derivations of any product) rely on the existence of other products to run in the previewer. So, please avoid the headache of dealing with this bug by simply working out of the Examples folder we provide. That said, it is also VERY, VERY important that you save all of your finished products and source files anywhere but IMVUtools/Previewer/Examples as uninstalling the previewer or installing a new version of the previewer will cause this folder to be deleted.
Now on to the How To.
1. Building the Skeleton, Mesh and Material
1.a Download the base Avatar Mesh
For the purposes of this document, we will be using 3DS MAX 7 as the default 3D editing program. Start MAX and open the base avatar mesh that you wish to add an attachment to. The base avatar meshes that IMVU, inc. has created can be found in the various Weighting.ZIP files found on our Developer site. These files are called:
FemaleWeighting.ZIP
MaleWeighting.ZIP
You will NOT actually use or export any piece of the original base avatar mesh or embedded avatar skeleton. You are building an Accessory and accessories contain their own skeletons and meshes. You need the avatar mesh and embedded avatar skeleton for placement/alignment only. Although it is highly recommended that you use the embedded Accessory skeleton, you COULD create your own from scratch if you like. The Accessory meshes found in the example files, typically a pair of glasses, are there as an example of how an Accessory can be weighted (using the Skin modifier) and to give you a functioning example of an Accessory Multi-Sub Material.
NOTE: Save this file with a new name, as you may need to merge facets of the original example 3D file into your new file if a mistake is made.
1.b Build your Accessory Skeleton
You may always use the embedded AttachmentRoot bone/node for your Accessory. All you need do is align it to the avatar bone with which you want your attachment to move. For example, if you want to build a bracelet, you would not align your AttachmentRoot bone/node to the avatar’s Head bone. Rather you would align it to one of the wrist bones.
1.b.1 Pets
If you want to make a pet that moves on its own (without the influence of the avatar’s idle animations), you will want to align the master root of your Accessory skeleton (usually the AttachmentRoot bone) to the avatar’s master root bone (called Female03MasterRoot).
1.b.2Building your own skeleton
If you would like to build your own Accessory skeleton, you may do so. The accessory skeleton can be VERY simple. Whether you are using the Skin or Physique modifiers, you must build two bones/nodes. These bones/nodes can be called anything you like. One will be your master bone (or, the top of the hierarchy) and one will be the bone you actually weight the mesh to. I prefer to have the master bone called AttachmentRoot. I prefer to call the second bone AttachmentNode. Link the AttachmentNode bone to the AttachmentRoot bone. Now align AttachmentRoot to the avatar bone you wish your accessory to attach to. THEN, either align AttachmentNode to the same bone in the avatar skeleton OR align it to AttachmentRoot. Either way, AttachmentNode will end up in the same spot. Now you can weight the mesh to your heart’s content.
NOTE: If you are building something that is meant to move with one bone only (Glasses, Earrings, etc.), weight all of your vertices to that bone in the ACCESSORY SKELETON.
EXTRA SPECIAL NOTE: Your Accessory mesh should never be weighted to any bones in the avatar skeleton. Your Accessory has its own skeleton (which you just created). If you weight your accessory to anything but the accessory skeleton, it will not work.
1.c Build your Accessory Mesh
1.c.1 Accessory skeleton location
The first thing to realize about building an Accessory mesh is that the location of the Accessory skeleton master root matters a lot. If you want your glasses to show up on the avatar’s head in the Previewer, you need to have your Accessory skeleton master root bone aligned to the avatar’s head bone before you weight your glasses. So, to recap:
- Align your Accessory master root bone to the bone in the avatar skeleton that you want to influence the Accessory.
- THEN weight your mesh to the Accessory skeleton.
1.c.2 Accessories for Avatar heads
If you are building an Accessory for an avatar head (glasses, earrings, horns, etc.), there are a few things to keep in mind. First is that the current IMVU head products are all built around the same basic head shape for Male or Female products. The difference in all of the heads built by IMVU is only found in the size of the head and the shape of the face. Specifically, the cranium, bridge of nose and ears do not move from head to head. This allows each head to use all of the pre-existing Accessories without glaring aesthetic bugs. However, this means that things like facial jewelry, beards, mustaches, fangs, etc. will not look right from head to head.
1.c.3 The sky is the limit
Your Accessory can be anything you like. Check out the IMVU catalog to see some of the ingenious Accessories our other Developers have created. All of these have been built in the IMVU Previewer. EXCITING!
NOTE: The mesh for your Accessory can be very close to the mesh for the avatar. However, if they are too close you may get Z fighting (or shimmering) in IMVU. It is worth testing in the previewer. If you see Z fighting in the previewer, you will see it in IMVU.
1.b.1 Vertex Colors
fig1.2 – Vertex Color editor in the Surface Properties Menu
Vertex colors allow you to tint or darken the appearance of a portion of your mesh at runtime without having to manually paint in shadows on your texture. A vertex color blends evenly from the colored vertex A to the color of the next vertex B. If the color of B is white, the blend from A to B will go from 100% colored to 0% colored. This is especially handy if you want to keep your overall CFL file size down but want shaded and lit parts of a tiled texture.
To add vertex colors, go to edit Vertex mode in either the Edit Mesh or Edit Poly modifiers. Then, select one or a group of verts. Go to the surface properties menu and click on the white bar next to the word Colors. This will bring up a color picker. Pick your color, Close the picker and voila. Colored vertex. Vertex colors are not visible in MAX so you just have to have faith in the color, export the .xmf mesh file and load it all up in the Previewer. The vertex colors are activated per material vs. per mesh so please refer to the Previewer section of this doc for more info.
NOTE: There is a runtime cost of having one vertex color blend into another vertex color (as opposed to blending from color to no color) so beware and use vertex color blending sparingly.
1.b.2 Animation in Accessories?
YES! For more on animation, go to section 1.g.
1.b.3Building and Hierarchy
Your mesh should not be parented or linked to any bones in the scene. However, they should be weighted to bones in the scene.
Once again: No to parented or linked. Yes to weighted.
If you want portions of your Accessory to animate and you want to see the mesh animate, you should weight the mesh to the appropriate bone in the Accessory skeleton. You will have to do this anyway for proper exporting of the mesh.
1.c Mapping Your Mesh
Texture mapping in any 3D program is an art all its own. However, there are a few IMVU specific things that you ought to know before you can export.
1.c.1 One Multi-Sub Material
If you are using MAX, you may only have one material on your model. This material can contain as many sub-materials as you like and can therefore be a “Multi-Sub” material. If you are using another 3D program, it is likely that you will have to have separate top level materials. This may result in your needing to have more meshes than described in this document.
1.c.2 Multi-Sub Material naming convention
What follows is from the IMVU Developers forum:
“When creating your materials for IMVU products, you must follow a simple numerical naming convention in order for your textures to show up in the previewer. Each material name must contain a bracketed number at the end of the name.
For example, FrogTexture [2]
The number contained in the brackets is always one number less than the material index in MAX. Therefore, every time you have a material in index 1 in MAX, that material's name must contain [0] at the end of its name. If the index is 6, the convention is [5]. If the material is 10, the convention is [9] and so on. It is actually pretty easy once you know what to do. It is also easy to forget if you've never done it before. Very easy.” (see fig 1.3)
Another thing to consider when naming your sub-materials is that they need to be consecutively numbered. You cannot have four sub-materials number [0], [2], [7], [22]. If you have four sub-materials, those materials must be numbered [0], [1], [2], [3]. Otherwise, you will end up with a product that will eventually not load. (see fig 1.3)
Fig 1.3 – Example of Material Editor and Sub-Material layout from MAX
1.c.3 Alpha
You can use both Cutout and Alpha blending in IMVU. Just add an opacity map to your material in MAX then, in the Previewer, you can choose the alpha setting you want.
1.c.4 HIGHLY Recommended Texture Guidelines
IMVU imposes only a limited budget on your texture usage: Any texture sized larger than 512 pixels on a side gets automatically reduced to 512 pixels on that side or lower. We do recommend the following guidelines to providing your customers with a decent IMVU experience.
- All textures are required to be powers of 2 along a given side.
- No texture should be greater than 512x512 pixels (this is actually a very helpful guideline as the larger your texture, the worse it looks in the IMVU window. This is due to IMVU having to cram all of your texture information into just a few pixels. Better to play it safe and keep your texture small and, surprisingly, more legible)
- In the IMVU rendering engine, it is far better to have many small textures rather than one big texture. This runs contrary to many other engines wherein puzzle-like texture collages are used to save rendering budget.
- Although we haven't hit a tiling limit yet, it is recommended that you keep your tiling down to 40 or so times.
- .jpg is the file type of choice. There are a plethora of file types that we support but we have found .jpg to be both the best tasting and most filling.
1.c.5 Ambient Color
It is possible to dilute the color of your sub-material using its embedded ambient color setting. To be clear, this is the ambient color setting that is actually part of the sub-material and NOT the Scene ambient.
IMVU exports the ambient color that you can't see in your 3D program so, when you load your sub-material file in the previewer, you may be startled to see that your once bright and happy colors are now grey and sullen. The fix is simple: every time you create a new sub-material, make sure all of the sub-material's light settings are set to pure white. Pure white = no ambient interference. (see fig 1.4)
Fig 1.4 – Change the material colors to WHITE in order to avoid dull textures in IMVU.
1.d Animate your Accessory
Accessories with animations make IMVU come alive. However, this is not the time or place for an in depth discussion on how to animate in your 3D program. Rather, let's just say that if you know or can learn how to animate, you can make some really killer Accessories. By “animate” I am referring to both skeletal and morph animation. Skeletal animation refers to translating or rotating a bone that has vertices weighted to it over a linear timeline. Morph animation refers to playing one or a series of morph targets over a linear timeline. For example, if I wanted to animate an avatar flexing his bicep, I would use skeletal animation to actually move the bones (and thereby the mesh) to the right spot and then use a morph target to scale the bicep portion of the mesh.
1.d.1 Action Files
An Action file is what is played when anything in IMVU is animated. There are two levels of Accessory Action file, an Idle (or constant) Action and a Triggerable Action. When building a Accessory animation meant for a triggerable Action file, it is important to remember that you can use the Loop Frame functionality in the previewer to add length and life to your animation. For example, it may not be necessary to export an animation that includes, say, a slow, bobbing motion over and over. Rather, you may be able to simply loop one bob over and over again in the Previewer. This will help keep your Accessory animation file size way down but still get the desired effect. For more on Action files, please refer to section 3.g of this doc.
In regards to skeletal animation, the longer your animation, the larger your exported animation file will be and therefore the overall size of your Accessory will be higher. The same holds true for morph animation with the additional concern of the more morph targets you have in your exported file, the larger your file will be. But don't sweat it – have fun and create your vision. The Greeny Baby Dragon by IMVU is only @83k and it contains several skeletal animations.
1.e Smoothing Groups
NOTE: In order to avoid geometrical looking meshes in IMVU, it is important to make sure that all of the smoothing groups for a given mesh are the same across all polygons. To set the smoothing groups, select your geometry in a sub-object mode (faces, polygons, etc.) and go to the smoothing groups section of the Polygon Parameters panel. Note the rows of consecutive numbers. If you cannot see a number on a given square, then it is active and not the only number active. Click on all of the unseen numbers until you can see them all. Then, choose the number that you wish your smoothing group to be (any number is fine as long as all of your geometry is the same number).
Fig 1.5 – Incorrect looking Smoothing Groups Correct looking Smoothing Groups
1.f Weight your Mesh
The term “weighting” a mesh refers to the act of attaching a bone's influence to a particular vertex. Weighting a mesh can be as much of an art as painting a texture, mapping that texture or building the mesh itself. Though in some cases it is quite simple, it often requires patience and skill, as sloppy jobs are immediately evident. The two major weighting modifiers in MAX are called Skin and Physique. Both modifiers now ship with MAX 7 while Physique requires a license for versions 6 and below. Each modifier has their strengths and weaknesses. Namely, Skin is the best for weighting any non-organic mesh. Skin's envelope system is super fast and not as error prone as Physique. Physique, on the other hand, works much better for organic meshes like avatars or puppies. I love puppies.
For the most part, Accessory weighting will be done in Skin so I will briefly describe how it’s done here.
1.f.1 Weighting using Skin
First up, select your mesh and apply a Skin modifier to the top of the stack. Within the Skin modifier, click the “add” button and add AttachmentNode to the bone list. Now click the big button labeled “Edit Envelopes”. Check the Vertices box and uncheck the envelopes and Cross Sections boxes. In the veiwport, click and drag over all of the vertices in your mesh to select them. Back in the Skin Parameters menu, scroll down to Weight Properties and uncheck the Normalize and Rigid Handles boxes. Then check the Rigid box and drag the Abs. Effect arrows to the numeric value to 1.0. Unclick the big Edit Envelopes button and, voila, your mesh is now weighted. (see fig 1.4)