uniform float4x4 WorldViewProj; uniform float4 prmAtlasTilesHalfPixel; uniform sampler2D filteredAtlasSampler : register(s0); uniform sampler2D clusterWeightIndexSampler : register(s1); uniform sampler2D clusterWeightSampler : register(s2); uniform sampler2D colorSampler : register(s3); uniform float allClusterCount; uniform float clusterCount; struct vsInputWalk { float4 pos : POSITION; float2 tex : TEXCOORD0; float2 texAtlas : TEXCOORD1; }; struct vsOutputWalk { float4 pos : POSITION; float2 tex : TEXCOORD0; float2 texAtlas : TEXCOORD1; }; vsOutputWalk vsWalk(vsInputWalk input) { vsOutputWalk output = (vsOutputWalk)0; output.pos = mul(WorldViewProj, input.pos); output.tex = input.tex; output.texAtlas = input.texAtlas; return output; } float4 psWalk(vsOutputWalk input) : COLOR { float2 texAtlas = input.texAtlas; int2 prmAtlasTiles = prmAtlasTilesHalfPixel.xy; float2 atlasHalfPixel = prmAtlasTilesHalfPixel.zw; float3 col = 0; for(int iCluster = 0; iCluster < 32; iCluster++) { float2 prmTexPos = float2( (texAtlas.x + (iCluster % prmAtlasTiles.x)) / prmAtlasTiles.x, 1.0 - (texAtlas.y + (iCluster / prmAtlasTiles.x)) / prmAtlasTiles.y) + atlasHalfPixel; float weightIndex = tex2D(clusterWeightIndexSampler, float2(((float)iCluster + 0.5) / clusterCount, 0.5)).r; float3 weight = tex2D(clusterWeightSampler, float2((weightIndex + 0.5)/allClusterCount, 0.5)).rgb; float3 val = tex2D(filteredAtlasSampler, prmTexPos).xyz; //if(length(val - float3(1,1,1))== 0) //val = 0; col += val.xyz * weight; //col = 0.00000000001 * col + float3(prmTexPos,1); } float3 color = tex2D(colorSampler, input.tex).rgb; //return float4(col,1); //return float4(color + 0.0000000001 * col, 1) ; return float4(col * color, 1); //return float4(col,1) * 0.0000000000001 + tex2D(filteredAtlasSampler, float2(input.texAtlas.x / 32.0, input.texAtlas.y)); }