Changeset 3046 for GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders
- Timestamp:
- 10/20/08 01:26:12 (16 years ago)
- Location:
- GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/mrt.cg
r3045 r3046 90 90 91 91 92 pixel frag(fragin IN, 92 pixel frag(fragin IN, uniform float4x4 viewMatrix) 93 93 { 94 94 pixel pix; -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/treeanimation.cg
r3045 r3046 24 24 //float4 color1: COLOR1; 25 25 float4 eyePos: TEXCOORD1; // eye position 26 float 3normal: TEXCOORD2;26 float4 normal: TEXCOORD2; 27 27 }; 28 28 … … 40 40 { 41 41 vtxout OUT; 42 43 /*44 // Transform vertex position into homogenous clip-space.45 OUT.HPosition = mul(ModelViewProj, IN.Position);46 // Transform normal from model-space to view-space.47 float3 normalVec = normalize(mul(ModelViewIT,48 IN.Normal).xyz);49 // Store normalized light vector.50 float3 lightVec = normalize(LightVec.xyz);51 // Calculate half angle vector.52 float3 eyeVec = float3(0.0, 0.0, 1.0);53 float3 halfVec = normalize(lightVec + eyeVec);54 // Calculate diffuse component.55 float diffuse = dot(normalVec, lightVec);56 // Calculate specular component.57 float specular = dot(normalVec, halfVec);58 // Use the lit function to compute lighting vector from59 // diffuse and specular values.60 float4 lighting = lit(diffuse, specular, 32);61 // Blue diffuse material62 float3 diffuseMaterial = float3(0.0, 0.0, 1.0);63 // White specular material64 float3 specularMaterial = float3(1.0, 1.0, 1.0);65 // Combine diffuse and specular contributions and66 // output final vertex color.67 OUT.Color.rgb = lighting.y * diffuseMaterial +68 lighting.z * specularMaterial;69 OUT.Color.a = 1.0;70 return OUT;71 }72 */73 42 OUT.texCoord = IN.texCoord; 74 43 … … 81 50 OUT.position += float4(factor * windDir, 0); 82 51 83 OUT.normal = mul(glstate.matrix.invtrans.modelview[0], IN.normal); 52 OUT.normal = normalize(mul(glstate.matrix.invtrans.modelview[0], IN.normal)); 53 //const float3 l = normalize(mul(glstate.matrix.modelview[0], float4(lightDir, 0))).xyz; 54 const float3 l = normalize(lightDir); 84 55 85 Out.color = IN.color * max(0, dot(OUT.normal, lightDir)); 86 //OUT.color1 = IN.color1; 56 const float dif = max(.0f, dot(OUT.normal.xyz, l)); 87 57 58 //OUT.color.xyz = IN.color.xyz * max(0, dot(OUT.normal.xyz, normalize(lightDir))); 59 OUT.color = glstate.material.ambient + glstate.material.front.diffuse * dif; 60 OUT.color.w = IN.color.w; 88 61 return OUT; 89 62 } 90 63 91 /** vertex shader which conducts an simple tree animation92 that bends the tree depending quadratically on the height 64 /** vertex shader which provides an simple tree animation 65 that bends the tree depending quadratically on the height using vertex displacement. 93 66 This version of the shader is used for deferred shading and thus only 94 67 displaces the vertices and outputs the color, put does not do any shading. … … 104 77 105 78 OUT.color = IN.color; 106 //OUT.color1 = IN.color1;107 108 79 OUT.texCoord = IN.texCoord; 109 80
Note: See TracChangeset
for help on using the changeset viewer.