Changeset 3041 for GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders
- Timestamp:
- 10/19/08 00:29:45 (16 years ago)
- Location:
- GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/mrt.cg
r3034 r3041 8 8 }; 9 9 10 10 11 // vtx output 11 12 struct vtxout 12 13 { 13 float4 position: POSITION; // eye space 14 14 float4 position: POSITION; 15 float4 texCoord: TEXCOORD0; 15 16 16 17 18 17 float4 color: COLOR0; 18 float4 eyePos: TEXCOORD1; // eye position 19 float3 normal: TEXCOORD2; 19 20 }; 20 21 … … 60 61 } 61 62 62 //#pragma position_invariant fragtex63 63 64 64 pixel fragtex(fragin IN, … … 78 78 // save world space normal in rt 79 79 pix.norm = IN.normal; 80 80 // compute eye linear depth 81 pix.col.w = length(IN.eyePos.xyz); 81 82 // hack: squeeze some information about ambient into the texture 82 83 //pix.col.w = glstate.material.emission.x; 83 84 // compute eye linear depth85 pix.col.w = length(IN.eyePos.xyz);86 84 87 85 return pix; … … 92 90 { 93 91 pixel pix; 94 95 92 // hack: use comination of emmisive + diffuse (emmisive used as constant ambient term) 96 93 pix.col = glstate.material.diffuse + glstate.material.emission; 97 94 // save world space normal in rt 98 95 pix.norm = IN.normal; 99 96 // eye space depth 100 97 pix.col.w = length(IN.eyePos.xyz); 101 102 98 // hack: squeeze some information about the ambient term into the target 103 99 //pix.col.w = glstate.material.emission.x; -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/sky_preetham.cg
r3040 r3041 1 //--------------------------------------------------------------------------------------2 // Input and Output structs3 //--------------------------------------------------------------------------------------4 5 6 7 1 struct vtxin 8 2 { … … 17 11 struct vtxout 18 12 { 19 float4 position: POSITION; // eye space 13 float4 color: COLOR0; 14 float4 position: POSITION; 15 20 16 float4 texCoord: TEXCOORD0; 21 22 float4 color: COLOR0; 23 float4 worldPos: TEXCOORD1; // world position 24 float3 normal: TEXCOORD2; 25 float4 mypos: TEXCOORD3; 26 float4 hdrColor: TEXCOORD4; 17 float3 normal: TEXCOORD1; 18 float4 hdrColor: TEXCOORD2; 27 19 }; 28 20 … … 32 24 { 33 25 float4 color: COLOR0; 34 float4 position: POSITION; // eye space 26 //float4 projPos: WPOS; 27 //float4 position: POSITION; 28 35 29 float4 texCoord: TEXCOORD0; 36 37 float4 projPos: WPOS; 38 float3 normal: TEXCOORD2; 39 float4 hdrColor: TEXCOORD4; 30 float3 normal: TEXCOORD1; 31 float4 hdrColor: TEXCOORD2; 40 32 }; 41 33 42 34 43 struct fragout35 struct pixel 44 36 { 45 37 float4 col: COLOR0; 46 float 4norm: COLOR1;38 float3 norm: COLOR1; 47 39 float3 pos: COLOR2; 48 40 }; … … 104 96 105 97 106 fragoutfrag_skydome(fragin IN)98 pixel frag_skydome(fragin IN) 107 99 { 108 fragoutpix;100 pixel pix; 109 101 110 102 pix.col = IN.hdrColor; -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/treeanimation.cg
r3040 r3041 8 8 float4 position: POSITION; 9 9 float3 normal: NORMAL; 10 float 3color: COLOR;11 float 2 texcoord: TEXCOORD0;10 float4 color: COLOR; 11 float4 texCoord: TEXCOORD0; 12 12 }; 13 14 13 15 14 // vtx output 16 15 struct vtxout 17 16 { 18 float4 position: POSITION; // eye space17 float4 position: POSITION; 19 18 float4 texCoord: TEXCOORD0; 20 19 21 20 float4 color: COLOR0; 21 float4 eyePos: TEXCOORD1; // eye position 22 22 float3 normal: TEXCOORD2; 23 float4 eyePos: TEXCOORD3;24 23 }; 25 26 24 27 25 … … 34 32 uniform float3 windDir, 35 33 uniform float windStrength, 36 uniform float2 minmaxPos, 34 uniform float frequency, 35 uniform float2 minMaxPos, 37 36 uniform float timer) 38 37 { 39 38 vtxout OUT; 40 39 41 OUT.color = IN.color;40 OUT.color = float4(0);//IN.color; 42 41 OUT.texCoord = IN.texCoord; 42 43 const float pos = (minMaxPos.x - IN.position.z) / (minMaxPos.x - minMaxPos.y); 44 45 float factor = pos * windStrength * sin(timer * frequency); 46 47 // transform the vertex position into post projection space 48 OUT.position = mul(glstate.matrix.mvp, IN.position); 49 // displace the input position 50 OUT.position += float4(factor * windDir, 0); 51 43 52 // transform the vertex position into eye space 44 53 OUT.eyePos = mul(glstate.matrix.modelview[0], IN.position); 45 46 const float pos = (minmaxPos.x - IN.position.y / (minmaxPos.x - minmaxPos.y); 47 48 float factor = windStrength * sin(timer); 49 50 // displace the input position 51 float4 newPos = IN.position + float4(factor * windDir, 0.0f); 52 // transform the vertex position into post projection space 53 OUT.position = mul(glstate.matrix.mvp, IN.position); 54 OUT.eyePos += float4(factor * windDir, 0); 54 55 55 56 OUT.normal = IN.normal;
Note: See TracChangeset
for help on using the changeset viewer.