0001:
0002:
0003:
0004: struct vert2frag
0005: {
0006: float4 hpos : HPOS;
0007: float4 tcoords : TEX0;
0008: };
0009:
0010:
0011:
0012: fragout main(vert2frag I
0013: , uniform texobj2D SrcMap : texunit0
0014: )
0015: {
0016: fragout O;
0017:
0018: float3 col = {0,0,0};
0019:
0020: float2 shift00 = { ( 0.0f+0.5f)/256.0f, ( 0.0f+0.5f)/256.0f};
0021: float2 shift01 = { ( 1.0f+0.5f)/256.0f, ( 0.0f+0.5f)/256.0f};
0022: float2 shift02 = { ( 0.0f+0.5f)/256.0f, ( 1.0f+0.5f)/256.0f};
0023: float2 shift03 = { (-1.0f+0.5f)/256.0f, ( 0.0f+0.5f)/256.0f};
0024: float2 shift04 = { ( 0.0f+0.5f)/256.0f, (-1.0f+0.5f)/256.0f};
0025: float2 shift05 = { ( 1.0f+0.5f)/256.0f, ( 1.0f+0.5f)/256.0f};
0026: float2 shift06 = { (-1.0f+0.5f)/256.0f, ( 1.0f+0.5f)/256.0f};
0027: float2 shift07 = { ( 1.0f+0.5f)/256.0f, (-1.0f+0.5f)/256.0f};
0028: float2 shift08 = { (-1.0f+0.5f)/256.0f, (-1.0f+0.5f)/256.0f};
0029: float2 shift09 = { ( 0.0f+0.5f)/256.0f, ( 2.0f+0.5f)/256.0f};
0030: float2 shift10 = { ( 0.0f+0.5f)/256.0f, (-2.0f+0.5f)/256.0f};
0031: float2 shift11 = { ( 0.0f+0.5f)/256.0f, ( 3.0f+0.5f)/256.0f};
0032: float2 shift12 = { ( 0.0f+0.5f)/256.0f, (-3.0f+0.5f)/256.0f};
0033: float2 shift13 = { ( 1.0f+0.5f)/256.0f, ( 2.0f+0.5f)/256.0f};
0034: float2 shift14 = { ( 1.0f+0.5f)/256.0f, (-2.0f+0.5f)/256.0f};
0035: float2 shift15 = { (-1.0f+0.5f)/256.0f, ( 2.0f+0.5f)/256.0f};
0036: float2 shift16 = { (-1.0f+0.5f)/256.0f, (-2.0f+0.5f)/256.0f};
0037: float2 shift17 = { ( 2.0f+0.5f)/256.0f, (-2.0f+0.5f)/256.0f};
0038: float2 shift18 = { ( 2.0f+0.5f)/256.0f, (-1.0f+0.5f)/256.0f};
0039: float2 shift19 = { ( 2.0f+0.5f)/256.0f, ( 0.0f+0.5f)/256.0f};
0040: float2 shift20 = { ( 2.0f+0.5f)/256.0f, ( 1.0f+0.5f)/256.0f};
0041: float2 shift21 = { ( 2.0f+0.5f)/256.0f, ( 2.0f+0.5f)/256.0f};
0042: float2 shift22 = { (-2.0f+0.5f)/256.0f, (-2.0f+0.5f)/256.0f};
0043: float2 shift23 = { (-2.0f+0.5f)/256.0f, (-1.0f+0.5f)/256.0f};
0044: float2 shift24 = { (-2.0f+0.5f)/256.0f, ( 0.0f+0.5f)/256.0f};
0045: float2 shift25 = { (-2.0f+0.5f)/256.0f, ( 1.0f+0.5f)/256.0f};
0046: float2 shift26 = { (-2.0f+0.5f)/256.0f, ( 2.0f+0.5f)/256.0f};
0047: float2 shift27 = { ( 0.0f+0.5f)/256.0f, ( 4.0f+0.5f)/256.0f};
0048: float2 shift28 = { ( 0.0f+0.5f)/256.0f, (-4.0f+0.5f)/256.0f};
0049: float2 shift29 = { ( 1.0f+0.5f)/256.0f, ( 3.0f+0.5f)/256.0f};
0050: float2 shift30 = { ( 1.0f+0.5f)/256.0f, (-3.0f+0.5f)/256.0f};
0051: float2 shift31 = { (-1.0f+0.5f)/256.0f, ( 3.0f+0.5f)/256.0f};
0052: float2 shift32 = { (-1.0f+0.5f)/256.0f, (-3.0f+0.5f)/256.0f};
0053: float2 shift33 = { ( 3.0f+0.5f)/256.0f, (-2.0f+0.5f)/256.0f};
0054: float2 shift34 = { ( 3.0f+0.5f)/256.0f, (-1.0f+0.5f)/256.0f};
0055: float2 shift35 = { ( 3.0f+0.5f)/256.0f, ( 0.0f+0.5f)/256.0f};
0056: float2 shift36 = { ( 3.0f+0.5f)/256.0f, ( 1.0f+0.5f)/256.0f};
0057: float2 shift37 = { ( 3.0f+0.5f)/256.0f, ( 2.0f+0.5f)/256.0f};
0058: float2 shift38 = { (-3.0f+0.5f)/256.0f, (-2.0f+0.5f)/256.0f};
0059: float2 shift39 = { (-3.0f+0.5f)/256.0f, (-1.0f+0.5f)/256.0f};
0060: float2 shift40 = { (-3.0f+0.5f)/256.0f, ( 0.0f+0.5f)/256.0f};
0061: float2 shift41 = { (-3.0f+0.5f)/256.0f, ( 1.0f+0.5f)/256.0f};
0062: float2 shift42 = { (-3.0f+0.5f)/256.0f, ( 2.0f+0.5f)/256.0f};
0063: float2 shift43 = { ( 2.0f+0.5f)/256.0f, ( 3.0f+0.5f)/256.0f};
0064: float2 shift44 = { ( 1.0f+0.5f)/256.0f, ( 4.0f+0.5f)/256.0f};
0065: float2 shift45 = { ( 0.0f+0.5f)/256.0f, ( 5.0f+0.5f)/256.0f};
0066: float2 shift46 = { (-1.0f+0.5f)/256.0f, ( 4.0f+0.5f)/256.0f};
0067: float2 shift47 = { (-2.0f+0.5f)/256.0f, ( 3.0f+0.5f)/256.0f};
0068: float2 shift48 = { ( 2.0f+0.5f)/256.0f, (-3.0f+0.5f)/256.0f};
0069: float2 shift49 = { ( 1.0f+0.5f)/256.0f, (-4.0f+0.5f)/256.0f};
0070: float2 shift50 = { ( 0.0f+0.5f)/256.0f, (-5.0f+0.5f)/256.0f};
0071: float2 shift51 = { (-1.0f+0.5f)/256.0f, (-4.0f+0.5f)/256.0f};
0072: float2 shift52 = { (-2.0f+0.5f)/256.0f, (-3.0f+0.5f)/256.0f};
0073:
0074: float3 tex00 = f3tex2D( SrcMap, I.tcoords.xy+shift00 );
0075: col.x += exp(tex00.x);
0076: col.y += exp(tex00.y);
0077: col.z += exp(tex00.z);
0078:
0079: float3 tex01 = f3tex2D( SrcMap, I.tcoords.xy+shift01 );
0080: col.x += exp(tex01.x);
0081: col.y += exp(tex01.y);
0082: col.z += exp(tex01.z);
0083:
0084: float3 tex02 = f3tex2D( SrcMap, I.tcoords.xy+shift02 );
0085: col.x += exp(tex02.x);
0086: col.y += exp(tex02.y);
0087: col.z += exp(tex02.z);
0088:
0089: float3 tex03 = f3tex2D( SrcMap, I.tcoords.xy+shift03 );
0090: col.x += exp(tex03.x);
0091: col.y += exp(tex03.y);
0092: col.z += exp(tex03.z);
0093:
0094: float3 tex04 = f3tex2D( SrcMap, I.tcoords.xy+shift04 );
0095: col.x += exp(tex04.x);
0096: col.y += exp(tex04.y);
0097: col.z += exp(tex04.z);
0098:
0099: float3 tex05 = f3tex2D( SrcMap, I.tcoords.xy+shift05 );
0100: col.x += exp(tex05.x);
0101: col.y += exp(tex05.y);
0102: col.z += exp(tex05.z);
0103:
0104: float3 tex06 = f3tex2D( SrcMap, I.tcoords.xy+shift06 );
0105: col.x += exp(tex06.x);
0106: col.y += exp(tex06.y);
0107: col.z += exp(tex06.z);
0108:
0109: float3 tex07 = f3tex2D( SrcMap, I.tcoords.xy+shift07 );
0110: col.x += exp(tex07.x);
0111: col.y += exp(tex07.y);
0112: col.z += exp(tex07.z);
0113:
0114: float3 tex08 = f3tex2D( SrcMap, I.tcoords.xy+shift08 );
0115: col.x += exp(tex08.x);
0116: col.y += exp(tex08.y);
0117: col.z += exp(tex08.z);
0118:
0119: float3 tex09 = f3tex2D( SrcMap, I.tcoords.xy+shift09 );
0120: col.x += exp(tex09.x);
0121: col.y += exp(tex09.y);
0122: col.z += exp(tex09.z);
0123:
0124: float3 tex10 = f3tex2D( SrcMap, I.tcoords.xy+shift10 );
0125: col.x += exp(tex10.x);
0126: col.y += exp(tex10.y);
0127: col.z += exp(tex10.z);
0128:
0129: float3 tex11 = f3tex2D( SrcMap, I.tcoords.xy+shift11 );
0130: col.x += exp(tex11.x);
0131: col.y += exp(tex11.y);
0132: col.z += exp(tex11.z);
0133:
0134: float3 tex12 = f3tex2D( SrcMap, I.tcoords.xy+shift12 );
0135: col.x += exp(tex12.x);
0136: col.y += exp(tex12.y);
0137: col.z += exp(tex12.z);
0138:
0139: float3 tex13 = f3tex2D( SrcMap, I.tcoords.xy+shift13 );
0140: col.x += exp(tex13.x);
0141: col.y += exp(tex13.y);
0142: col.z += exp(tex13.z);
0143:
0144: float3 tex14 = f3tex2D( SrcMap, I.tcoords.xy+shift14 );
0145: col.x += exp(tex14.x);
0146: col.y += exp(tex14.y);
0147: col.z += exp(tex14.z);
0148:
0149: float3 tex15 = f3tex2D( SrcMap, I.tcoords.xy+shift15 );
0150: col.x += exp(tex15.x);
0151: col.y += exp(tex15.y);
0152: col.z += exp(tex15.z);
0153:
0154: float3 tex16 = f3tex2D( SrcMap, I.tcoords.xy+shift16 );
0155: col.x += exp(tex16.x);
0156: col.y += exp(tex16.y);
0157: col.z += exp(tex16.z);
0158:
0159: float3 tex17 = f3tex2D( SrcMap, I.tcoords.xy+shift17 );
0160: col.x += exp(tex17.x);
0161: col.y += exp(tex17.y);
0162: col.z += exp(tex17.z);
0163:
0164: float3 tex18 = f3tex2D( SrcMap, I.tcoords.xy+shift18 );
0165: col.x += exp(tex18.x);
0166: col.y += exp(tex18.y);
0167: col.z += exp(tex18.z);
0168:
0169: float3 tex19 = f3tex2D( SrcMap, I.tcoords.xy+shift19 );
0170: col.x += exp(tex19.x);
0171: col.y += exp(tex19.y);
0172: col.z += exp(tex19.z);
0173:
0174: float3 tex20 = f3tex2D( SrcMap, I.tcoords.xy+shift20 );
0175: col.x += exp(tex20.x);
0176: col.y += exp(tex20.y);
0177: col.z += exp(tex20.z);
0178:
0179: float3 tex21 = f3tex2D( SrcMap, I.tcoords.xy+shift21 );
0180: col.x += exp(tex21.x);
0181: col.y += exp(tex21.y);
0182: col.z += exp(tex21.z);
0183:
0184: float3 tex22 = f3tex2D( SrcMap, I.tcoords.xy+shift22 );
0185: col.x += exp(tex22.x);
0186: col.y += exp(tex22.y);
0187: col.z += exp(tex22.z);
0188:
0189: float3 tex23 = f3tex2D( SrcMap, I.tcoords.xy+shift23 );
0190: col.x += exp(tex23.x);
0191: col.y += exp(tex23.y);
0192: col.z += exp(tex23.z);
0193:
0194: float3 tex24 = f3tex2D( SrcMap, I.tcoords.xy+shift24 );
0195: col.x += exp(tex24.x);
0196: col.y += exp(tex24.y);
0197: col.z += exp(tex24.z);
0198:
0199: float3 tex25 = f3tex2D( SrcMap, I.tcoords.xy+shift25 );
0200: col.x += exp(tex25.x);
0201: col.y += exp(tex25.y);
0202: col.z += exp(tex25.z);
0203:
0204: float3 tex26 = f3tex2D( SrcMap, I.tcoords.xy+shift26 );
0205: col.x += exp(tex26.x);
0206: col.y += exp(tex26.y);
0207: col.z += exp(tex26.z);
0208:
0209: float3 tex27 = f3tex2D( SrcMap, I.tcoords.xy+shift27 );
0210: col.x += exp(tex27.x);
0211: col.y += exp(tex27.y);
0212: col.z += exp(tex27.z);
0213:
0214: float3 tex28 = f3tex2D( SrcMap, I.tcoords.xy+shift28 );
0215: col.x += exp(tex28.x);
0216: col.y += exp(tex28.y);
0217: col.z += exp(tex28.z);
0218:
0219: float3 tex29 = f3tex2D( SrcMap, I.tcoords.xy+shift29 );
0220: col.x += exp(tex29.x);
0221: col.y += exp(tex29.y);
0222: col.z += exp(tex29.z);
0223:
0224: float3 tex30 = f3tex2D( SrcMap, I.tcoords.xy+shift30 );
0225: col.x += exp(tex30.x);
0226: col.y += exp(tex30.y);
0227: col.z += exp(tex30.z);
0228:
0229: float3 tex31 = f3tex2D( SrcMap, I.tcoords.xy+shift31 );
0230: col.x += exp(tex31.x);
0231: col.y += exp(tex31.y);
0232: col.z += exp(tex31.z);
0233:
0234: float3 tex32 = f3tex2D( SrcMap, I.tcoords.xy+shift32 );
0235: col.x += exp(tex32.x);
0236: col.y += exp(tex32.y);
0237: col.z += exp(tex32.z);
0238:
0239: float3 tex33 = f3tex2D( SrcMap, I.tcoords.xy+shift33 );
0240: col.x += exp(tex33.x);
0241: col.y += exp(tex33.y);
0242: col.z += exp(tex33.z);
0243:
0244: float3 tex34 = f3tex2D( SrcMap, I.tcoords.xy+shift34 );
0245: col.x += exp(tex34.x);
0246: col.y += exp(tex34.y);
0247: col.z += exp(tex34.z);
0248:
0249: float3 tex35 = f3tex2D( SrcMap, I.tcoords.xy+shift35 );
0250: col.x += exp(tex35.x);
0251: col.y += exp(tex35.y);
0252: col.z += exp(tex35.z);
0253:
0254: float3 tex36 = f3tex2D( SrcMap, I.tcoords.xy+shift36 );
0255: col.x += exp(tex36.x);
0256: col.y += exp(tex36.y);
0257: col.z += exp(tex36.z);
0258:
0259: float3 tex37 = f3tex2D( SrcMap, I.tcoords.xy+shift37 );
0260: col.x += exp(tex37.x);
0261: col.y += exp(tex37.y);
0262: col.z += exp(tex37.z);
0263:
0264: float3 tex38 = f3tex2D( SrcMap, I.tcoords.xy+shift38 );
0265: col.x += exp(tex38.x);
0266: col.y += exp(tex38.y);
0267: col.z += exp(tex38.z);
0268:
0269: float3 tex39 = f3tex2D( SrcMap, I.tcoords.xy+shift39 );
0270: col.x += exp(tex39.x);
0271: col.y += exp(tex39.y);
0272: col.z += exp(tex39.z);
0273:
0274: float3 tex40 = f3tex2D( SrcMap, I.tcoords.xy+shift40 );
0275: col.x += exp(tex40.x);
0276: col.y += exp(tex40.y);
0277: col.z += exp(tex40.z);
0278:
0279: float3 tex41 = f3tex2D( SrcMap, I.tcoords.xy+shift41 );
0280: col.x += exp(tex41.x);
0281: col.y += exp(tex41.y);
0282: col.z += exp(tex41.z);
0283:
0284: float3 tex42 = f3tex2D( SrcMap, I.tcoords.xy+shift42 );
0285: col.x += exp(tex42.x);
0286: col.y += exp(tex42.y);
0287: col.z += exp(tex42.z);
0288:
0289: float3 tex43 = f3tex2D( SrcMap, I.tcoords.xy+shift43 );
0290: col.x += exp(tex43.x);
0291: col.y += exp(tex43.y);
0292: col.z += exp(tex43.z);
0293:
0294: float3 tex44 = f3tex2D( SrcMap, I.tcoords.xy+shift44 );
0295: col.x += exp(tex44.x);
0296: col.y += exp(tex44.y);
0297: col.z += exp(tex44.z);
0298:
0299: float3 tex45 = f3tex2D( SrcMap, I.tcoords.xy+shift45 );
0300: col.x += exp(tex45.x);
0301: col.y += exp(tex45.y);
0302: col.z += exp(tex45.z);
0303:
0304: float3 tex46 = f3tex2D( SrcMap, I.tcoords.xy+shift46 );
0305: col.x += exp(tex46.x);
0306: col.y += exp(tex46.y);
0307: col.z += exp(tex46.z);
0308:
0309: float3 tex47 = f3tex2D( SrcMap, I.tcoords.xy+shift47 );
0310: col.x += exp(tex47.x);
0311: col.y += exp(tex47.y);
0312: col.z += exp(tex47.z);
0313:
0314: float3 tex48 = f3tex2D( SrcMap, I.tcoords.xy+shift48 );
0315: col.x += exp(tex48.x);
0316: col.y += exp(tex48.y);
0317: col.z += exp(tex48.z);
0318:
0319: float3 tex49 = f3tex2D( SrcMap, I.tcoords.xy+shift49 );
0320: col.x += exp(tex49.x);
0321: col.y += exp(tex49.y);
0322: col.z += exp(tex49.z);
0323:
0324: float3 tex50 = f3tex2D( SrcMap, I.tcoords.xy+shift50 );
0325: col.x += exp(tex50.x);
0326: col.y += exp(tex50.y);
0327: col.z += exp(tex50.z);
0328:
0329: float3 tex51 = f3tex2D( SrcMap, I.tcoords.xy+shift51 );
0330: col.x += exp(tex51.x);
0331: col.y += exp(tex51.y);
0332: col.z += exp(tex51.z);
0333:
0334: float3 tex52 = f3tex2D( SrcMap, I.tcoords.xy+shift52 );
0335: col.x += exp(tex52.x);
0336: col.y += exp(tex52.y);
0337: col.z += exp(tex52.z);
0338:
0339: O.col.x = log(col.x/53.0f);
0340: O.col.y = log(col.y/53.0f);
0341: O.col.z = log(col.z/53.0f);
0342:
0343: return O;
0344: }
0345: