# Information about the side of the mirror (left or right) while using mirror modifier?

Is it possible to obtain the information node (with value 0 or 1) about the side of the mirror modifier?

For example, I have a mirrored object and I'd like to have the possibility to use one set of textures on the LEFT side and another set on the RIGHT side of the object.

Let's say I'm using Mix Shader and have two different Diffuse Shaders plugged into it, the first with right side textures and the second with left side textures. I'd like now to have something that will give me the information (0 or 1) that I could plug into the factor socket of the Mix Shader. 1 would mean LEFT side and 0 RIGHT side (or the contrary, it doesn't really matter).

Is it possible to obtain that information somehow?

You can do this with the nodes pictured below.
click for full size

The gradient texture node is setting up the spiting left and right. The color ramp set to constant and with color stop #1 set to .5 gives half pure black, and half pure white. Which gives this.

You may need to use a Vector Mapping node to rotate where the split is located like in the image below.
click for full size Which gives this.

• Clever method for static objects. If I understand correctly, it won't work correctly with meshes deformed through modifiers or armature - because it generates the object-based coordinates after the deformations? – Oskar Świerad Jul 2 '14 at 21:28
• @avvi You do not have to use generated coordinates, a UV map works great. As to the deforming, do you want a straight half and half (for example along the Z axis) no matter the deformation? – David Jul 2 '14 at 22:42
• Whoa! It works with deformations :) Your method is perfect – Oskar Świerad Jul 3 '14 at 8:29

you can select one part of the mesh by using a two-tone texture with halves along the axis, in this texture the x axis have the red tone, meanwhile the y axis have the green tone, in this way you can either select texture U ,V or both that provides the mirror modifier.

In material you put the above texture in the red node, in node green you use the node group setup of the second panel, and you must place the UV "mesh" in only one halve. With this node-setup you have the information of U texture or V texture, and you could also work with symmetrical or asymmetrical textures, like the example, in the blue node you have a symmetrical texture, meanwhile in the yellow node you have an asymmetrical texture.

UPDATE

Apparently there's no need for an auxiliary texture, the blend file with the groupnode is here http://pasteall.org/blend/index.php?id=46015, set 0-1 for bypassing the symmetrization of the UV coordinates, set 1-2 for U texture, set 2-3 for V texture, set 3-4 for U and V texture symmetrization. The node also gives you the mask of each coordinate.

The modifier's result is a new mesh. Cycles doesn't know which vertices are the original ones.

If you don't need UV texturing, then you can do a bitmap mask. Use 'U' option in Mirror modifier. Make an image that is totally black in left half and pure white in right half. UV of the mirrored vertices will get flipped around U 0.5, so left polygons will be black and right polygons white.

Generally, you can preserve the information through vertex groups. Make two vertex groups, GroupName.L and GroupName.R. Then assign all vertices to Group.L. In the Mirror modifier enable the 'Vertex Groups' option. But as of Blender 2.71, I can't find any way to obtain vertex group influence values in a shader.

• Thanks, but unfortunately I need U and V options in mirror modifier enabled. – jubi Jul 2 '14 at 12:38

Building off previous answers, with mirroring for the U coordinate on in the Mirror Modifier, you can feed the UV map into a color ramp to separate the two sides

Any problems this causes for your texture mapping can be fixed by using separate UV maps for each side.