Ignore:
Timestamp:
10/05/08 23:13:58 (16 years ago)
Author:
mattausch
Message:
 
Location:
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders
Files:
5 edited

Legend:

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

    r2992 r3005  
    4848        float4 outColor; 
    4949 
    50         if (position.w > 1e19f) outColor = color; 
     50        // hack: prevent shading the sky 
     51        if (position.z > 1e19f) outColor = color; 
    5152        //if (emmisive > 1.5f) outColor = color; 
    5253        else outColor = (ambient + diffuse) * color; 
    5354 
    5455        return outColor; 
    55         //return saturate((((ambient + diffuse)) * (1.0f - emmisive) + emmisive) * color); 
    5656} 
    5757 
     
    188188        // calc diffuse illumination + shadow term 
    189189        //if ((emmisive < 1.5f) // hack: prevent shadowing the sky       
    190         if ( 
    191                 (position.w < 1e19f) 
     190        if ((position.z < 1e19f) 
    192191                && (angle > 1e-3f) // shadow only if diffuse color has some minimum intensity 
    193192                ) 
     
    209208        // base lighting 
    210209        //OUT.color = (emmisive > 1.5f) ? color: (ambient + diffuse) * color; 
    211         OUT.color = (position.w > 1e19f) ? color: (ambient + diffuse) * color; 
     210        OUT.color = (position.z > 1e19f) ? color: (ambient + diffuse) * color; 
    212211 
    213212 
  • GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/mrt.cg

    r3004 r3005  
    3737struct pixel 
    3838{ 
    39   float4 col: COLOR0; 
    40   //float4 pos: COLOR1; 
    41   float4 pos: COLOR1; 
    42   float4 norm: COLOR2; 
     39        float4 col: COLOR0; 
     40        //float4 pos: COLOR1; 
     41        float3 pos: COLOR1; 
     42        float4 norm: COLOR2; 
    4343}; 
    4444 
     
    113113        pix.col.w = length(eyePos - IN.worldPos.xyz) * maxDepth / magView; 
    114114 
     115#if 1 
    115116        // save world position in second render target 
    116         pix.pos = IN.worldPos * maxDepth; 
    117         // store the projected depth 
    118         pix.pos.w = projPos.z; 
     117        pix.pos = IN.worldPos.xyz * maxDepth; 
     118#endif 
    119119 
    120120        return pix; 
     
    150150        pix.col.w = length(eyePos - IN.worldPos.xyz) * maxDepth / magView; 
    151151 
    152         pix.pos = IN.worldPos * maxDepth; 
    153         // store the projected depth 
    154         pix.pos.w = projPos.z; 
     152#if 1 
     153        pix.pos = IN.worldPos.xyz * maxDepth; 
     154#endif 
    155155 
    156156        return pix; 
  • GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/sky_preetham.cg

    r2982 r3005  
    3131{ 
    3232  float4 col: COLOR0; 
    33   float4 pos: COLOR1; 
     33  float3 pos: COLOR1; 
    3434  float4 norm: COLOR2; 
    3535}; 
     
    112112 
    113113        pix.col = IN.color2; 
    114         pix.pos = 1e20f; 
     114        pix.col.w = 2.0f; 
    115115 
    116116        pix.norm.xyz = IN.normal; 
     117        pix.norm.w = IN.mypos.w; 
     118 
     119        pix.pos = 1e20f; 
    117120         
    118         pix.norm.w = IN.mypos.w; 
    119         pix.pos.w = 1e20f; 
    120          
    121         pix.col.w = 2.0f; 
    122  
    123121        return pix; 
    124122} 
  • GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/ssao.cg

    r3004 r3005  
    170170 
    171171 
    172         // the current world position 
    173         const float4 centerPosition = tex2D(positions, IN.texCoord.xy); 
    174  
    175172#if USE_EYE_SPACE_DEPTH 
    176173        /// reconstruct position from the eye space depth 
    177174        float3 viewDir = IN.view; 
    178175        const float eyeDepth = tex2D(colors, IN.texCoord.xy).w; 
    179         float4 centerPosition2; 
    180  
    181         centerPosition2.xyz = eyePos - viewDir * eyeDepth; 
    182         centerPosition2.w = centerPosition.w; 
    183  
    184         const float2 ao = ssao(IN, colors, noiseTexture, samples, normal, centerPosition2, w, eyePos, bl, br, tl, tr); 
     176 
     177        float4 centerPosition; 
     178        centerPosition.xyz = eyePos - viewDir * eyeDepth; 
     179        centerPosition.w = centerPosition.w; 
     180 
     181        const float2 ao = ssao(IN, colors, noiseTexture, samples, normal, centerPosition, w, eyePos, bl, br, tl, tr); 
    185182#else 
    186183 
     184        // the current world position 
     185        const float4 centerPosition = tex2D(positions, IN.texCoord.xy); 
     186 
    187187        const float2 ao = ssao(IN, positions, noiseTexture, samples, normal, centerPosition, w, eyePos, bl, br, tl, tr); 
    188188 
    189189#endif 
    190190 
    191         // get the current depth 
     191        ///////////////// 
     192        //-- compute temporally smoothing 
     193 
     194        float4 realPos = centerPosition * maxDepth; 
     195        realPos.w = 1.0f; 
     196 
     197        // calulcate the current depth 
    192198        //const float currentDepth = centerPosition.w; 
    193199         
     
    198204         
    199205 
    200         ///////////////// 
    201         //-- compute temporally smoothing 
    202  
    203         float4 realPos = centerPosition * maxDepth; 
    204         realPos.w = 1.0f; 
    205  
    206  
    207206        /////////// 
    208207        //-- reprojection new frame into old one  
     
    210209        // calculate projected depth 
    211210        float4 projPos = mul(oldModelViewProj, realPos); 
    212         projPos /= oldPos.w; 
     211        projPos /= projPos.w; 
    213212 
    214213        // the current depth projected into the old frame 
  • GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/tonemap.cg

    r3003 r3005  
    2222float4 DownSample(frag IN, 
    2323                                  uniform sampler2D colors, 
    24                                   float2 downSampleOffs[4]) : COLOR 
     24                                  uniform float2 downSampleOffs[4]): COLOR 
    2525{     
    2626    float4 average = .0f; 
     
    130130        float logLumScaled = logLum * INV_LOGLUM_RANGE - logLumOffset; 
    131131 
    132         if (oldLogLum > 1e-5f) // too hight log lum 
     132        if (oldLogLum > 1e-5f) // too bright 
    133133                OUT.col.w = lerp(oldLogLum, logLumScaled, 0.1f); 
    134134        else 
Note: See TracChangeset for help on using the changeset viewer.