1!!ARBvp1.0 2 3# Compute the surface space light vectors for diffuse bump mapping 4 5ATTRIB iPos = vertex.position; 6ATTRIB iNormal = vertex.normal; 7ATTRIB iTangent = vertex.attrib[6]; 8ATTRIB iTex0 = vertex.texcoord[0]; 9ATTRIB iTex1 = vertex.texcoord[1]; 10PARAM mvp[4] = { state.matrix.mvp }; 11PARAM lightDir = program.env[0]; 12PARAM half = 0.5; 13OUTPUT oPos = result.position; 14OUTPUT oColor = result.color; 15OUTPUT oTex0 = result.texcoord[0]; 16OUTPUT oTex1 = result.texcoord[1]; 17 18TEMP binormal; 19TEMP t; 20TEMP light_surf; 21 22# Transform the vertex by the modelview matrix 23DP4 oPos.x, mvp[0], iPos; 24DP4 oPos.y, mvp[1], iPos; 25DP4 oPos.z, mvp[2], iPos; 26DP4 oPos.w, mvp[3], iPos; 27 28# Compute the binormal--cross product of tangent and normal 29MOV t, iTangent; 30MUL binormal, iNormal.zxyw, t.yzxw; 31MAD binormal, iNormal.yzxw, t.zxyw, -binormal; 32 33# Normalization should not be necessary 34#DP3 binormal.w, binormal, binormal; 35#RSQ binormal.w, binormal.w; 36#MUL binormal.xyz, binormal, binormal.w; 37 38# Transform the light direction from object space into surface space 39DP3 light_surf.x, iTangent, lightDir; 40DP3 light_surf.y, -binormal, lightDir; 41DP3 light_surf.z, iNormal, lightDir; 42 43# Compress the light direction to fit in the primary color and output it 44MAD oColor, light_surf, half, half; 45 46# Output the texture 47MOV oTex0, iTex0; 48MOV oTex1, iTex1; 49 50END 51 52