Ignore:
Timestamp:
10/16/08 19:51:16 (16 years ago)
Author:
mattausch
Message:
 
File:
1 edited

Legend:

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

    r3031 r3034  
    1515 
    1616  float4 color: COLOR0;   
    17   float4 worldPos: TEXCOORD1; // world position 
     17  float4 eyePos: TEXCOORD1; // eye position 
    1818  float3 normal: TEXCOORD2; 
    1919}; 
     
    2424{ 
    2525        float4 color: COLOR0;   
    26         float4 position: POSITION; // eye space 
     26        //float4 position: POSITION; 
    2727        float4 texCoord: TEXCOORD0;     
    2828 
    2929        float4 winPos: WPOS; 
    30         float4 worldPos: TEXCOORD1; // world position 
     30        float4 eyePos: TEXCOORD1; // eye position 
    3131        float3 normal: TEXCOORD2; 
    3232}; 
     
    4040}; 
    4141 
     42 
    4243#pragma position_invariant vtx 
    4344 
    44 vtxout vtx(vtxin IN,  
    45                    uniform float4x4 modelView) 
     45vtxout vtx(vtxin IN) 
    4646{ 
    4747        vtxout OUT; 
     
    5050        OUT.texCoord = IN.texCoord; 
    5151 
    52         //OUT.worldPos = mul(glstate.matrix.inverse.projection, OUT.position); 
    53         OUT.worldPos = mul(modelView, IN.position); 
    5452        // transform the vertex position into eye space 
     53        OUT.eyePos = mul(glstate.matrix.modelview[0], IN.position); 
     54        // transform the vertex position into post projection space 
    5555        OUT.position = mul(glstate.matrix.mvp, IN.position); 
    5656 
     
    6060} 
    6161 
    62  
    63 // bilinear interpolation 
    64 inline float3 Interpol(float2 w, float3 bl, float3 br, float3 tl, float3 tr) 
    65 { 
    66         float3 x1 = lerp(bl, tl, w.y); 
    67         float3 x2 = lerp(br, tr, w.y);  
    68         float3 v = lerp(x1, x2, w.x);  
    69  
    70         return v; 
    71 } 
    72  
    7362//#pragma position_invariant fragtex 
    7463 
    7564pixel fragtex(fragin IN,  
    76                           uniform sampler2D tex, 
    77                           uniform float3 eyePos, 
    78                           uniform float3 bl, 
    79                           uniform float3 br, 
    80                           uniform float3 tl, 
    81                           uniform float3 tr 
     65                          uniform sampler2D tex 
    8266                          ) 
    8367{ 
     
    9983 
    10084        // compute eye linear depth 
    101         pix.col.w = length(eyePos - IN.worldPos.xyz); 
     85        pix.col.w = length(IN.eyePos.xyz); 
    10286 
    10387        return pix; 
     
    10589 
    10690 
    107 pixel frag(fragin IN,  
    108                    uniform float3 eyePos, 
    109                    uniform float3 bl, 
    110                    uniform float3 br, 
    111                    uniform float3 tl, 
    112                    uniform float3 tr) 
     91pixel frag(fragin IN) 
    11392{ 
    11493        pixel pix; 
     
    11998        pix.norm = IN.normal; 
    12099 
     100        pix.col.w = length(IN.eyePos.xyz); 
     101 
    121102        // hack: squeeze some information about the ambient term into the target 
    122103        //pix.col.w = glstate.material.emission.x; 
    123         pix.col.w = length(eyePos - IN.worldPos.xyz); 
    124104 
    125105        return pix; 
Note: See TracChangeset for help on using the changeset viewer.