Changeset 2811 for GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders
- Timestamp:
- 07/03/08 17:52:45 (16 years ago)
- 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 57 57 58 58 // 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 61 62 // Check in a circular area around the current position. 62 63 // Shoot vectors to the positions there, and check the angle to these positions. … … 66 67 67 68 //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; 70 71 71 72 for (int i = 0; i < SAMPLES; i ++) { … … 75 76 float3 noise = tex2D(noiseTexture, IN.texCoord.xy).xyz * 2.0f - 1.0f; 76 77 78 // float2 offsetTransformed = offset; 77 79 float2 offsetTransformed; 78 80 offsetTransformed.x = noise.r*offset.x - noise.g*offset.y; … … 84 86 85 87 float3 vector_to_sample = sample_position - centerPosition; 88 // vector_to_sample.z = -vector_to_sample.z; 86 89 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); 88 91 89 92 // Angle between current normal and direction to sample controls AO intensity. … … 92 95 93 96 // 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; 95 99 96 float distance_intensity = scale * (1.0f - length_to_sample);100 float distance_intensity = maxdist - length_to_sample; 97 101 distance_intensity = max(distance_intensity, 0.0f); 98 102 … … 112 116 { 113 117 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); 119 float4 lightDir = float4(0.0f, 1.0f, 0.0f, 0.0f); 115 120 116 121 float4 color = tex2D(colors, IN.texCoord.xy); … … 121 126 float4 position = tex2D(positions, IN.texCoord.xy); 122 127 123 float4 ambient = float4(0. 3f);128 float4 ambient = float4(0.1f); 124 129 125 130 // float3 L = normalize(lightPosition - position); … … 132 137 OUT.color = ao; //(ambient + diffuse) * color; 133 138 //OUT.color = (ambient + diffuse) * color; 139 134 140 //float4 currentPos = tex2D(positions, IN.texCoord.xy); 141 //OUT.color = currentPos; 142 //float4 currentPos = tex2D(normals, IN.texCoord.xy) * 0.5f + 0.5f; 135 143 //OUT.color = currentPos; 136 144 -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/mrt.cg
r2810 r2811 16 16 float4 color: COLOR0; 17 17 float4 worldPos: TEXCOORD1; // world position 18 float3 norm : TEXCOORD2;18 float3 normal: TEXCOORD2; 19 19 }; 20 20 … … 29 29 float4 color: COLOR0; 30 30 float4 worldPos: TEXCOORD1; // world position 31 float3 norm : TEXCOORD2;31 float3 normal: TEXCOORD2; 32 32 }; 33 33 … … 54 54 // eye pos with linear depth 55 55 //OUT.worldPos = OUT.position; 56 OUT.norm = IN.normal;56 OUT.normal = IN.normal; 57 57 58 58 return OUT; … … 66 66 pix.col = tex2D(tex, IN.texCoord.xy); 67 67 pix.pos = IN.worldPos * maxDepth; 68 pix.norm = IN.norm * 0.5f + 0.5f;68 pix.norm = IN.normal; 69 69 70 70 return pix;
Note: See TracChangeset
for help on using the changeset viewer.