Changeset 1879 for GTP/trunk/App/Demos/Illum/Ogre/Media/materials/programs
- Timestamp:
- 12/11/06 16:30:08 (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/App/Demos/Illum/Ogre/Media/materials/programs/GameTools_HPS_Smoke_L_Depth.hlsl
r1838 r1879 21 21 { 22 22 VS_OUT OUT; 23 //texCoord.z = normalize(texCoord.z); 24 //texCoord.w = normalize(texCoord.w); 25 float2 offset = texCoord.zw * baseRadius; 23 float2 offset = texCoord.zw * baseRadius; 26 24 OUT.r = abs(offset.x); 27 25 float4 cPosition; … … 30 28 cPosition.xy += offset; 31 29 OUT.cPosition = cPosition; 30 OUT.cPosition.z += baseRadius; 32 31 OUT.cPosition.z *= -1; 33 //OUT.cPosition.z = OUT.cPosition.z - OUT.r;34 32 35 33 OUT.hPosition = mul( Proj, cPosition ); … … 48 46 uniform sampler2D Texture : register(s0), 49 47 uniform sampler2D depthTexture : register(s1), 48 uniform sampler2D illumVolume : register(s2), 50 49 uniform float farplane, 51 uniform float width = 800, 52 uniform float height = 600 50 uniform float nearplane 53 51 ) : COLOR 54 52 { … … 60 58 61 59 if(b == 0) 62 discard; 63 64 float2 halfpixel = float2(1.0 / width, 1.0 / height); 65 IN.screenCoord += halfpixel; 66 60 discard; 61 67 62 float sceneDepth = tex2D(depthTexture, IN.screenCoord).r; 68 63 if(sceneDepth == 0) 69 //discard;70 64 sceneDepth = farplane; 71 65 72 66 float size = 2.0 * IN.r; 73 67 float frontDepth = IN.cPosition.z + size * (f - 0.5); 74 68 float backDepth = IN.cPosition.z + size * (b - 0.5); 75 69 76 alpha = (sceneDepth - frontDepth) / (backDepth - frontDepth); 70 float far = min(sceneDepth, backDepth); 71 float near = max(frontDepth, nearplane); 72 73 alpha = (far - near) / (backDepth - frontDepth); 77 74 alpha = saturate(alpha) * impostor.a; 78 75 79 //Color = float4(Color.g, 0, 0, 1);76 80 77 Color = float4(1, 1, 1, alpha) * IN.Color; 81 //Color = float4(b - 0.5, 0, 0, 1); 82 //Color = sceneDepth / farplane; 83 //Color = 1; 84 return Color; 78 return Color; 85 79 86 80 }
Note: See TracChangeset
for help on using the changeset viewer.