Ignore:
Timestamp:
11/20/08 10:12:28 (16 years ago)
Author:
mattausch
Message:

normal mapping hack not working yet. found problems with ssao if the geometry is not tesselated enough (especially with smoothed
normals: one can see the underlying tesselation!

File:
1 edited

Legend:

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

    r3144 r3146  
    8686 
    8787 
    88 /**************************************************************/ 
    89 /* Shader computing the MRT output for normal mapped geoemtry */ 
    90 /**************************************************************/ 
     88/******************************************************************/ 
     89/*   Shader computing the MRT output for normal mapped geometry  */ 
     90/******************************************************************/ 
    9191 
    9292 
     
    126126        // compute tangent space - world space transform which is the transpose, 
    127127        // as it is the inverse of a rotation matrix  
    128         float3x3 tangToWorldTrafo = transpose(float3x3(IN.tangent, IN.bitangent, IN.normal)); 
     128        float3x3 tangToWorldTrafo = transpose(float3x3(IN.tangent.xyz, IN.bitangent.xyz, IN.normal.xyz)); 
    129129        const float3 tangentSpaceNorm = tex2Dlod(normalMap, float4(IN.texCoord.xy, 0, 0)).xyz; 
    130130        pix.normal = mul(tangToWorldTrafo, tangentSpaceNorm); 
     
    136136pixel frag(fragin IN, 
    137137                   uniform float4x4 viewMatrix, 
    138                    uniform sampler2D normalMap: TEXUNIT1) 
     138                   uniform sampler2D normalMap: TEXUNIT0) 
    139139{ 
    140140        pixel pix; 
    141141        // hack: use comination of emmisive + diffuse (emmisive used as constant ambient term) 
    142142        pix.color = glstate.material.diffuse + glstate.material.emission; 
    143         // save world space normal in rt => transform back into world space by 
    144         // multiplying with inverse view. since transforming normal with T means to  
    145         // multiply with the inverse transpose of T, we multiple with Transp(Inv(Inv(view))) = Transp(view) 
    146         pix.normal = mul(transpose(viewMatrix), IN.normal).xyz; 
     143         
    147144        // eye space depth 
    148145        pix.color.w = length(IN.eyePos.xyz); 
     
    165162        const float3 tangentSpaceNorm = tex2Dlod(normalMap, float4(IN.texCoord.xy, 0, 0)).xyz; 
    166163        pix.normal = mul(tangToWorldTrafo, tangentSpaceNorm); 
    167  
     164        pix.normal = tangentSpaceNorm; 
    168165        return pix; 
    169166} 
Note: See TracChangeset for help on using the changeset viewer.