Second Life Mesh – Double Materials

With avatars we can have texture layers. A jacket is on top of shirt, which is on top of an undershirt, which is on top of the skin with a tattoo layer in there somewhere. But, we cannot do that with prims. We have one texture on one surface/face. At some point we will have normal and specular maps. Those are not really texture layers. Those are more like effects. I doubt this process will be affected by the Materials System. So, this offers some interesting possibilities.

Back in May 2012 Kitsune Shan posted this YouTube video showing textures layered over the same polygons in a mesh object.

A couple of days ago Tommy Rampal asked in the SL forum, how did Kitsune do that? A discussion followed. See the thread: Assigning multiple materials to a polygon.


Kitsume provided the modified Collada file that enabled Kitsune to add layered textures to mesh objects or mesh prims, whatever you want to call imported mesh things. You can find the file here: Layered Mesh: Shadow maps.

How It Is Done

There is apparently a way to do this coming from 3DS or AutoDesk Collada exports. But, I don’t understand what Kwakkelde Kwak has written in the thread. But, I am a Blender user.

There apparently is NO way to do materials layers from within Blender without doubling the vertex count. So, it is done AFTER the Collada file export.

I am not at all sure I understand what is being done… just a vague idea. But, hopefully it is enough to get you on the right track if you’re interested.

The effect is achieved by modifying the Collada export file coming from Blender. Drongle McMahon explains:

In the provided dae file, the geometry (ie all the vertex positions) is defined once, but that is followed by two <triangles> sections which are identical except for the “material” attribute. Since they reference the same geometry, they define precisely the same set of triangles twice, once for each material. The way the uploader works, this will produce two lists of all the triangles, in each of the two materials lists, duplicating all the vertices in the process. This will be evident in the vertex and triangle counts in the uploader. The download weight may well not be doubled, however, as the exact duplication may result in better compression, and the weight depends on the size of the compressed data.

Some editing of the Collada (DAE) file and you have polygons that will import into SL with two or more materials on a polygon that is seen as more than one face.

I think it is Drongle that points out by clicking in different places on the same polygon, the viewer will select different faces and edit that face’s texture. Some have said one must use scripts to select the faces in this case. While that can be done, it is not the only way.

The eight texture limit still applies. One can only have a maximum of eight textures/faces.

It seems one need only duplicate the <Trinagles> section of the file and change the material section to use another material. Which doesn’t seem too tedious. If you are into editing XML files, it should be easy… I say that not yet having tried it.

But Why?

Are you wondering what one would use this for? Kitsune shows an excellent use in the video. A brick texture is used and repeated across the surface. This allows a much higher resolution for the bricks he used. But the shadow cannot be repeated across the surface, that looks wierd.

So, rather than have to use a high rez texture with a shadow baked in to get a weak looking wall, a smaller texture can be used for the bricks and repeated. The shadow can be a lower rez texture and not repeated. It should be possible to use lower rez textures and get a saving while gaining in appearance.

Conclusion

Check out the thread. There is more information there.

6 thoughts on “Second Life Mesh – Double Materials

  1. Tommy Rampal IMed me few days ago asking for info about it.
    The reasson I didnt give more updates about it is because sorting layers is confusing (they can go on top or bottom depending of settings such full bright or glow). Also I noticed some little differences lately with new updates on viewer.
    They still works and have great possibilites.

    I really had no idea that there were a post on the forum about it. I tried to explain a bit more the concept, its limitations and the possibilities.

    Thanks for posting about it 😉

  2. Pingback: Second Life Mesh – Double Materials | Persephoneia Ferina

  3. Didn’t take me long to realize what was happening.

    About time someone get around to it though. Hope LL does take interest with this method. It’s not new when it come to game development but…. SL is falling behind anyway.

Leave a Reply

Your email address will not be published.