Ignore:
Timestamp:
07/03/08 17:52:45 (16 years ago)
Author:
mattausch
Message:
 
Location:
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders
Files:
2 edited

Legend:

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

    r2810 r2811  
    5757 
    5858  // the normal on the current position 
    59   float3 centerNormal = tex2D(normals, IN.texCoord.xy).xyz * 2.0f - 1.0f; 
    60  
     59  float3 centerNormal = tex2D(normals, IN.texCoord.xy).xyz; 
     60  normalize(centerNormal); 
     61   
    6162  // Check in a circular area around the current position. 
    6263  // Shoot vectors to the positions there, and check the angle to these positions. 
     
    6667 
    6768  //const float areaSize = 4.0f;   
    68   const float areaSize = 5e-3f; 
    69   const float sampleIntensity = 0.1; 
     69  const float areaSize = 4e-3f; 
     70  const float sampleIntensity = 0.1f; 
    7071   
    7172  for (int i = 0; i < SAMPLES; i ++) { 
     
    7576    float3 noise = tex2D(noiseTexture, IN.texCoord.xy).xyz * 2.0f - 1.0f; 
    7677 
     78    //    float2 offsetTransformed = offset; 
    7779    float2 offsetTransformed; 
    7880    offsetTransformed.x = noise.r*offset.x - noise.g*offset.y; 
     
    8486     
    8587    float3 vector_to_sample = sample_position - centerPosition; 
     88    // vector_to_sample.z = -vector_to_sample.z; 
    8689    float length_to_sample = length(vector_to_sample); 
    87     float3 direction_to_sample = vector_to_sample / length_to_sample; 
     90    float3 direction_to_sample = vector_to_sample / (length_to_sample + 1e-9f); 
    8891     
    8992    // Angle between current normal and direction to sample controls AO intensity. 
     
    9295     
    9396    // distance between current position and sample position controls AO intensity. 
    94     const float scale = 5e-1f; 
     97    const float maxdist = 5e-1f; 
     98    //const float scale = 50.0f; 
    9599 
    96     float distance_intensity = scale * (1.0f - length_to_sample); 
     100    float distance_intensity = maxdist - length_to_sample; 
    97101    distance_intensity = max(distance_intensity, 0.0f); 
    98102     
     
    112116{ 
    113117  pixel OUT; 
    114   float4 lightDir = float4(1.0f, 1.0f, 1.0f, 0.0f); 
     118  //float4 lightDir = float4(1.0f, 1.0f, 1.0f, 0.0f); 
     119float4 lightDir = float4(0.0f, 1.0f, 0.0f, 0.0f); 
    115120   
    116121  float4 color = tex2D(colors, IN.texCoord.xy); 
     
    121126  float4 position = tex2D(positions, IN.texCoord.xy); 
    122127 
    123   float4 ambient = float4(0.3f); 
     128  float4 ambient = float4(0.1f); 
    124129 
    125130  // float3 L = normalize(lightPosition - position); 
     
    132137  OUT.color = ao; //(ambient + diffuse) * color; 
    133138  //OUT.color = (ambient + diffuse) * color; 
     139   
    134140  //float4 currentPos = tex2D(positions, IN.texCoord.xy); 
     141  //OUT.color = currentPos; 
     142  //float4 currentPos = tex2D(normals, IN.texCoord.xy) * 0.5f + 0.5f; 
    135143  //OUT.color = currentPos; 
    136144   
  • GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/mrt.cg

    r2810 r2811  
    1616  float4 color: COLOR0;   
    1717  float4 worldPos: TEXCOORD1; // world position 
    18   float3 norm: TEXCOORD2; 
     18  float3 normal: TEXCOORD2; 
    1919}; 
    2020 
     
    2929  float4 color: COLOR0;   
    3030  float4 worldPos: TEXCOORD1; // world position 
    31   float3 norm: TEXCOORD2; 
     31  float3 normal: TEXCOORD2; 
    3232}; 
    3333 
     
    5454   // eye pos with linear depth 
    5555   //OUT.worldPos = OUT.position; 
    56    OUT.norm = IN.normal; 
     56   OUT.normal = IN.normal; 
    5757 
    5858   return OUT; 
     
    6666  pix.col = tex2D(tex, IN.texCoord.xy); 
    6767  pix.pos = IN.worldPos * maxDepth; 
    68   pix.norm = IN.norm * 0.5f + 0.5f; 
     68  pix.norm = IN.normal; 
    6969 
    7070  return pix; 
Note: See TracChangeset for help on using the changeset viewer.