Ignore:
Timestamp:
10/03/08 16:25:43 (16 years ago)
Author:
mattausch
Message:

something shitty

File:
1 edited

Legend:

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

    r2999 r3000  
    3939  float4 col: COLOR0; 
    4040  //float4 pos: COLOR1; 
    41   float2 pos: COLOR1; 
     41  float4 pos: COLOR1; 
    4242  float4 norm: COLOR2; 
    4343}; 
     
    8585                          uniform float3 br, 
    8686                          uniform float3 tl, 
    87                           uniform float3 tr) 
     87                          uniform float3 tr 
     88                          ) 
    8889{ 
    8990        float4 texColor = tex2D(tex, IN.texCoord.xy); 
     
    9798        // hack: use combination of emmisive + diffuse (emmisive used as constant ambient term) 
    9899        pix.col = (glstate.material.emission + glstate.material.diffuse) * texColor;  
    99  
    100         // save world position in second render target 
    101         //pix.pos = IN.worldPos * maxDepth; 
    102100        // save world space normal in third rt 
    103101        pix.norm.xyz = IN.normal; 
    104  
    105102        // store projection coordinates with positions (used for ssao) 
    106103        pix.norm.w = IN.projPos.w; 
    107104 
    108105        const float4 projPos = IN.mypos / IN.mypos.w; 
    109         // store the projected depth 
    110         pix.pos.y = projPos.z; 
    111  
    112         float2 screenCoord = projPos.xy * 0.5f + 0.5f; 
     106         
     107        const float2 screenCoord = projPos.xy * 0.5f + 0.5f; 
    113108        const float magView = length(Interpol(screenCoord, bl, br, tl, tr)); 
    114109 
     
    117112 
    118113        // eye linear depth 
    119         pix.col.w = (length(eyePos - IN.worldPos.xyz) * maxDepth) / magView; 
    120         pix.pos.x = pix.col.x; 
     114        pix.col.w = length(eyePos - IN.worldPos.xyz) * maxDepth / magView; 
     115 
     116        // save world position in second render target 
     117        pix.pos = IN.worldPos * maxDepth; 
     118        //pix.pos.x = pix.col.w; 
     119        // store the projected depth 
     120        pix.pos.w = projPos.z; 
    121121 
    122122        return pix; 
     
    136136        // hack: use comination of emmisive + diffuse (emmisive used as constant ambient term) 
    137137        pix.col = glstate.material.diffuse + glstate.material.emission; 
    138         //pix.pos = IN.worldPos * maxDepth; 
    139138 
    140139        pix.norm.xyz = IN.normal; 
     
    144143 
    145144        const float4 projPos = IN.mypos / IN.mypos.w; 
    146         // store the projected depth 
    147         pix.pos.y = projPos.z; 
    148  
     145         
    149146        float2 screenCoord = projPos.xy * 0.5f + 0.5f; 
    150147        const float magView = length(Interpol(screenCoord, bl, br, tl, tr)); 
     
    152149        // hack: squeeze some information about the ambient term into the target 
    153150        //pix.col.w = glstate.material.emission.x; 
    154         pix.col.w = (length(eyePos - IN.worldPos.xyz) * maxDepth) / magView; 
    155         pix.pos.x = pix.col.x; 
     151        pix.col.w = length(eyePos - IN.worldPos.xyz) * maxDepth / magView; 
     152 
     153        pix.pos = IN.worldPos * maxDepth; 
     154        //pix.pos.x = pix.col.w; 
     155        // store the projected depth 
     156        pix.pos.w = projPos.z; 
    156157 
    157158        return pix; 
Note: See TracChangeset for help on using the changeset viewer.