Changeset 2527
- Timestamp:
- 07/05/07 16:18:22 (17 years ago)
- Location:
- GTP/trunk/App/Demos/Illum/Ogre/Media
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/App/Demos/Illum/Ogre/Media/Station/StationBase.hlsl
r2507 r2527 250 250 { 251 251 //Color *= 0.00000000001; 252 Color += diffuseColor* Caustics(CausticCubeMap, CausticCasterDepthMap, IN.wPos - causticCasterCenter1, causticAttenuationRange1);252 Color.rgb += diffuseColor.rgb * Caustics(CausticCubeMap, CausticCasterDepthMap, IN.wPos - causticCasterCenter1, causticAttenuationRange1); 253 253 } 254 254 //Color.a = dist; -
GTP/trunk/App/Demos/Illum/Ogre/Media/Station/station.material
r2489 r2527 263 263 } 264 264 265 material GTP/Station/CauCube_Point 266 { 267 technique 268 { 269 pass 270 { 271 cull_hardware none 272 scene_blend src_alpha one 273 depth_check off 274 vertex_program_ref GTP/Caustic/CauCube_PointSprite_VS 275 { 276 param_named_auto WorldView worldview_matrix 277 param_named_auto Proj projection_matrix 278 param_named CauSpriteSize float 20 279 } 280 fragment_program_ref GTP/Caustic/CauCube_Point_PS 281 { 282 param_named CausticColor float4 1 1 1 0.09 283 param_named_auto targetResolution viewport_width 284 } 285 texture_unit 286 { 287 vertex_texture true 288 } 289 texture_unit 290 { 291 texture PowerOfPhotonHitTexel.dds 292 } 293 } 294 } 295 } 296 265 297 material GTP/Station/CauCube_Triangles 266 298 { … … 278 310 param_named_auto Proj projection_matrix 279 311 param_named PhotonMapResolution float 64 280 param_named WorldSize float 0. 01312 param_named WorldSize float 0.1 281 313 } 282 314 fragment_program_ref GTP/Caustic/CauCube_Triangles_PS … … 385 417 update_interval 1 386 418 update_all_face true 387 photonmap_resolution 128419 photonmap_resolution 64 388 420 caustic_cubemap_resolution 256 389 421 photon_map_material GTP/Station/PhotonMap_HitEnv 390 caustic_map_material GTP/Station/CauCube_Point Sprite422 caustic_map_material GTP/Station/CauCube_Point 391 423 //caustic_map_material GTP/Station/CauCube_Triangles 392 424 //use_triangles true -
GTP/trunk/App/Demos/Illum/Ogre/Media/Station/stationIllum.hlsl
r2507 r2527 156 156 } 157 157 158 float Caustics(samplerCUBE cauMap, samplerCUBE distMap, float3 dir, float attenuation)158 float3 Caustics(samplerCUBE cauMap, samplerCUBE distMap, float3 dir, float attenuation) 159 159 { 160 160 float d = length(dir); … … 163 163 caustics *= 1.0 - saturate(d / attenuation); 164 164 165 return caustics.r ;165 return caustics.rgb; 166 166 } -
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 } -
GTP/trunk/App/Demos/Illum/Ogre/Media/materials/GTPCaustic/GTPCaustic.program
r2040 r2527 17 17 source GTPCaustic.hlsl 18 18 entry_point CauCube_PointSprite_PS 19 target ps_3_0 20 } 21 22 fragment_program GTP/Caustic/CauCube_Point_PS hlsl 23 { 24 source GTPCaustic.hlsl 25 entry_point CauCube_Point_PS 19 26 target ps_3_0 20 27 }
Note: See TracChangeset
for help on using the changeset viewer.