- Timestamp:
- 10/03/08 16:25:43 (16 years ago)
- Location:
- GTP/trunk/App/Demos/Vis/FriendlyCulling/src
- Files:
-
- 1 deleted
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/DeferredRenderer.cpp
r2998 r3000 84 84 static CGparameter sColorsTexCombinedSsaoParam; 85 85 static CGparameter sSsaoTexCombinedSsaoParam; 86 static CGparameter sPositionsTexCombinedSsaoParam;87 86 88 87 static CGparameter sTLParam; … … 436 435 sColorsTexCombinedSsaoParam = cgGetNamedParameter(sCgCombinedSsaoProgram, "colors"); 437 436 sSsaoTexCombinedSsaoParam = cgGetNamedParameter(sCgCombinedSsaoProgram, "ssaoTex"); 438 sPositionsTexCombinedSsaoParam = cgGetNamedParameter(sCgCombinedSsaoProgram, "positions");439 437 } 440 438 else … … 1058 1056 cgGLEnableTextureParameter(sSsaoTexCombinedSsaoParam); 1059 1057 1060 cgGLSetTextureParameter(sPositionsTexCombinedSsaoParam, positionsTex);1061 cgGLEnableTextureParameter(sPositionsTexCombinedSsaoParam);1062 1058 1063 1059 glColor3f(1.0f, 1.0f, 1.0f); … … 1076 1072 cgGLDisableTextureParameter(sColorsTexCombinedSsaoParam); 1077 1073 cgGLDisableTextureParameter(sSsaoTexCombinedSsaoParam); 1078 cgGLDisableTextureParameter(sPositionsTexCombinedSsaoParam);1079 1074 1080 1075 cgGLDisableProfile(RenderState::sCgFragmentProfile); -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/globillum.cg
r2999 r3000 59 59 GiStruct globIllum(fragment IN, 60 60 uniform sampler2D colors, 61 uniform sampler2D positions,62 61 uniform sampler2D noiseTexture, 63 62 uniform float2 samples[NUM_SAMPLES], … … 109 108 //float3 rotView = normalize(Interpol(texcoord, bl, br, tl, tr)); 110 109 float3 rotView = Interpol(texcoord, bl, br, tl, tr); 110 //float3 rotView = Interpol(texcoord, bl, br, tl, tr); 111 111 112 112 const float3 sample_position = eyePos - rotView * eyeSpaceDepth; 113 113 const float3 sample_color = sample.xyz; 114 115 // use lower lod level to improve cache coherence116 //float3 sample_position = tex2Dlod(positions, float4(texcoord, 0, SSAO_MIPMAP_LEVEL)).xyz;117 //float3 sample_color = tex2Dlod(colors, float4(texcoord, 0, GI_MIPMAP_LEVEL)).xyz;118 114 119 115 float3 vector_to_sample = sample_position - centerPosition.xyz; … … 147 143 148 144 149 /** The mrt shader for screen space ambient occlusion + indirect illumination 150 */ 145 151 146 pixel2 main(fragment IN, 152 147 uniform sampler2D colors, … … 181 176 // the current world position 182 177 const float4 centerPosition = tex2D(positions, IN.texCoord.xy); 178 179 /// reconstruct position from the eye space depth 180 /*float3 viewDir = normalize(IN.view); 181 const float eyeDepth = tex2D(colors, IN.texCoord.xy).w; 182 183 float4 centerPosition; 184 centerPosition.xyz = eyePos - viewDir * eyeDepth; 185 186 centerPosition.w = centerPosition2.w; 187 */ 183 188 // the current color 184 189 const float4 currentCol = tex2Dlod(colors, float4(IN.texCoord.xy, 0, 0)); … … 186 191 const float currentDepth = centerPosition.w; 187 192 188 GiStruct gi = globIllum(IN, colors, positions,noiseTexture, samples, normal, centerPosition, w, eyePos, bl, br, tl, tr);193 GiStruct gi = globIllum(IN, colors, noiseTexture, samples, normal, centerPosition, w, eyePos, bl, br, tl, tr); 189 194 190 195 -
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; -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/ssao.cg
r2999 r3000 173 173 const float4 centerPosition = tex2D(positions, IN.texCoord.xy); 174 174 175 #if 0 176 const float2 ao = ssao(IN, positions, noiseTexture, samples, normal, centerPosition, w, eyePos, bl, br, tl, tr); 177 178 #else 175 #if 0 179 176 /// reconstruct position from the eye space depth 180 177 /* float3 viewDir = normalize(IN.view); … … 185 182 */ 186 183 const float2 ao = ssao(IN, colors, noiseTexture, samples, normal, centerPosition, w, eyePos, bl, br, tl, tr); 184 #else 185 186 const float2 ao = ssao(IN, positions, noiseTexture, samples, normal, centerPosition, w, eyePos, bl, br, tl, tr); 187 187 188 188 #endif … … 217 217 218 218 const float oldDepth = oldCol.w; 219 const float oldNumSamples = oldCol.y;219 //const float oldNumSamples = oldCol.y; 220 220 const float oldWeight = clamp(oldCol.z, 0, temporalCoherence); 221 221 … … 256 256 pixel combine(fragment IN, 257 257 uniform sampler2D colors, 258 uniform sampler2D ssaoTex, 259 uniform sampler2D positions) 258 uniform sampler2D ssaoTex) 260 259 { 261 260 pixel OUT;
Note: See TracChangeset
for help on using the changeset viewer.