Changeset 2403
- Timestamp:
- 06/05/07 01:55:55 (18 years ago)
- Location:
- GTP/trunk/App/Demos/Illum/Ogre/Media/materials/GTPPathMap
- Files:
-
- 1 added
- 1 deleted
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/App/Demos/Illum/Ogre/Media/materials/GTPPathMap/PathMap.hlsl
r2345 r2403 28 28 output.pos = mul(WorldViewProj, input.pos); 29 29 output.tex = input.tex; 30 output.texAtlas = input.tex Atlas;30 output.texAtlas = input.tex; 31 31 return output; 32 32 } … … 34 34 float4 psWalk(vsOutputWalk input) : COLOR 35 35 { 36 float2 texAtlas = input.texAtlas; 37 36 38 int2 prmAtlasTiles = prmAtlasTilesHalfPixel.xy; 37 39 float2 atlasHalfPixel = prmAtlasTilesHalfPixel.zw; … … 41 43 { 42 44 float2 prmTexPos = float2( 43 ( input.texAtlas.x + (iCluster % prmAtlasTiles.x)) / prmAtlasTiles.x,44 1.0 - ( input.texAtlas.y + (iCluster / prmAtlasTiles.x)) / prmAtlasTiles.y);// + atlasHalfPixel;45 (texAtlas.x + (iCluster % prmAtlasTiles.x)) / prmAtlasTiles.x, 46 1.0 - (texAtlas.y + (iCluster / prmAtlasTiles.x)) / prmAtlasTiles.y);// + atlasHalfPixel; 45 47 46 48 float weightIndex = tex2D(clusterWeightIndexSampler, float2(((float)iCluster + 0.5) / clusterCount, 0.5)).r; 47 49 float3 weight = tex2D(clusterWeightSampler, float2((weightIndex + 0.5)/allClusterCount, 0.5)).rgb; 48 //weight = 0.0002 + 0.000000000001 * weight;49 50 float3 val = tex2D(filteredAtlasSampler, prmTexPos).xyz; 50 if(length(val - float3(1,1,1))== 0) 51 val = 0; 52 col += val.xyz * weight; 51 //if(length(val - float3(1,1,1))== 0) 52 //val = 0; 53 col += val.xyz * weight; 54 //col = 0.00000000001 * col + float3(prmTexPos,1); 53 55 } 54 56 … … 56 58 57 59 //return float4(col,1); 58 return float4(col * color, 1); 60 //return float4(color + 0.0000000001 * col, 1) ; 61 return float4(col * color, 1); 59 62 60 63 61 64 //return float4(col,1) * 0.0000000000001 + tex2D(filteredAtlasSampler, float2(input.texAtlas.x / 32.0, input.texAtlas.y)); 62 65 } 63 66 -
GTP/trunk/App/Demos/Illum/Ogre/Media/materials/GTPPathMap/PathMapWeightCompute.hlsl
r2337 r2403 57 57 float cosb = max(dot(dir, diff), 0); 58 58 59 float visibility = 1;59 float visibility = 0; 60 60 float4 lightVPos = mul(lightViewProj, float4(pos,1)); 61 62 if( lightVPos.z > 0.0)63 {64 lightVPos /= lightVPos.w;65 float d = length(lightVPos.xy);66 67 if(d <= 1.0)68 {69 70 float dist = sqrt(dist2);71 float distNorm = dist / lightFarPlane;72 lightVPos.xy = (lightVPos.xy + 1.0) / 2.0;73 lightVPos.y = 1.0 - lightVPos.y;74 float storedDist = tex2D(shadowMap, lightVPos.xy).r;75 dist -= DIST_BIAS;76 visibility = (distNorm <= storedDist);77 61 62 //if( lightVPos.z > 0.0) 63 //{ 64 lightVPos /= lightVPos.w; 65 //float d = length(lightVPos.xy); 66 67 //if(d <= 1.0) 68 { 69 float dist = dist / lightFarPlane; 70 lightVPos.xy = (lightVPos.xy + 1.0) / 2.0; 71 lightVPos.y = 1.0 - lightVPos.y; 72 float storedDist = tex2D(shadowMap, lightVPos.xy).r; 73 visibility = dist < storedDist + DIST_BIAS; 78 74 } 79 } 80 81 float spotFalloff = (dot(normalize(-diff), normalize(lightDir)) - lightAngleCos) / (1.0 - lightAngleCos); 75 // } 76 //visibility = 1.0 - visibility; 77 visibility = 1.0 + 0.00001 * visibility; 78 float spotFalloff = (dot(-diff, normalize(lightDir)) - lightAngleCos) / (1.0 - lightAngleCos); 79 //spotFalloff = saturate(dot(normalize(pos - lightPos), normalize(lightDir))) + 0.0000000001 * lightAngleCos; 80 spotFalloff = 1.0 + spotFalloff * 0.000000001; 82 81 spotFalloff = pow(saturate(spotFalloff), spotLightFalloff); 83 84 85 visibility *= spotFalloff / (lightAttenuation.y + dist * lightAttenuation.z + dist * dist * lightAttenuation.w); 86 82 83 visibility *= spotFalloff / (lightAttenuation.y + dist * lightAttenuation.z + dist2 * lightAttenuation.w); 87 84 88 85 float4 ret = visibility * cosb * lightPower * lightColor; … … 114 111 float storedDist = texCUBE(shadowMap, float3(-diff.xy, diff.z)).r; 115 112 dist -= DIST_BIAS; 116 visibility = (distNorm <= storedDist); 117 113 visibility = (distNorm <= storedDist); 114 115 //visibility = 1.0 + 0.00001 * visibility; 118 116 visibility *= 1.0 / (lightAttenuation.y + dist * lightAttenuation.z + dist * dist * lightAttenuation.w); 119 117 … … 143 141 float2 coord2 = coord1 + float2(0.25 * dataColumnWidth, 0); 144 142 float3 w = tex2Dlod(allWeightsSampler, float4(coord1, 0, 0)).rgb; 145 float radrad = tex2Dlod(radionSampler, float4(coord 1, 0, 0)).a;143 float radrad = tex2Dlod(radionSampler, float4(coord2, 0, 0)).a; 146 144 weight += w * radrad; 147 145 clusterRad += radrad;
Note: See TracChangeset
for help on using the changeset viewer.