Changeset 2217 for GTP/trunk/App/Demos/Illum/Ogre/Media/PMDemo/PathMap.hlsl
- Timestamp:
- 03/09/07 10:31:48 (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/App/Demos/Illum/Ogre/Media/PMDemo/PathMap.hlsl
r2213 r2217 2 2 uniform float4 prmAtlasTilesHalfPixel; 3 3 uniform sampler2D filteredAtlasSampler : register(s0); 4 uniform sampler 1D clusterWeightIndexSampler : register(s1);4 uniform sampler2D clusterWeightIndexSampler : register(s1); 5 5 uniform sampler2D clusterWeightSampler : register(s2); 6 6 uniform float allClusterCount; 7 uniform float clusterCount; //clustercount / 4 8 //uniform float weights[32]; 7 uniform float clusterCount; 9 8 10 9 struct vsInputWalk … … 38 37 39 38 float3 col = 0; 40 for(int iCluster =0; iCluster<16; iCluster++)39 for(int iCluster = 0; iCluster < 32; iCluster++) 41 40 { 42 41 float2 prmTexPos = float2( … … 44 43 1.0 - (input.texAtlas.y + (iCluster / prmAtlasTiles.x)) / prmAtlasTiles.y) + atlasHalfPixel; 45 44 46 //float4 weight = 0.065; 47 //weight = float4(weights[iCluster/4], weights[iCluster/4 + 1],weights[iCluster/4 + 2], weights[iCluster/4 + 3]); 48 //float4 weight = weights[iCluster/4]; 49 float4 weightIndex = tex1D(clusterWeightIndexSampler, ((float)iCluster/4) / clusterCount).r / allClusterCount; 50 float weight1 = tex2D(clusterWeightSampler, float2(weightIndex.r, 0.5)).r; 51 float weight2 = tex2D(clusterWeightSampler, float2(weightIndex.g, 0.5)).r; 52 float weight3 = tex2D(clusterWeightSampler, float2(weightIndex.b, 0.5)).r; 53 float weight4 = tex2D(clusterWeightSampler, float2(weightIndex.a, 0.5)).r; 54 float4 weight = float4(weight1, weight2, weight3, weight4); 55 56 float3 val = tex2D(filteredAtlasSampler, prmTexPos); 57 col += val.xyz * weight.x; 58 iCluster++; 59 60 prmTexPos.x += 1.0 / prmAtlasTiles.x; 61 val = tex2D(filteredAtlasSampler, prmTexPos); 62 col += val.xyz * weight.y; 63 iCluster++; 64 65 prmTexPos.x += 1.0 / prmAtlasTiles.x; 66 val = tex2D(filteredAtlasSampler, prmTexPos); 67 col += val.xyz * weight.z; 68 iCluster++; 69 70 prmTexPos.x += 1.0 / prmAtlasTiles.x; 71 val = tex2D(filteredAtlasSampler, prmTexPos); 72 col += val.xyz * weight.w; 45 float weightIndex = tex2D(clusterWeightIndexSampler, float2(((float)iCluster + 0.5) / clusterCount, 0.5)).r; 46 float weight = tex2D(clusterWeightSampler, float2((weightIndex + 0.5)/allClusterCount, 0.5)).r; 47 //weight = 0.0002 + 0.000000000001 * weight; 48 float3 val = tex2D(filteredAtlasSampler, prmTexPos).xyz; 49 col += val.xyz * weight; 73 50 } 74 51 75 //return col.xxxx *0.00001 + tex2D(filteredAtlasSampler, float2(input.texAtlas.x /32.0f, 1.0 - input.texAtlas.y)); 76 //return float4(1,0,0,1)+col.xxxx*0.0000000001; 77 //return prmAtlasTilesHalfPixel.x*allClusterCount*clusterCount*0.000000000001 + tex2D(filteredAtlasSampler, float2(input.texAtlas.x /32.0f, 1.0 - input.texAtlas.y)).r; 78 return float4(col * 200, 1); 52 return float4(col * 300, 1); 79 53 } 80 54
Note: See TracChangeset
for help on using the changeset viewer.