uniform int column[15] = {0,2,3,5,7,0,2,4,5,7,0,2,4,5,7}; const int phaseR = 0, phaseG = 1, phaseB = 2; struct VS_QUAD { float4 Position : POSITION; float2 UV : TEXCOORD0; }; int eye_pixelpattern(float2 scrcoord, int renderPhase) { float i = floor(frac(scrcoord.x / 5) * 5); int cureye; if(renderPhase == phaseR){ float r = floor(frac((0 + i*5) / 8) * 8); // (0 + i*5) modulo 8 r = floor(frac((r + scrcoord.y)/8)*8); cureye = (int)r; } if(renderPhase == phaseG){ float g = floor(frac((2 + i*5) / 8) * 8); // (2 + i*5) modulo 8 g = g-1; g = floor(frac((g + scrcoord.y)/8)*8); cureye = (int)g; } if(renderPhase == phaseB){ float b = floor(frac((3 + i*5) / 8) * 8); // (3 + i*5) modulo 8 b = floor(frac((b + scrcoord.y)/8)*8); cureye = (int)b; } return cureye; } float4 X3DPS(float2 UV : TEXCOORD0, uniform sampler2D tex3Sampler : register(s0), uniform float width, //window width uniform float height)//window height : COLOR0 { const int SAMPLE_ROWS = 4; const int SAMPLE_COLS = 2; float2 WPOS = float2(UV.x * width, UV.y * height); int cureyeRed = eye_pixelpattern(WPOS, phaseR); int cureyeGreen = eye_pixelpattern(WPOS, phaseG); int cureyeBlue = eye_pixelpattern(WPOS, phaseB); float4 col = 0; float2 M = float2(0.5, 0.25); float colR = floor(fmod(cureyeRed , SAMPLE_COLS)); float rowR = floor(fmod(floor(cureyeRed / SAMPLE_COLS) , SAMPLE_ROWS)); float colG = floor(fmod(cureyeGreen , SAMPLE_COLS)); float rowG = floor(fmod(floor(cureyeGreen / SAMPLE_COLS) , SAMPLE_ROWS)); float colB = floor(fmod(cureyeBlue , SAMPLE_COLS)); float rowB = floor(fmod(floor(cureyeBlue / SAMPLE_COLS) , SAMPLE_ROWS)); col.r = tex2D(tex3Sampler, M * (UV + float2(colR, rowR))).r; col.g = tex2D(tex3Sampler, M * (UV + float2(colG, rowG))).g; col.b = tex2D(tex3Sampler, M * (UV + float2(colB, rowB))).b; return col; }