The End Of Cluster Materials

December 12th, 2005 by Bernard Lebel - Viewed 40960 times -




ABSTRACT

This article is intended more as a tutorial rather than technical or idea discussion. In this article I will explore a few texturing techniques to avoid the use of cluster materials.

INTRODUCTION

Fundamentally, putting materials on clusters seem to be the most logical approach to put different materials on a single mesh. For example, when I came into the world of XSI as a 3ds max user, the first thing I did was to put material on clusters. But that was without considering that the 3ds max workflow for materials is not the same as XSI, and it wasn’t that long that I faced problems. I changed my ways of doing things, but since then I would often read on forums about people having the same kinds of problems. So I thought I could put a few ideas together and share them with those having these issues.

Final rendering

To summarize, my opinion about cluster materials is that from a workflow perspective, they are not good for anything, and from a rendering perspective, they are good only for game production.

WHY CLUSTER MATERIALS ARE NOT GOOD

Here are few reasons why I think cluster materials should be avoided:

Workflow

  • To get to clusters in the Explorer, it means you have to dig two levels down in under an object. In larger scenes, it will quickly become painful.
  • Outside of the Explorer, you can access clusters using the F3 key, wich either involves clicking more times down the hierarchy and not having synoptic properties attached, or you can click on the Cluster button from the MCP. Either way it’s not good enough when you want to work fast.
  • You can’t select clusters using a filter in viewports, nor there is a special vibility filter for polygon clusters, even less for those with materials.
  • There is nothing that identifies the cluster material as a cluster material when viewed in the Explorer. So if you happen to be in the Materials scope, good luck finding to wich cluster this materials attached to.
  • Worse, if you click on the material icon, it will highlight the entire object (turning its wireframe to pink if you have Highlight Property Set Owners enabled), not just the cluster.
  • Cluster materials have precedence over the object when it comes to property propagation, and there is no parent-child relationship between an object and its clusters that would allow a branch-select for example, as clusters are considered sub-elements of objects.
  • Clusters are not visible from partitions, which is a big minus for overrides and materials applied to partitions.
  • Putting overrides on cluster materials is possible, but convoluted. You either have to group the clusters and add the override to the group, or use scripted operators.
  • Clusters can’t be associated with lights.
  • To make things even worse, when you use cluster materials you will generally use local texture projections as well….. productivity just went down to the toilet.

Bugs

  • Clusters sometimes render in constant colors, like black or gray.
  • Sometimes clusters render well but not the rest of the object.

If these have not convinced you, then I’m afraid the remainder of this article will be of little interest for you. But as far as I’m concerned, a fast and reliable workflow prime over any other consideration, so……. So the next question would probably be “fine, so what can I do to avoid cluster materials?”. Actually there are few options available for you.

XSI WEIGHT MAPS

You could use the XSI weight map functionality. Apply one or more weight map on the object, and start painting those weight maps using intensities of 0 and 1.

Splitting a mesh using weight maps

On this picture, I have painted the skin using an intensity of 1, and the rest black. So in the render tree, I would lookup the weight map, connect to a mixer shader, as shown below.

The Render Tree setup when using weight maps

If you have a continuous mesh that you wish to have a clear edge between two different materials, hide the polygons that you don’t want to paint, and paint the visible ones. When you are done, unhide the hidden polygons.

Breaking the mesh continuity

To facilitate the selection of polygons, I usually create a bunch of clusters. If you use such clusters, make sure to not do the mistake of applying materials to them!

Using polygon clusters to manage component selection

COLOR AT VERTICES

Using pretty much the same workflow as XSI weight maps, you can also use color at vertices properties. The advantage of color at vertices is that you can use a wider variety of color, and extract just the color you need in the Render Tree. To do so, lookup the color at vertice, then for each color you wish to extract, connect into a RGBA_Keyer shader. In this shader, set both the Maximum and Minimum Treshold to the color you wish to extract (you must make sure you know the exact RGBA values that you painted!), set the Color if in range to white and the Color if out of range to black. Finally, connect the keyer shaders into the weight inputs of a mixer shader.

Splitting a mesh using a color at vertices map

TEXTURES AS WEIGHT MAPS

You can also use a clever combination of textures and texture projections. Here are a few ways you can do the work.

Multiple mask projections, one unwrap projection, one mask texture

First, create in a tiny texture, say, 32×32. It could even be less. The left half of this texture will be pitch black, the right half will be pure white, this will be our mask texture. Bring that texture into XSI.

For each part of the object you wish to have different materials, you could create a texture projection, and label this projection as a “mask” projection.
Now, let say you want to use the same material for the skin parts, and the same material for the clothes parts. You would have two mask projections. In the mask_skin projection, collapse all UVs of the skin parts and put them in the right (white) half, collapse all UVs of other parts and put them in the left (black) half.

Then when you build the final material, connect both materials in a mixer shader, then plug the mask texture in the weight input. In the image shader, choose the right projection.

On the picture below, the clothes shader is placed on top of the skin shader. So to define where the clothes shader will be visible or invisible, I must point the image shader to the clothes mask projection. The UVs of the shirt are placed in the white area, while the other UVs are placed in the black area. So in the end, you could use a Mix_8colors and stack layers of shaders this way.

Multiple mask projections, one unwrap projection,  one mask texture

At last, you would need a single unwrap projection for the entire mesh. This projection would allow you to paint the details of the materials.

Multiple mask projections, multiple unwrap projections, one mask texture

Another approach is to have one less projection than the previous method. In fact, the only difference is that instead of collapsing points in mask projections, you will collapse only the points of the parts you don’t want to see. So each mask texture will not be only a mask, but also an unwrap. Again, you deal only with one mask texture, but instead of having it split in two halves, put everything white, create a 2×2 pixels area at the left bottom corner, and put there the UVs of parts you don’t want to see. Unwrap the other UVs in the white area.

Multiple mask projections, multiple unwrap projections,  one mask texture

This approach has a significant advantage of the previous one. Because the mask projection is also the unwrap projection, each part of the object can receive a texture of a resolution of your choice, without having to worry too much about the overall texture size. For example, if you want to put a 4k texture for the face and a 1k texture for everything else, nothing is easier. In the previous setup, the only to do that would be to cleverly unwrap everything in one projection so that the face would receive the maximum amount of pixel from the texture.

One projection, multiple mask textures

The next technique we’ll discuss involves doing only one projection, but carefully painting mask textures. Here, you will create one projection, unwrap the whole object, then paint one mask per part of the mesh. Each of these parts will have to match the UV space it is assigned to. For these textures, you might want to use a little higher resolution than 32×32/64×64, something in the 256×256/512×512 would be more appropriate.

For instance, let’s take again the skin vs clothes example. You unwrap the whole object. Then you create two masks. In one mask, the area occupied by the UVs of the skin will be white, while the rest is black. In the other mask, the area occupied by the clothing will be white, while the rest will be black. Then again, it’s just a matter of wiring the right mask in the right weight input of a mixer shader.

One projection, multiple mask textures

One projection, no mask

The last technique we’ll check involves doing only one texture projection, and doesn’t require the use of a mask. On the other hand, all the work of defining the surface properties will be done with the texturing. In this setup, you use only one illumination shader, and use textures in each port to give the illusion of different materials. The advantage is that you do one projection and don’t have to bother about masks as all, but it means that you have to change the range of many textures since many parameters are not expressed in a 0-1 range as color is. As a result, you may end up with such a Render Tree:

One projection, no mask

While this approach involves lots of fine-tuning, it has the big advantage of being managed as one single file. In Photoshop, each layer is treated as a single channel of the entire mesh, and lots of tweaking can be done without having to manage lots of files.

CONCLUSION

As we have seen, there are many alternatives to cluster materials, I have proposed a few of them. Just pick the one you think works best. If there are other techniques you think work better, do not hesitate to share them!

39 Responses to “The End Of Cluster Materials”

  1. DAN says:

    Just to add to Bernard”s great (and well needed) tutorial…. You can make this whole process at *lot* easier by using the fantastic AP VertexColorTools by Andrea Padovan from http://www.borderliner.it/

    Cheers Bernard! This tutorial will certainly cut down a considerable amount of forum noise!

  2. Guillaume says:

    Very good article on those “damn” clusters ;-). Using clusters materials or not ? That is the question !
    There is good and bad in the two methods. I prefer your workflow, and I trie to keep it as far as I can. But sometimes clusters materials are faster to setup. For example if you need several materials on one object instead of several surfaces. With one material and several mixers for surface, displacement, bump etc… it can scared lot of people !

    I hope Softimage will gives us something like a “Master Material” node one day where we will plug several materials. Sound possible no ?

    For material with Color at vertices I wrote a script to speed up the setup. I can”t resist to post the link here : http://www.vol2nuit.fr/guillaume/Pingouins_Torture.htm

  3. brit2slim says:

    i personally find them very useful and quick. great for isolating bevels on logos and the like. to extract polygons instead requires more steps and can cause rotation hassles. but the weightmap technique is a good alternative.

    it”s true that cluster materials and partitions do not always get along (crashes XSI sometimes); this is the only real drawback that i can see to having the ability to put materials on clusters – OTHERWISE PLEASE DON”T GET RID OF THIS FUNCTIONALITY.

  4. I don”t think Softimage should remove this functionality, I think they should work really hard on making it usable and reliable. Like I said in the beginning, cluster materials are great concept, but the implementation is highly inadequate.

    Cheers
    Bernard

  5. Kjello says:

    My main reason for often using cluster based materials rather than weight map based ones is that they can be a lot faster to render.

    Say you have an object that is partly matte/bumpy metal and partly highly polished metal. Setting this up with a wheightmap and two different phong materials is easily 2-3 times slower to render than setting the same two phongs on material clusters. An even worse situation is if you”ve got an object that”s made up of two materials, one of which is transparent and one that is not. In this case the weight map solution is often 10-20 times slower than the cluster solution.

  6. Guillaume says:

    You”re right Kjello,

    However, if you problem is on non organic objects, just separate polygons in several objects instead of using clusters. Much easy to manage a scene this way.

  7. Whatever works best for you is what matters :-)

    Bernard

  8. Steven says:

    I especially liked the solution with the RGBA_Keyer shader, it”s brilliant!

  9. Luc-Eric says:

    “You canít select clusters using a filter in viewports, nor there is a special vibility filter for polygon clusters, even less for those with materials”

    Do you know you can turn on viewing clusters in the viewport, with the camera Visibility Options, Clusters->Polygon clusters, and color-code each cluster in its property page? After this if you put the MCP in Cluster and raycast selection mode you can just click to select them. (if there is a problem with selecting them, you can change the sort order) The cluster will also be shown in its cluster color in the Cluster scene explorer that pops from the MCP Select button, so they”re easy to find. You”d also of course rename them with a sensible name.

    Why do you use F3 to get to the clusters and click several times to get to them? Instead you should use the Cluster button the Select MCP. To open its material, click Shader on the Render Toolbar after selecting the cluster.

    Note that building a render tree like this will several nodes and blending will seriously impact the render time of the object. These mixers are not free : assume that all the materials will be evaluated for each sample by mental ray.

  10. Filippo says:

    WOW!
    Very useful! and extremely brillant!

    Thank you very much.

  11. Thanks for heads up regarding the viewport visibility/selection stuff.

    Regarding MCP vs F3, I did mention both.
    Try this little test: create two spheres, create a polygon cluster on each. Now test the selection using F3 and MCP. Unless I”m missing something, F3 will be much more efficient in this case.

    Regarding render time, what matters to me is workflow and reliability. I try to stay away as much as possible from features that I can”t trust.

    Cheers
    Bernard

  12. Kim Aldis says:

    For my money, the only reason for not using materials on clusters is the pass/partition override thing. Other than that they”e a quick and convenient way to localise materials on a mesh. The rendertree method works well enough and does have it”s advanages but cluster materials are still quicker to set up and easier to work with.

    Roll on the day, huh.

  13. Guillaume says:

    We can override a cluster material parameter in a partition (since v4 if I remember). the only problem is that we can”t directly put clusters in a partition in order to apply a material to this partition. If we could do that, I”m sure more people would use material on cluster.

    My 1/2 euro.

    Cheers

  14. Szabolcs Matefy says:

    Hi

    To me it doesn”t cause ANY problem using cluster materials. Moreover, it looks like that this method is far more complicated that using cluster materials. Moreover, you made some statements that seems to be incorrect (e.g. not visible clusters, or no filter for clusters)

    It”s true that you cannot just jump it assigning materials, but with a very few preprocessing, it”s really easy, and starightforward, without any problem.

  15. Alan Jones says:

    There is another option for dealing with not having clusters. Make a set of UVs that contain the area you wish to apply a particular color/material/whatever to. Put all other UVs outside the 0-1 UV area.

    Now get a color mixer node. Insert an image node into the weight of a color and enable the multiply weight by alpha. Now grab a color share node, set it to pure white and plug into the tex input of your image node. Now you”ll have the layers below the mixer you”ve put in showing and the color for your UV area on. The mixer node should be in mix mode.

    Cheers,

    Alan.

  16. Szabolcs: sorry for sounding redudant, whatever works best for you my friend.

    Bernard

  17. “To me it doesnít cause ANY problem using cluster materials.”

    Obviously, you”ve never done any serious passes work. All those workarounds that Bernard is enumerating are simply to avoid problems that *could* arise with passes, namely when you want to apply a different material on one part of your character in one pass. If you don”t do passes, you dont need to use those workarounds. But then again, one is never sure that no strange pass work will be done later on with the model he is working on. So it is safe to not use the materials on clusters… just in case. If you do use them, you better have a tool to facilitate the conversion to fix it when you hit a problem.

  18. memento says:

    Hmm I don”t know what to think, your right about organization scene whit clusters and all that..but sounds so complicate it your procedure for me is more easy and more fast select the polys, cluster apply the material and voila..I think if xsi uses this cluster thing and Mray too they right.

    People needs fast and easy solutions to works, not development a nasa rocket to apply a texture or a material..now if you development a easy and fast technique with a tutorial step by step whit extreme pleasure I will follow you, but that is my opinion and I”m not expert and master xsi user..anyway

  19. Tolu Abisola says:

    I would second what memento says.
    I come from a Lightwave background and am really keen to learn XSI, it just seems a shame that assigning multiple materials to one object in XSI is a lot harder than it should be (just an observation) the colour at vertices technique is the only one that seems to mimic more standard work flows such as in Lightwave or 3D studio where you select polgons assign a surface name to them and the assign materials. XSI is truly a great program with a modern internal architecture and great features, assigning multiple materials to an object should not be this hard. If im missing something fundamental here please let me know.
    Happy Christmas all!!

  20. you”re not really missing much.
    the -only- case where materials on clusters get dodgy is the override on pass situation mentioned in the article, in every other case they won”t give any problems, and that one situation is something you can”t replicate in max or lightwave in first place, as they don”t have a pass/partition system anywhere near as powerful or complex as XSI”s.

    the rest is purely preferences and opinions, as Bernard stated in his article.

    like preferring a walk in a massive rendertree with 20 keyers over having some clusters one level down from the object.

    if all you need is to emulate a pass-less program like max or LW, feel free to abuse cluster materials at any time ;)

  21. Perhaps it was not clear in my article, but yes, Raffaele has put a finger on it: I prefer flatter designs. Some prefer things a little more structured, or broken down into smaller units of data, while I generally prefer to deal with less but larger data sets.

    I prefer dealing with preferably only one texture projection, one material, and no cluster material at all. This is how I”m productive, and the points I have raised regarding the access of clusters are significant enough *to me* to consider alternatives. A larger Render Tree definitely has disadvantages, but if the requirements of a project allow me to do so, I prefer to work this way. But again, this is my opinion, I have just presented techniques so one can have a wider choice of workflows.

    Ultimately, it comes down to what works best for you.

    Cheers!
    Bernard

  22. memento says:

    Bernard I”m agree 100 % 100 whit you about ” you shown to us new options and techniques ” and you rocks because you ”re professional. But Now you talk about organization in the clusters, and I”m confused because made a big render tree is not out of organization too, or is not more complicate it like use thousands clusters in the same object ? I know that uses a heavy render tree for a only single selection sounds more good..but I don”t know.

    Now maybe your technique sounds complicate it to me because you write it to advanced users, I ask to you like favor, and favor to all people interested in this thing. Can you do a tutorial whit a scene of this ? but I mean a tutorial step by step, I”m sure whit a good tutorial people maybe understand it and you would help whit your wise advice and knowlegde to us. Thank you :)

  23. Tolu Abisola says:

    Bernard and Raffaele, thank you so much for clearing this up for me in a consice and timly manner.
    What am I gonna do for the rest of the day? Abuse quads in Softimage!!
    Cheers
    Tolu

  24. Sami says:

    Thanks for the interesting article, Bernard!
    I quickly tried that “hide-unwanted-polygons-and-paint-weight-to-others” -trick but it still applied weights to those hidden polygons too. Did I miss something?

  25. Tahir says:

    I”m also having the same problem as Sami. Anyone care to explain about this?

  26. Are you using XSI 4.2? I wrote the article during XSI 5.0 time, and when I tried on 4.2, I noticed the behavior you described. I have not tried this technique in XSI 5.1.

    Bernard

  27. Chris says:

    This is a great tutorial\technique\tip :) For passes I have used and well, i”m still trying to figure out a little work around for some things since sometimes not using clusters, but I highly recommend this technique for pass work. Clusters just don”t cut it for passes.

  28. Actually while answering a question on XSI Base I have come up with an interesting -simple- technique. This is inspired by Brad”s technique to control global ambience at pass level. It”s certainly not a great technique or something simple, but if there are no alternatives to cluster materials, it could get the job done.

    In your cluster materials, you could use a mix8colors, and plug in each layer one of the pass preset. For instance, in the base_color, you”d have the “normal” branch, that is, the beauty aspect of the material. In every other color inputs you”d have custom passes aspects, like depth, ambient occlusion, shadow, and so on.

    The in_use parameter of every layer would then be controlled by an = expression with a boolean parameter on a cpset, and in turn this cpset would be overriden by every pass. In each pass you”d check the “cluster aspect” you want to get rendered.

    This might be a lot of work and hard to maintain workflow, but if it has to be cluster materials, I think it can be a viable solution that can avoid the use of weight maps and color at vertices.

    Cheers
    Bernard

  29. abuyoyo says:

    I must have missed something but whenever I paint a vertex in full color – right next to aother vertex I want to keep black – the color sorta bleeds across the edge connecting the 2 vertices.

    ie. I can”t really get that straight cut you get with a cluster.

    I tried hiding the polys I want to keep clean or not even having the weightmap on them at all, but to no avail. I see that people with 4.2 were also having this (or similar) problem. however I”m using 5.1

    Did I miss something or is this a limitation of this method or of this version?

    thanks
    abu-yoyo

  30. abuyoyo says:

    oh hell. disregard that last post.
    I feel so stupid for actually looking at teh RGBA_keyer image. studying it and then completely missing the point.

    Salavatore Stupido!

  31. Buy Sony Ericsson K800i

    Buy Sony Ericsson K800i

  32. Sony Ericsson K800i Theme

    Sony Ericsson K800i Theme

  33. Sony Ericsson K800i Sim

    Sony Ericsson K800i Sim

  34. Best Deal Sony Ericsson K800i

    Best Deal Sony Ericsson K800i

  35. Price Sony Ericsson K800i

    Price Sony Ericsson K800i

  36. Sony Ericsson K800i Mobile

    Sony Ericsson K800i Mobile

  37. Mobile phone offers

    Mobile phone offers

  38. mobile phone deal

    mobile phone deal

  39. Vodafone Contract Phone

    Vodafone Contract Phone