18 Feb 2009

RGB Shader tutorial in Maya

RGB Shader Tutorial

Creating Terrain and RGB Terrain Shader….
In Maya…
- Create a Terrain by making a plane, with say subdivisions of 50

- Do a Planar UV map on it in Z
- Export a screeny/snapshot of it from ur UV texture editor as a 1k TGA or other.
--------------------------------------------------------------------------------------------------
In Photoshop…

- Create 3 x 512* tiling textures.
1x ”nameoftexture_R” Example: Rocks or higher textures
1x ”nameoftexture_G” Example: Surround texture such as verge grass or sand
1x ”nameoftexture_B” Example: Base layer is the bottom layer, so this would be a path texture.

- Open the Snapshot you took.

Using the UV layout as reference, simply make 3 layers.
Name them R, G and B respectively.

- On the R layer paint pure red to depict where you want the EG Rocks to be.
- On the G layer paint pure red to depict where you want the EG Surrounding to be.

- On the B layer paint pure red to depict where you want the EG Base to be.

Make sure that the Red Layer is visible in the Red Channel of the document.
And the same with the remaining 2 layers.
- Save this out as “Terrain_Mask” Below is an example…
clip_image002

Back in Maya…
-------------------------------------- Shader setup ---------------------------------------------
This is where we create the Shader and apply it to the Terrain.
We need 3 components
1. A Parent material
2. The 4 Texture files
3. Layered Texture node.
- Create the material as the parent material eg a Lambert.
- Now make 3 “File” textures and add the Corresponding Textures to them.
Also adding 1 more file for the Terrain Mask.
Name each file, the same name, as each of the Textures u load in to them.
- Now add a Layered Texture
---------------------------------------- Linking --------------------------------------------------
clip_image004
Plug the Layered Texture (LT) in to the Lambert, using the settings…
OutColour à Colour
Now open the attributes of the LT
clip_image006
MiddleMouseButtonDrag(MMBD) the base file in to the Colour box in the LT Attributes. This has now linked the texture to the Colour input of the LT.
Create 2 new colour layer in LT and plug the other 2 R and G texture in to them
Make sure however that they are in order in the LT panel. To change the order, MMBD them, so they read R, G and B.
------------------------------------------- Adding the Mask ---------------------------------------

OK, we now need to link Terrain Mask to the LT so that the LT can read the Colourinfo of the Terrain mask..
For Red Channel
So MMBD The TerrainMask file to the LT and select other… OutColour R and input 1 … Alpha. This plugs the red colour on the terrain mask so that the LT can translate that in to an Alpha value. Input one is the top layer.
Don’t forget to set the Blend Mode of the R channel of the LT to “Over” so it overlays the texture underneath.

For Red Channel
So MMBD The TerrainMask file to the LT and select other… OutColour G and input 2 … Alpha. This plugs the red colour on the terrain mask so that the LT can translate that in to an Alpha value.
Don’t forget to set the Blend Mode of the R channel of the LT to “Over” so it overlays the texture underneath.

For Blue Channel
You don’t need to do anything, as blue is the base colour and will be shown anyways!
If your tiling is too low or high, you can tweak it by opening the place2DTexture node of each colour texture and change the Repeat UV to a greater value…
clip_image008
To add normal maps do exactly as the colour shader setup, only place a Normal Shader/cg shader between the LT and the Material Parent.
The links are OutColour à input between LT and Normal Shader
between the Normal Shader and the Parent is Outputà Normal Camera.
Although, this can vary sometimes depending on what normal Shader you use … (Check instructions of node supplier.

No comments: