Ignore:
Timestamp:
12/22/08 16:07:19 (16 years ago)
Author:
mattausch
Message:

fast and cool
not using kernel for high convergence

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

Legend:

Unmodified
Added
Removed
  • GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/common.h

    r3227 r3230  
    5959        return rpt; 
    6060} 
     61 
     62 
     63#define USE_GTX 
  • GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/deferred.cg

    r3227 r3230  
    230230        // compute position from old frame for dynamic objects + translational portion 
    231231        //const float3 translatedPos = difVec - oldEyePos + worldPos.xyz; 
    232         const float3 translatedPos = - oldEyePos + worldPos.xyz; 
     232        const float3 translatedPos = -oldEyePos + worldPos.xyz; 
    233233 
    234234 
     
    276276                pixelValid = pixelNotValid; 
    277277        } 
    278         else if (!((oldEyeSpaceDepth > 1e10f) || (projectedEyeSpaceDepth > 1e10f)) && 
     278        else if (//!((oldEyeSpaceDepth > 1e10f) || (projectedEyeSpaceDepth > 1e10f)) && 
    279279                // check if changed from dynamic to not dynamic object 
    280280                ((oldDynamic && !newDynamic) || (!oldDynamic && newDynamic) || 
    281281                // check if we have a dynamic object and is a depth discontinuity 
    282282                ( 
    283                 //(oldDynamic || newDynamic) &&  
     283                (oldDynamic || newDynamic) &&  
     284                //(depthDif > 1e-5f)))) 
    284285                (depthDif > MIN_DEPTH_DIFF)))) 
    285286        {        
  • GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/globillum.cg

    r3212 r3230  
    186186        currentPos /= currentPos.w; 
    187187         
    188         const float currentDepth = currentPos.z * PRECISION_SCALE; 
     188        const float currentDepth = currentPos.z; 
    189189 
    190190        /////////// 
     
    203203 
    204204        // the current depth projected into the old frame 
    205         const float projDepth = projPos.z * PRECISION_SCALE; 
     205        const float projDepth = projPos.z; 
    206206 
    207207        // fit from unit cube into 0 .. 1 
  • GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/ssao.cg

    r3227 r3230  
    9393        const float depthDif = abs(1.0f - oldEyeSpaceDepth / projectedEyeSpaceDepth); 
    9494 
    95         //const float xOffs = 1.0f / 1024.0f; const float yOffs = 1.0f / 768.0f; const float eps = 1e-6f; 
    96  
    9795        // the weight of the accumulated samples from the previous frames 
    9896        float w; 
     
    102100 
    103101        if (1 
    104         //      && (oldTexCoords.x + eps >= xOffs) && (oldTexCoords.x <= 1.0f - xOffs + eps) 
    105         //      && (oldTexCoords.y + eps >= yOffs) && (oldTexCoords.y <= 1.0f - yOffs + eps) 
    106102                && (oldTexCoords.x > 0) && (oldTexCoords.x < 1.0f) 
    107103                && (oldTexCoords.y > 0) && (oldTexCoords.y < 1.0f) 
     
    232228                        float3 tr,  
    233229                        float3 viewDir, 
    234                         float newWeight, 
     230                        float convergence, 
    235231                        float sampleIntensity, 
    236232                        bool isMovingObject 
     
    243239        for (int i = 0; i < NUM_SAMPLES; ++ i)  
    244240        { 
    245                 const float2 offset = samples[i]; 
    246  
    247                 float2 offsetTransformed; 
     241                float2 offset; 
    248242 
    249243                //////////////////// 
     
    251245                //-- (affects performance for some reason!) 
    252246 
    253                 float2 mynoise = tex2Dlod(noiseTex, float4(IN.texCoord * 4.0f, 0, 0)).xy; 
    254                 //float2 mynoise = tex2Dlod(noiseTex, float4(IN.texCoord, 0, 0)).xy; 
    255                 //offsetTransformed = myreflect(offset, mynoise); 
    256                 offsetTransformed = myrotate(offset, mynoise.x); 
     247                if (convergence < 700) 
     248                { 
     249                        float2 mynoise = tex2Dlod(noiseTex, float4(IN.texCoord * 4.0f, 0, 0)).xy; 
     250                        //offsetTransformed = myreflect(offset, mynoise); 
     251                        offset = myrotate(samples[i], mynoise.x); 
     252                } 
     253                else 
     254                { 
     255                        offset = samples[i]; 
     256                } 
    257257                 
    258258                // weight with projected coordinate to reach similar kernel size for near and far 
    259                 const float2 texcoord = IN.texCoord.xy + offsetTransformed * scaleFactor; 
     259                const float2 texcoord = IN.texCoord.xy + offset * scaleFactor; 
    260260 
    261261                const float4 sampleColor = tex2Dlod(colors, float4(texcoord, .0f, .0f)); 
     
    299299                // we can bail out early and use a minimal #samples) 
    300300                // if some conditions are met as long as the hardware supports it 
    301                 if (numSamples >= 8) 
     301                if (numSamples >= MIN_SAMPLES) 
    302302                { 
     303                        //break; 
    303304                        // if the pixel belongs to a static object and all the samples stay valid in the current frame 
    304305                        if (!isMovingObject && (validSamples < 1.0f)) break; 
    305306                        // if the pixel belongs to a dynamic object but the #accumulated samples for this pixel is sufficiently high  
    306307                        // (=> there was no discontinuity recently) 
    307                         else if (isMovingObject && (newWeight > NUM_SAMPLES * 5)) break; 
     308                        else if (isMovingObject && (convergence > NUM_SAMPLES * 5)) break; 
    308309                } 
    309310#endif 
Note: See TracChangeset for help on using the changeset viewer.