How to map a 3d texture (XYZ) into 2d (UV) in Maya

 

I have first to thank Duncan Brinsmead (from A|W) for his precious help.

First, create any shader you want, a 3d texture (in our case this will be a wood), and a samplerInfo. Drag the texture in the shader's color first. Its useless to modify any attributes of the 3d texture right now, because once transformed from its default 3d mapping to 2d (uv) mapping, it'll look completely different...!

In order to map in UV a 3d texture, drag the samplerInfo to the 3d texture itself (not its placement), and with the connection editor, open the UV coord menu, and connect the U coord into the refPointCamX, and the V into the refPointCamY.

As you've seen, the refPointCam is still empty. Select or your texture or your shader, and create a new attribute 'RefPointCamZ', scalar, min 0, max 1, default 0 (or what you want between 0 and 1).

 

Then, again with the connection editor, connect the 'new' RefPointCamZ parameter to the refPointCamZ (the true one!!) of your texture.

 

Now you can see that the wood texture is really mapped in UV (just too great!! :-))

You can use the 'Xtra' attribute RefPointCamZ (of your texture or shader) to make the texture vary in Z.

And with a little bit of work, this is an example of what you can get with that method...


Wood 3d (normal mapping)...



...wood 2d (same parameters, ...but in 2d!)

 

You also can connect your texture to the bump attribute. By default, if you drag a 3d texture to the bump, maya automatically creates a 3d bump. You can, in this case, just create a 2d bump (useless to click on Provide 3d info) and connect the 2d bump to your material's bump attribute.

LIMITATION: You'll have to convert in solid texture the shader or the texture, because if you move the object or move the camera, the texture will change.