Changeset 2814 for GTP/trunk


Ignore:
Timestamp:
07/04/08 01:32:30 (16 years ago)
Author:
mattausch
Message:
 
Location:
GTP/trunk/App/Demos/Vis/FriendlyCulling/src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • GTP/trunk/App/Demos/Vis/FriendlyCulling/src/chcdemo.cpp

    r2813 r2814  
    9898 
    9999// rendertexture 
    100 //const static int texWidth = 1024; 
    101 //const static int texHeight = 768; 
    102 const static int texWidth = 2048; 
    103 const static int texHeight = 2048; 
     100const static int texWidth = 1024; 
     101const static int texHeight = 768; 
     102//const static int texWidth = 2048; 
     103//const static int texHeight = 2048; 
    104104 
    105105int renderedObjects = 0; 
     
    18021802#else 
    18031803void CreateNoiseTex2D() 
    1804 {int w=256; 
    1805 int h=256; 
     1804{ 
    18061805        GLubyte *data = new GLubyte[texWidth * texHeight * 4]; 
    18071806 
     
    18121811                const float theta = 2.0f * acos(sqrt(1.0f - rx)); 
    18131812 
    1814                 data[i + 0] = (GLubyte)((sin(theta) * 0.5f + 0.5f) * 255.0f); 
    1815                 data[i + 1] = (GLubyte)((cos(theta) * 0.5f + 0.5f) * 255.0f); 
     1813                data[i + 0] = (GLubyte)((cos(theta) * 0.5f + 0.5f) * 255.0f); 
     1814                data[i + 1] = (GLubyte)((sin(theta) * 0.5f + 0.5f) * 255.0f); 
    18161815                data[i + 2] = 0; 
    18171816                data[i + 3] = 255; 
  • GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/deferred.cg

    r2813 r2814  
    4444 
    4545 
     46float2 reflect(float2 pt, float2 n) 
     47{ 
     48  // distance to plane 
     49  float d = dot(n, pt); 
     50  // reflect around plane 
     51  float2 rpt = pt - d * 2.0f * n; 
     52   
     53  //return pt; 
     54  return rpt; 
     55} 
     56 
     57 
    4658//based on kustls shader         
    4759float ssao(fragment IN, 
     
    7789    float3 noise = tex2D(noiseTexture, IN.texCoord.xy).xyz * 2.0f - 1.0f; 
    7890 
    79     float2 offsetTransformed = offset; 
    80     //float2 offsetTransformed; 
    81     //offsetTransformed.x = noise.r*offset.x - noise.g*offset.y; 
    82     //offsetTransformed.y = noise.g*offset.x + noise.r*offset.y; 
     91    //float2 offsetTransformed = offset;//reflect(offset, noise.xy); 
     92    float2 offsetTransformed; 
     93    offsetTransformed.x = noise.r * offset.x - noise.g * offset.y; 
     94    offsetTransformed.y = noise.g * offset.x + noise.r * offset.y; 
    8395                 
    8496    // weight with projected coordinate to reach similar kernel size for near and far 
     
    96108     
    97109    // distance between current position and sample position controls AO intensity. 
    98     const float maxdist = 1e-1f; 
     110    const float maxdist = 5e-1f; 
    99111    //const float scale = 50.0f; 
    100112 
    101113    float distance_intensity = maxdist - length_to_sample; 
     114    distance_intensity *= distance_intensity; 
    102115    distance_intensity = max(distance_intensity, 0.0f); 
    103116     
Note: See TracChangeset for help on using the changeset viewer.