Ignore:
Timestamp:
10/01/08 16:44:23 (16 years ago)
Author:
mattausch
Message:

debug version trying to retrieve position from linear eye space depth

Location:
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/deferred.cg

    r2985 r2986  
    8383        OUT.color = col; 
    8484 
    85 OUT.color.w = color.w; 
    86  
     85        OUT.color.xyz = color.w / 1e3f; 
     86         
     87#if 1 
     88 
     89        OUT.color.w = color.w; 
     90 
     91#else 
    8792 
    8893        //////////// 
    8994        //-- write out logaritmic luminance for tone mapping 
    90 /* 
     95 
    9196        float4 oldColor = tex2Dlod(colors, float4(IN.texCoord.xy, 0, MAX_LOD_LEVEL)); 
    9297 
     
    103108        else 
    104109                OUT.color.w = logLumScaled; 
    105 */ 
     110 
     111#endif 
     112 
    106113        return OUT; 
    107114} 
  • GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/ssao.cg

    r2985 r2986  
    3232 
    3333 
     34float3 RotateY(float3 v, float a) 
     35{ 
     36        float3 r; 
     37 
     38        r.z = v.z * cos(a) - v.x * sin(a); 
     39        r.x = v.z * sin(a) + v.x * cos(a); 
     40        r.y = v.y; 
     41 
     42        return r; 
     43} 
     44 
     45 
     46float3 RotateX(float3 v, float a) 
     47{ 
     48        float3 r; 
     49 
     50        r.y = v.y * cos(a) - v.z * sin(a); 
     51        r.z = v.y * sin(a) + v.z * cos(a); 
     52        r.x = v.x; 
     53 
     54        return r; 
     55} 
    3456 
    3557/** The ssao shader returning the an intensity value between 0 and 1 
     
    4365                   uniform float scaleFactor, 
    4466                   uniform float3 viewDir, 
    45                    uniform float3 eyePos 
     67                   uniform float3 eyePos, 
     68                   uniform sampler2D positions, 
     69                   uniform float3 bl, 
     70                   uniform float3 br, 
     71                   uniform float3 tl, 
     72                   uniform float3 tr 
    4673                   ) 
    4774{ 
     
    5279        float total_ao = 0.0; 
    5380        float numSamples = 0; 
     81 
     82        const float y_angle = 0.43633231299858239423092269212215; 
     83        const float x_angle = 0.58177641733144319230789692282954; 
    5484 
    5585        for (int i = 0; i < NUM_SAMPLES; ++ i)  
     
    75105                float eyeSpaceDepth = tex2Dlod(colors, float4(texcoord, 0, SSAO_MIPMAP_LEVEL)).w; 
    76106 
    77                 float3 sample_position = eyePos - viewDir * eyeSpaceDepth;  
    78                  
     107                float rotx = offsetTransformed.x * -x_angle; 
     108                float roty = offsetTransformed.y * -y_angle; 
     109 
     110                float3 rotView_x = RotateY(viewDir, x_angle); 
     111                float3 rotView = RotateX(rotView_x, y_angle); 
     112 
     113                float3 sample_position = eyePos - rotView * eyeSpaceDepth; 
     114                //float3 sample_position = tex2Dlod(positions, float4(texcoord, 0, SSAO_MIPMAP_LEVEL)).xyz; 
    79115 
    80116                float3 vector_to_sample = sample_position - centerPosition.xyz; 
     
    117153                   uniform float maxDepth, 
    118154                   uniform float temporalCoherence, 
    119                    uniform float3 eyePos 
     155                   uniform float3 eyePos, 
     156                   uniform float3 bl, 
     157                   uniform float3 br, 
     158                   uniform float3 tl, 
     159                   uniform float3 tr 
    120160                   ) 
    121161{ 
     
    137177        float3 viewDir = normalize(IN.view); 
    138178 
    139         const float2 ao = ssao(IN, colors, noiseTexture, samples, normal, centerPosition, w, viewDir, eyePos); 
     179        /*const float eyeSpaceDepth = tex2D(colors, IN.texCoord.xy).w; 
     180 
     181        float3 sample_position = eyePos - viewDir * eyeSpaceDepth;  
     182 
     183        OUT.illum_col.xyz = centerPosition.xyz - sample_position; 
     184        OUT.illum_col.w = currentDepth; 
     185        return OUT;*/ 
     186 
     187        //const float2 ao = ssao(IN, positions, noiseTexture, samples, normal, centerPosition, w, viewDir, eyePos); 
     188        const float2 ao = ssao(IN, colors, noiseTexture, samples, normal, centerPosition, w, viewDir, eyePos, positions, 
     189                uniform float3 bl, 
     190                uniform float3 br, 
     191                uniform float3 tl, 
     192                uniform float3 tr); 
    140193                 
    141194 
     
    206259        float4 ao = tex2D(ssaoTex, IN.texCoord.xy); 
    207260 
    208         OUT.illum_col = col * ao.x; 
    209         //OUT.illum_col.w = ao.w; 
     261        //OUT.illum_col = col * ao.x; 
     262        OUT.illum_col = float4(ao.x,ao.x,ao.x, ao.w); 
    210263        OUT.illum_col.w = col.w; 
    211264 
Note: See TracChangeset for help on using the changeset viewer.