Ignore:
Timestamp:
10/09/08 11:48:06 (16 years ago)
Author:
mattausch
Message:
 
File:
1 edited

Legend:

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

    r3017 r3018  
    1717  float4 worldPos: TEXCOORD1; // world position 
    1818  float3 normal: TEXCOORD2; 
    19   float4 projPos: TEXCOORD3; 
    2019}; 
    2120 
     
    3130        float4 worldPos: TEXCOORD1; // world position 
    3231        float3 normal: TEXCOORD2; 
    33         float4 projPos: TEXCOORD3; 
    3432}; 
    3533 
     
    5957 
    6058        OUT.normal = IN.normal; 
    61         OUT.projPos = OUT.position; 
    6259 
    6360        return OUT; 
     
    104101 
    105102        // compute eye linear depth 
    106         const float4 projPos = IN.projPos / IN.projPos.w; 
    107          
    108         float2 screenCoord = projPos.xy * 0.5f + 0.5f; 
    109          
    110         const float3 viewVec = Interpol(screenCoord, bl, br, tl, tr); 
    111         const float invMagView = 1.0f / length(viewVec); 
    112         // note: has to done in this order, otherwise strange precision problems! 
    113         pix.col.w = invMagView * length(eyePos - IN.worldPos.xyz); 
     103        pix.col.w = length(eyePos - IN.worldPos.xyz); 
    114104 
    115105        return pix; 
     
    133123        // hack: squeeze some information about the ambient term into the target 
    134124        //pix.col.w = glstate.material.emission.x; 
    135          
    136         // compute eye linear depth and scale with lenght to avoid sqr root in pixel shader 
    137         const float4 projPos = IN.projPos / IN.projPos.w; 
    138          
    139         float2 screenCoord = projPos.xy * 0.5f + 0.5f; 
    140         const float magView = length(Interpol(screenCoord, bl, br, tl, tr)); 
    141         pix.col.w = length(eyePos - IN.worldPos.xyz) / magView; 
     125        pix.col.w = length(eyePos - IN.worldPos.xyz); 
    142126 
    143127        return pix; 
Note: See TracChangeset for help on using the changeset viewer.