Changeset 3000


Ignore:
Timestamp:
10/03/08 16:25:43 (16 years ago)
Author:
mattausch
Message:

something shitty

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  
    8484static CGparameter sColorsTexCombinedSsaoParam; 
    8585static CGparameter sSsaoTexCombinedSsaoParam; 
    86 static CGparameter sPositionsTexCombinedSsaoParam; 
    8786 
    8887static CGparameter sTLParam; 
     
    436435                sColorsTexCombinedSsaoParam = cgGetNamedParameter(sCgCombinedSsaoProgram, "colors");   
    437436                sSsaoTexCombinedSsaoParam = cgGetNamedParameter(sCgCombinedSsaoProgram, "ssaoTex"); 
    438                 sPositionsTexCombinedSsaoParam = cgGetNamedParameter(sCgCombinedSsaoProgram, "positions"); 
    439437        } 
    440438        else 
     
    10581056        cgGLEnableTextureParameter(sSsaoTexCombinedSsaoParam); 
    10591057 
    1060         cgGLSetTextureParameter(sPositionsTexCombinedSsaoParam, positionsTex); 
    1061         cgGLEnableTextureParameter(sPositionsTexCombinedSsaoParam); 
    10621058         
    10631059        glColor3f(1.0f, 1.0f, 1.0f); 
     
    10761072        cgGLDisableTextureParameter(sColorsTexCombinedSsaoParam); 
    10771073        cgGLDisableTextureParameter(sSsaoTexCombinedSsaoParam); 
    1078         cgGLDisableTextureParameter(sPositionsTexCombinedSsaoParam); 
    10791074         
    10801075        cgGLDisableProfile(RenderState::sCgFragmentProfile); 
  • GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/globillum.cg

    r2999 r3000  
    5959GiStruct globIllum(fragment IN, 
    6060                                   uniform sampler2D colors, 
    61                                    uniform sampler2D positions, 
    6261                                   uniform sampler2D noiseTexture, 
    6362                                   uniform float2 samples[NUM_SAMPLES], 
     
    109108                //float3 rotView = normalize(Interpol(texcoord, bl, br, tl, tr)); 
    110109                float3 rotView = Interpol(texcoord, bl, br, tl, tr); 
     110                //float3 rotView = Interpol(texcoord, bl, br, tl, tr); 
    111111                 
    112112                const float3 sample_position = eyePos - rotView * eyeSpaceDepth; 
    113113                const float3 sample_color = sample.xyz; 
    114  
    115                 // use lower lod level to improve cache coherence 
    116                 //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; 
    118114 
    119115                float3 vector_to_sample = sample_position - centerPosition.xyz; 
     
    147143 
    148144 
    149 /** The mrt shader for screen space ambient occlusion + indirect illumination 
    150 */ 
     145 
    151146pixel2 main(fragment IN,  
    152147                   uniform sampler2D colors, 
     
    181176        // the current world position 
    182177        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*/ 
    183188        // the current color 
    184189        const float4 currentCol = tex2Dlod(colors, float4(IN.texCoord.xy, 0, 0)); 
     
    186191        const float currentDepth = centerPosition.w; 
    187192 
    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); 
    189194         
    190195 
  • GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/mrt.cg

    r2999 r3000  
    3939  float4 col: COLOR0; 
    4040  //float4 pos: COLOR1; 
    41   float2 pos: COLOR1; 
     41  float4 pos: COLOR1; 
    4242  float4 norm: COLOR2; 
    4343}; 
     
    8585                          uniform float3 br, 
    8686                          uniform float3 tl, 
    87                           uniform float3 tr) 
     87                          uniform float3 tr 
     88                          ) 
    8889{ 
    8990        float4 texColor = tex2D(tex, IN.texCoord.xy); 
     
    9798        // hack: use combination of emmisive + diffuse (emmisive used as constant ambient term) 
    9899        pix.col = (glstate.material.emission + glstate.material.diffuse) * texColor;  
    99  
    100         // save world position in second render target 
    101         //pix.pos = IN.worldPos * maxDepth; 
    102100        // save world space normal in third rt 
    103101        pix.norm.xyz = IN.normal; 
    104  
    105102        // store projection coordinates with positions (used for ssao) 
    106103        pix.norm.w = IN.projPos.w; 
    107104 
    108105        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; 
    113108        const float magView = length(Interpol(screenCoord, bl, br, tl, tr)); 
    114109 
     
    117112 
    118113        // 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; 
    121121 
    122122        return pix; 
     
    136136        // hack: use comination of emmisive + diffuse (emmisive used as constant ambient term) 
    137137        pix.col = glstate.material.diffuse + glstate.material.emission; 
    138         //pix.pos = IN.worldPos * maxDepth; 
    139138 
    140139        pix.norm.xyz = IN.normal; 
     
    144143 
    145144        const float4 projPos = IN.mypos / IN.mypos.w; 
    146         // store the projected depth 
    147         pix.pos.y = projPos.z; 
    148  
     145         
    149146        float2 screenCoord = projPos.xy * 0.5f + 0.5f; 
    150147        const float magView = length(Interpol(screenCoord, bl, br, tl, tr)); 
     
    152149        // hack: squeeze some information about the ambient term into the target 
    153150        //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; 
    156157 
    157158        return pix; 
  • GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/ssao.cg

    r2999 r3000  
    173173        const float4 centerPosition = tex2D(positions, IN.texCoord.xy); 
    174174 
    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 
    179176        /// reconstruct position from the eye space depth 
    180177/*      float3 viewDir = normalize(IN.view); 
     
    185182*/ 
    186183        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); 
    187187 
    188188#endif 
     
    217217 
    218218        const float oldDepth = oldCol.w; 
    219         const float oldNumSamples = oldCol.y; 
     219        //const float oldNumSamples = oldCol.y; 
    220220        const float oldWeight = clamp(oldCol.z, 0, temporalCoherence); 
    221221 
     
    256256pixel combine(fragment IN,  
    257257                          uniform sampler2D colors, 
    258                           uniform sampler2D ssaoTex, 
    259                           uniform sampler2D positions) 
     258                          uniform sampler2D ssaoTex) 
    260259{ 
    261260        pixel OUT; 
Note: See TracChangeset for help on using the changeset viewer.