
4. Create a normalMapBump node in hyperShape. You can find it in the utilities category.

5. Create a surface shader, like phong, and assign to the polygon sphere. Connect normalMapBump's 'outNormal' attribute to the shader's 'normalCamera' attribute.

6. What camera are you rendering from? Connect its 'worldInverseMatrix' attribute to normalMapBump's 'cameraMatrixInv' attribute.

7. Create a 2D texture file to load the normal map. Connect file's 'outColor' to normalMapBump's 'normalMap'.You can use nVidia's DDS photoshop plug-in to create normal map, and Default_bump_normal.dds available in maya7.0/presets/cgfx/examples/ directory is also enough for this test.

8. I think the job is done. You can render now. Download normalMapping_test.zip to check how stuff works.
Normal mapping in Cg shading language:
/*Vertex Shader*/
struct appin
{
float4 P : POSITION;
float3 N : NORMAL;
float2 UV : TEXCOORD0;
float3 T : TEXCOORD1;
float3 B : TEXCOORD2;
};
struct vertout
{
float4 HP : POSITION;
float2 UV : TEXCOORD0;
float3 N : TEXCOORD1;
float3 T : TEXCOORD4;
float3 B : TEXCOORD2;
float3 V : TEXCOORD3;
};
vertout main( appin IN,
uniform float4 eyePoint,
uniform float4x4 modelViewMatrix : VIEWPROJ,
uniform float4x4 w : WORLD
)
{
vertout OUT;
OUT.HP = mul(modelViewMatrix, IN.P);
OUT.UV.xy = IN.UV.xy;
float4 N = float4(IN.N.xyz,0);
float4 T = float4(IN.T.xyz,0);
float4 B = float4(IN.B.xyz,0);
OUT.N = normalize(mul( w, N ).xyz);
OUT.T = normalize(mul( w, T ).xyz);
OUT.B = normalize(mul( w, B ).xyz);
float4 PWorld = mul( w, IN.P );
OUT.V = normalize(eyePoint.xyz - PWorld.xyz);
return OUT;
}
Author: fredzhang
Submitted: 2005-10-05 08:19:56 UTC
Tags:
Software: Maya
Views: 234,699
Related Items
-
Dinning chair and table 3D Model
$20.00 (USD) -
Quick and dirty medium/low res 45. Smith and Wesson handgun 3D Model
$25.00 (USD) -
Quill pen and ink bottle 3D Model
$20.00 (USD) -
Tire and Rim 3D Model
$9.00 (USD) -
Blonde woman in jeans and sweater - aXYZ design - AWom0004-CS / Rigged for 3D Max + Character Studio 3D Model
$49.00 (USD) -
Chairs and Table 3D Model
$30.00 (USD) -
Luxury Home and Grounds 195 3D Model
$100.00 (USD) -
Building Modern Day and Night 216 3D Model
$150.00 (USD) -
Cityscape with Bridge and Water 417 3D Model
$150.00 (USD)