- Timestamp:
- 10/03/08 16:25:43 (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/mrt.cg
r2999 r3000 39 39 float4 col: COLOR0; 40 40 //float4 pos: COLOR1; 41 float 2pos: COLOR1;41 float4 pos: COLOR1; 42 42 float4 norm: COLOR2; 43 43 }; … … 85 85 uniform float3 br, 86 86 uniform float3 tl, 87 uniform float3 tr) 87 uniform float3 tr 88 ) 88 89 { 89 90 float4 texColor = tex2D(tex, IN.texCoord.xy); … … 97 98 // hack: use combination of emmisive + diffuse (emmisive used as constant ambient term) 98 99 pix.col = (glstate.material.emission + glstate.material.diffuse) * texColor; 99 100 // save world position in second render target101 //pix.pos = IN.worldPos * maxDepth;102 100 // save world space normal in third rt 103 101 pix.norm.xyz = IN.normal; 104 105 102 // store projection coordinates with positions (used for ssao) 106 103 pix.norm.w = IN.projPos.w; 107 104 108 105 const float4 projPos = IN.mypos / IN.mypos.w; 109 // store the projected depth 110 pix.pos.y = projPos.z; 111 112 float2 screenCoord = projPos.xy * 0.5f + 0.5f; 106 107 const float2 screenCoord = projPos.xy * 0.5f + 0.5f; 113 108 const float magView = length(Interpol(screenCoord, bl, br, tl, tr)); 114 109 … … 117 112 118 113 // eye linear depth 119 pix.col.w = (length(eyePos - IN.worldPos.xyz) * maxDepth) / magView; 120 pix.pos.x = pix.col.x; 114 pix.col.w = length(eyePos - IN.worldPos.xyz) * maxDepth / magView; 115 116 // save world position in second render target 117 pix.pos = IN.worldPos * maxDepth; 118 //pix.pos.x = pix.col.w; 119 // store the projected depth 120 pix.pos.w = projPos.z; 121 121 122 122 return pix; … … 136 136 // hack: use comination of emmisive + diffuse (emmisive used as constant ambient term) 137 137 pix.col = glstate.material.diffuse + glstate.material.emission; 138 //pix.pos = IN.worldPos * maxDepth;139 138 140 139 pix.norm.xyz = IN.normal; … … 144 143 145 144 const float4 projPos = IN.mypos / IN.mypos.w; 146 // store the projected depth 147 pix.pos.y = projPos.z; 148 145 149 146 float2 screenCoord = projPos.xy * 0.5f + 0.5f; 150 147 const float magView = length(Interpol(screenCoord, bl, br, tl, tr)); … … 152 149 // hack: squeeze some information about the ambient term into the target 153 150 //pix.col.w = glstate.material.emission.x; 154 pix.col.w = (length(eyePos - IN.worldPos.xyz) * maxDepth) / magView; 155 pix.pos.x = pix.col.x; 151 pix.col.w = length(eyePos - IN.worldPos.xyz) * maxDepth / magView; 152 153 pix.pos = IN.worldPos * maxDepth; 154 //pix.pos.x = pix.col.w; 155 // store the projected depth 156 pix.pos.w = projPos.z; 156 157 157 158 return pix;
Note: See TracChangeset
for help on using the changeset viewer.