- Timestamp:
- 07/05/07 16:18:22 (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/App/Demos/Illum/Ogre/Media/materials/GTPCaustic/GTPCaustic.hlsl
r2471 r2527 123 123 OUT.center = cPosition.xy; 124 124 OUT.position = cPosition; 125 OUT.hPosition = mul(Proj, cPosition); 125 OUT.hPosition = mul(Proj, cPosition); 126 OUT.center = float2(OUT.hPosition.x, OUT.hPosition.y) / OUT.hPosition.w; 127 126 128 } 127 129 … … 142 144 IN.color = CausticColor; 143 145 float intens = tex2D(intensityTex, IN.texCoord).r; 146 //IN.color.a *= intens; 147 IN.color *= IN.color.a * intens; 148 IN.color.a = IN.dist; 149 return IN.color; 150 } 151 152 153 float4 CauCube_Point_PS(CauCube_PointSprite_VS_OUT IN, 154 uniform float targetResolution, 155 float2 pixelPos : VPOS, 156 uniform float4 CausticColor, 157 uniform sampler2D intensityTex : register(s1) 158 ):COLOR 159 { 160 IN.color = CausticColor; 161 162 float2 screen = pixelPos / targetResolution; 163 screen *= float2(2, 2); 164 screen -= float2(1, 1); 165 screen.y *= -1; 166 float2 texCoord = (screen - IN.center) / (IN.r / targetResolution);//(-1 , 1) 167 168 float intens = 1.0 - saturate(length(texCoord)); 169 //return float4(intens,0,1,1); 170 //texCoord = (texCoord + 1.0) / 2.0; // (0, 1) 171 //float intens = tex2D(intensityTex, texCoord).r; 172 173 144 174 //IN.color.a *= intens; 145 175 IN.color *= IN.color.a * intens; … … 178 208 if(pos.a == 0)//no photon hit 179 209 { 180 OUT.color = float4(0, 0,0,0);210 OUT.color = float4(0,1,0,1); 181 211 OUT.hPosition = float4(1000000, 1000000, 1000000, 1); 182 212 } … … 227 257 228 258 float avrdist = sumdist / valids; 229 if(valids == 0) avrdist = WorldSize / 1000.0;259 if(valids * avrdist == 0) avrdist = WorldSize / 1000.0; 230 260 231 261 intensity = WorldSize / (avrdist * avrdist * 3.14); 262 intensity = min(50, max(0,intensity)); 232 263 //intensity = 0.8; 233 264 265 // if(dot(intensity, intensity) == 0) 266 // OUT.color = float4(1,0,0,1); 267 // else 234 268 OUT.color = intensity; 235 if(notUseIntensity) 236 OUT.color = float4(1,1,1,1); 269 270 // if(notUseIntensity) 271 // OUT.color = float4(1,1,1,1); 237 272 } 238 273 239 274 OUT.dist = length(pos.xyz); 275 //OUT.color = float4(0,0,0,0); 240 276 return OUT; 241 277 }
Note: See TracChangeset
for help on using the changeset viewer.