Joined: 22 Nov 2010
Location: Russian Federation
|Posted: Wed Feb 04, 2015 6:40 am Post subject: Skin Composite override: "neon" effects and more
|Hello, fellow developers! I decided to share a few insights related to creating a "neon" items. This topic is surrounded by many misunderstandings and myths, so I felt the need to finally sort things out.
(Moderators, please do not move this post in 3d developing; since it is related to deriving from mesh and re-texturing it, not making new meshes)
[Lots of text ahead]
Skin Composite feature of IMVU material system is most often used for drawing underwear or
otherwise painting over MCG red parts of clothing products. However, it is not limited to
single task. In the following tutorial, I'll show you how to use Skin Composite to combine
any two materials together. The main benefit of the technique is the ability to combine
animated texture with the static one, or two textures with different animation parameters,
without the need of deriving from a special two-layer mesh.
As an example of effect that needs to be combined with static texture, I'll use "neon"
(gradual change of color over time). The technique will work with most derivable meshes
(later, I'll discuss its limitations); for this example, I chose the furry ears accessory
from Nishi (PID 27004979)
To add extra material slot to the product, we'll need to edit some parameters in Debug02
tab. But first, it is adviced to create the custom *.xrf material file. You can copy and
paste the following text in the notepad:
<HEADER MAGIC="XRF" VERSION="919" />
<AMBIENT>149 149 149 0</AMBIENT>
<DIFFUSE>255 255 255 255</DIFFUSE>
<SPECULAR>229 229 229 0</SPECULAR>
<MAP TYPE="Diffuse Color">gradient.png</MAP>
,change the map names to whatever you like, or leave them be, and finally save as *.xrf
file. Make sure that the material name editing is enabled in your client's Advanced
properties. In Create mode, derive from mesh you plan to use, open its Project folder and
put your custom *.xrf into it.
Open the Debug-Debug02 tab in Create mode and scroll down to Material entry. Select it,
expand it (if it is collapsed), and press Add Key button at the bottom of Debug window. In
the following "Add new dictionary key" prompt, type "TextureMap#", where # is the number
following an existing TextureMap keys. In my example, it will be "TextureMap2".
Select the newly added key. Add two new Data entries (by pressing the "Add Data" button).
In the first, enter "Asset" in the left field and the name of your custom *.xrf file in the
right field ("neon mat.xrf" in my example), all without quotes. In the second - "Index" and
"7". Apply changes. If everything is done correctly, the empty material slot 7 will appear
after you switch to Meshes tab.
Now, we'll need to create a neon material in the slot 7. It is accomplished by using
horisontal gradient as texture and Cycling as texture animation mode. In my example, I made
a 256x64 rainbow gradient, loaded it as color texture, and entered the following animation
Cell Width: 1
Cell Height:64 (your image height; can be any power of 2)
Frames/Cell: 8(speed of color change)
Start Cell: 1
Number of frames: 256 (X size of your gradient)
The next step will be to create a static material (in my example, in slot 0), which will serve as "upper layer" in Skin Composite. I made a dark brown base texture for ear and an opacity map with a decorative pattern drawn in black.
(Transparent parts of opacity will turn to "neon" when Skin Composite is enabled).
Load the color and opacity textures into your "base" material slot and press "Apply changes" If everything is done right, you'll see a "neon" effect. Congratulations! You can see my result at PID 28107465. I could not leave this mesh as derivable for you, in order to study it in editor, but you can do this with another product of mine: PID 25402062
Now, a couple of words about the technique's drawbacks (compared to actual two-layered or "animated" mesh).
1) No individual material settings except of animation properties. Most material properties (like Self-Illumination and Blending modes) are ignored for "composite" material (that uses Skin Composite). If they are set for "skin" material, they will propagate to "composite" material as well.
2) Since there is a single mesh layer, both materials will share the same UV coordinates. No tiling for one of the layers or other texture coordinate optimizations that can help using texture animation.
3) If the mesh already makes use of material slot 7, technique can not be used. This is true for most clothing items that contain anyskin body parts. However, there are exceptions. If the anyskin parts use material ID number other than 7 (anyskin properties are determined by material *.xrf file, not ID number), you can use this exploit, but you'll absolutely have to put a custom *.xrf into slot 7. Because if you'll tamper with actual "naked skin" material, the mesh will lose its anyskin properties.
Addenum: the method isn't limited to making "neon" effects. Scrolling animation can also be used. It can require a little more work though. To add moving stars above the base texture of the tail (PID 28108947), I had to move the *xrf containing the tail texture from ID 0 to ID 7. This is especially important if the product in question has some sort of opacity map you want to re-use, like fur. In this case, you'll want the opacity-enabled material to be the "skin". If it'd been a "composite" material, the holes made by opacity would be filled with "skin"