THIS PRODUCT IS FOR MESHERS ONLY!!


This is a tool to perform a number of useful actions with your XMF files. It’s two main functions are:


a) Create beautiful default textures based on face normals
b) Vertex Painting


In addition, it allows you to:


c) Flip shading and normals on submeshes
d) Quickly change the material number of any submesh
e) Export a submesh as an independent XMF
f) Import a submesh to form part of an XMF
g) Remove a submesh from your XMF
h) Add a ‘skin’ submesh for items derived from the ‘Empty Clothing’ derivable 


The CAST utility has the following appearance, with the controls numbered so they can be referenced below:




Each of the functions is considered in turn below:


a) CREATE DEFAULT TEXTURES

This tool will create a beautiful default texture for your meshes. The texture colours are based on face normals – which is to say that each triangle is coloured according to the way it is facing. There are some utilities available for 3ds max that create similar textures for you, but they have some disadvantages, such as leaving black lines around the seams, creating discrete (not blurred) borders around the faces, and a limited colour palette. This tool is designed to overcome those drawbacks.
By way of example, load the familiar default top into the tool by clicking button (1). You will see the following:



Save the image as a texture by clicking the 'Save image' button (15). Load the XMF into the previewer and apply the texture. You will see this:



Note that there are no black lines around the seams, so no posterior editing is necessary to erase them.
However, each face (triangle) in the mesh has its own colour, which makes the mesh look less smooth. The solution to this is to blur the texture. Take the blur slider (25) and move it across to the right to about half way. You will see the blur effect in real time. If you export the texture and apply it to the mesh in the previewer, you will see a smooth gradation of colours, much like this:



Note the difference between this and the unsmoothed images above.

As in this example, the CAST utility creates textures for XMF meshes as if the were illuminated by three lights. A red light shines from the right, a green light shines from behind, and a blue light shines from above. You can change the intensity of these lights by using the R, G and B sliders (buttons 17, 18, and 19). For instance, with G set to to 50%, and R set to 0%, the texture looks like this:




By removing the blur, removing all but green and activating the 'Wire' checkbox (20) , we obtain:




The 'Mono' checkbox (22) produces a texture as if the mesh were lit by a white light from above. Note at this point that the width and height sliders (23 and 24) can be adjusted to produce standard-sized textures:



Not only can you adjust the intensity of the lights, but you can change the directions they shine from. This is done using the 'trackball' (16) which you can roll around with your mouse. The following are example of some lighting effects that can be obtained by adjusting the trackball and other controls:









  If you find a setting that you like, click save (26) under 'Settings' on the right. This will allow you to save a little xml file on your computer, so you can use exactly the same lighting conditions for other meshes in the future. Load a previously-saved file by clicking the 'Load' button (27). The button underneath, called 'Front' (28) returns the trackball to its initial position, thus re-setting the light angles.

Mentioned above was the 'Wire' checkbox (20). This can be used with or without the 'Fill' checkbox (21), but you would normally use it without a blur. The wire colour can be changed using the 'Wire' colour-picker (13). You can also change the colour of the background using the BGrnd colour-picker (12), or load a background image using the 'Load image' button (11). These backgrounds can be removed by clicking the 'Clear' button (14):

 





The ability to change the background is not just to produce funky-looking UV maps. If you use the blur, slider the background and the filled triangles are blurred together, which is noticeable at the UV seams on the 3D model. Mainly though, the ability to load a background image is for vertex painting, which is discussed below.

As a final example, here is a dress of mine, with beautiful CAST textures applied to it - and here with 'self-illuminated' activated in the previewer, to hide the normal shadows:









b) VERTEX PAINTING


Vertex painting, or vertex shading, refers to the way in which, in IMVU, a vertex can have its own colour – independently of the texture applied to the mesh. Since vertex painting isn't used much, this point is worth stressing: the vertices in a mesh can all have their own colour - regardless of the texture you apply on top. In fact, by default, all the vertices are generally coloured black, but we usually tell the previewer/client to ignore the black, by making sure that the previewer's 'Vertex colors' checkbox is not activated. When the 3 vertices making up each triangle in a mesh are different colours, the inside of the triangle blends between the colours like this:



Remember: The colour information is stored in the XMF file itself. When you have a mesh that contains painted vertices, the vertex colour and the texture blend together.

One disadvantage of vertex painting is the resolution. Since all you can specify are the colours of the verts, the resolution of any image is limited by the density of vertices in the mesh. Low-poly meshes -of the type that are better for IMVU- mean low resolution. On the other hand, vertex painting is 'free' (it does not add to the product size), and is great for 'baking in' shadows, giving a colour 'cast' to you mesh, or enhancing or replacing the effects or lighting.

The CAST utility takes a jpg and an XMF. It then looks for the colour of the pixels in the jpg in the place where they appear in the XMF's UV map, and applies that colour to the vertex in the XMF.

To illustrate this I created a plane in 3ds max that had a resolution of 60x60. Of course there is no need whatsoever to use a flat 60x60 plane in IMVU - a 1x1 plane will do just as well (and be lighter on your machine), but for example's sake, I wanted a high-density mesh, with tightly-packed vertices.

I loaded the XMF into the CAST utility. As expected, the utility created a default texture (see 'Create Default Textures', above), but it's a rather boring one, since all the triangles in the plane face the same way, and so are painted the same colour =)

To use the vertex painting, deactivate both the Wire (20) and the Fill (21) checkboxes - so the image area (30) is blank. Click on 'Load image' (11) and load an image. I loaded a picture of the Mona Lisa (all images adjust to fill the available area):



Once the image is loaded, all that remains is to click the 'Paint verts' button (10), and save the updated XMF file, clicking 'Save XMF'(6). On loading the mesh into the previewer, you see this:



Remember the mesh pictured above has only a blank, white texture - the image you see is all done with vertex painting!

 

The following example is more practical, and shows the effect of combining textures and vertex painting.

I made a series of 5 low-poly columns in 3ds max, each one in its own submesh, but all with identical UV maps and the same material number (which I set to zero).

In the previewer, they look like this:



and all have the same UV map:



On loading the XMF into the CAST utility the default coloured texture appears for the first submesh:



Notice the sub-mesh drop-down menu (7) which allows you to change between the different submeshes in your XMF.

I unclicked the Fill checkbox (21) so that the image area went blank. For the first submesh, I loaded in an image (below), and pressed paint verts. I then did the same for the rest of the submeshes (5 in total), using these images, one for each on my columns:

 











The idea here is to shade the vertices in the columns to create the appearance of darker columns at one end and lighter columns, as if they were progressively shaded.

I saved the updated XMF, loaded it into the previewer, and activated the Vertex Colors checkbox. The columns now appear with the gradual shading:



Finally, I applied a simple texture to the mesh, which appears on all the columns (since the UVs and material number is the same on all the columns):



Above, you can see that the texture on all the columns is the same, but they are nonetheless different due to the underlying vertex shading. If someone were to derive from these columns, they could apply a new texture, but the shading would remain (unless they unchecked the Vertex Colors checkbox in the previewer). Note one of the uses of vertex shading here - without vertex painting the only way to create the effect above is to have a different texture on each column. With the vertex painting, all the columns share a single texture.

 
Nonetheless, the mesh I used above contains 5 submeshes - one for each column, and picking a particular submesh enables the utility to vertex-paint that particular submesh only. Consider instead to the example of a simple tiled floor (where all the tiles for part of the a single submesh).

I created a plane of 10 tiles by 10 tiles, and mapped the floor so that all the tiles had the same simple square map. In other words, applying this half-a-K 128x128 pixel texure in the previewer
....




...we get the followiung:





In this case, we cannot use exactly the same method to paint the vertices. The reason is that in the tool, the UV map that appears is:




...and vertex-painting it with a texture such as...




...will tile the vertex paint too:





To vertext-paint across the whole mesh, use the 'Projection' drop-down menu (9). This menu allows you to use 2D represesenations other than the UV template to paint the mesh. You can use orthographic projections along the X, Y or Z axis, and these can be 'proportional' (as if you we looking at the mesh from the side, front or top) or 'stretched' to occupy as much of the image area as possible.

Thus, with 'X stretch' selected, the 2D representation appears like this:




The whole of the mesh is now visible, and available for vertex painting. I applied this image:




and the vertex painted floor appears like this in IMVU, as if shadows crossed the whole floor:






As a final example, you can create extremely powerful effects by combining a coloured default texture (see Create Default Textures, above) with vertex painting. This is because the default texture simulates the effects of lighting from any angle. In essence, you can load in an XMF, get the coloured texture for it as if it were illuminated from a certain angle, and then use that very texture to paint the vertices.

Turn again to the default top mesh. Create a texture with the monochromatic fill. Rotate the trackball to change the angle of the light. In the image below, the light appears to come from underneath and behind:



A small amount of blur has been added, and it's worthwhile explaining why this is a good idea: When the utility colours a vertex, it looks for the pixel in the image area that corresponds to it, and a tiny bit of blur ensures that all the neighbouring triangles influence the pixel in question.

Now, simply click 'Paint verts' and save the updated XMF. In the previewer, activate 'Self Illuminated' to see only the newly baked in shadows:



Again - remember that what you are looking at is not a texture - it's not even a mesh illuminated by a light - it's vertex painting =) If the shadows here are too harsh, you can of course click 'Save image' (15), update the image in an editor such as PS, and then re-import it with the 'Load image' button (11). If you edit the image externally in this fashion, remember to uncheck Fill (21) so that only the background is showing. Below is an example with Vertex Painting and a simple texture. I painted the vertexes with a red light coming from above. On the left is the dress without the Vertex Colors activated, and on the right (with the Vertex Colors and Self-Illuminated checkboxes activated )  the deep red hue permeated the fabric- The texture and opacity maps are of course the same in both:



Finally, take a look at the following strange mesh. All the object have plain white textures and are self-illuminated. The sphere is vertex-painted as if by a red light from above, the knot is vertex-painted as if by three differently coloured lights on three different axis, and the teapot is vertex painted as if by a white light shining up from underneath it.



In conclusion - vertex painting can be a very powerful tool. Adding vertex painting to your mesh give the deriver more options (since they can always turn it off), and can create very useful and extraordinary effects =)

 

 

c) Flip shading and normals on submeshes

If you load an XMF into the tool, you can select a submesh and click 'Flip faces' (31). You will them be asked if you wish to flip the normals or the shading. Flipping the shading makes the faces of the mesh respond to light as if the light were coming from the opposite direction. Flipping the normals makes the mesh appear 'inside out', i.e. only the 'backs' of the polys are visible.

d) Quickly change the material number of any submesh

When you load an XMF, you can change the material number of any submesh by selecting the submesh (7) and then setting the material with the drop-down menu (8). When you have set the materials, just save the XMF.

e) Export a submesh as an independent XMF

If your XMF contains several submeshes, clicking 'Export' (2) will allow you to save the current submesh as an independent, working XMF file.

f) Import a submesh to form part of an XMF

As well as exporting single submeshes from and XMF, you can import XMFs to join them into one file. The newly imported mesh appears as a submesh. At present, only XMFs with one submesh can be imported in this fashion (but you can always break a complex XMF down into its component submeshes first - see (e), above). To use this function, click 'Import' (3).

g) Remove a submesh from your XMF

Clicking 'Remove' (4) removes the current submesh from your XMF.

h) Add a ‘skin’ submesh for items derived from the ‘Empty Clothing’ derivable 

The 'Empty Clothing' derivable does not contain a reference to material 7, used for the skin. If you click 'Add skin' (5) a tiny 'invisible' submesh will be added to your XMF and set to material 7.