| Author | Topics » Book an abo for this thread |  |
<Luigi> unregistried
| Created on 21.09.2004 - 13:13 |  |
I have written a shader that emulate (?) a "2 sample 5 tap quincunx multi-sampling" If someone who try it:
antialias.vp (rename as gpuPeteOGL2.vp)
!!ARBvp1.0
OPTION ARB_position_invariant;
# program.env[1].x/y will give the plugin's "effect level" offset (I suggest to only use 1-Minimum)
PARAM filterOffset = program.env[1];
ATTRIB sample = vertex.texcoord[ 0 ];
MOV result.texcoord[ 0 ].x, sample.x; MOV result.texcoord[ 0 ].y, sample.y; ADD result.texcoord[ 1 ].x, sample.x, filterOffset.x; MOV result.texcoord[ 1 ].y, sample.y; MOV result.texcoord[ 2 ].x, sample.x; ADD result.texcoord[ 2 ].y, sample.y, -filterOffset.y; ADD result.texcoord[ 3 ].x, sample.x, filterOffset.x; ADD result.texcoord[ 3 ].y, sample.y, -filterOffset.y;
END
antialias.fp (rename as gpuPeteOGL2.fp)
!!ARBfp1.0
TEMP color0, color1, color2, color3;
PARAM divEight = { 0.125, 0.125, 0.125, 0.0 }; PARAM mulFive = { 5.0, 5.0 , 5.0 , 0.0 };
TEX color0, fragment.texcoord[ 0 ], texture[ 0 ], 2D; TEX color1, fragment.texcoord[ 1 ], texture[ 0 ], 2D; TEX color2, fragment.texcoord[ 2 ], texture[ 0 ], 2D; TEX color3, fragment.texcoord[ 3 ], texture[ 0 ], 2D;
MUL color0, color0, mulFive;
ADD color0, color0, color1; ADD color0, color0, color2; ADD color0, color0, color3;
MUL result.color, color0, divEight;
END
or,if you prefer (should be faster):
!!ARBfp1.0
TEMP color0, color1, color2, color3, color4;
PARAM divEight = { 0.125, 0.125, 0.125, 0.0 };
TEX color0, fragment.texcoord[ 0 ], texture[ 0 ], 2D; TEX color1, fragment.texcoord[ 1 ], texture[ 0 ], 2D; TEX color2, fragment.texcoord[ 2 ], texture[ 0 ], 2D; TEX color3, fragment.texcoord[ 3 ], texture[ 0 ], 2D;
ADD color4, color0, color0; ADD color4, color4, color4; ADD color4, color4, color0; ADD color4, color4, color1; ADD color4, color4, color2; ADD color4, color4, color3;
MUL result.color, color4, divEight;
END
Ciao.
|
|
|
<Luigi> unregistried
| Created on 21.09.2004 - 16:06 |  |
New variation: "4 sample 9 tap box multi-sampling"! (it can smoke your graphic card)
antialias.vp is the same
antialias.fp (rename as gpuPeteOGL2.fp)
!!ARBfp1.0
TEMP color0, color1, color2, color3;
PARAM divSixteen = { 0.0625, 0.0625, 0.0625, 0.0 }; PARAM mulNine = { 9.0, 9.0 , 9.0 , 0.0 }; PARAM mulThree = { 3.0, 3.0 , 3.0 , 0.0 };
TEX color0, fragment.texcoord[ 0 ], texture[ 0 ], 2D; TEX color1, fragment.texcoord[ 1 ], texture[ 0 ], 2D; TEX color2, fragment.texcoord[ 2 ], texture[ 0 ], 2D; TEX color3, fragment.texcoord[ 3 ], texture[ 0 ], 2D;
MUL color0, color0, mulNine; MUL color1, color1, mulThree; MUL color2, color2, mulThree;
ADD color0, color0, color1; ADD color0, color0, color2; ADD color0, color0, color3;
MUL result.color, color0, divSixteen;
END
or,if you prefer (should be faster):
!!ARBfp1.0
TEMP color0, color1, color2, color3; TEMP color4, color5; PARAM divSixteen = { 0.0625, 0.0625, 0.0625, 0.0 };
TEX color0, fragment.texcoord[ 0 ], texture[ 0 ], 2D; TEX color1, fragment.texcoord[ 1 ], texture[ 0 ], 2D; TEX color2, fragment.texcoord[ 2 ], texture[ 0 ], 2D; TEX color3, fragment.texcoord[ 3 ], texture[ 0 ], 2D;
ADD color4, color0, color0; ADD color4, color4, color4; ADD color4, color4, color4; ADD color4, color4, color0; ADD color5, color2, color3; ADD color5, color5, color5; ADD color5, color2, color3; ADD color4, color4, color5; ADD color4, color4, color3;
MUL result.color, color4, divSixteen;
END
|
<Luigi> unregistried
| Created on 21.09.2004 - 18:23 |  |
And, at last, my implementation:
antialias.vp (rename as gpuPeteOGL2.vp)
!!ARBvp1.0
OPTION ARB_position_invariant;
# program.env[1].x/y will give the plugin's "effect level" offset (I suggest to only use 1-Minimum)
PARAM filterOffset = program.env[1];
ATTRIB sample = vertex.texcoord[ 0 ];
MOV result.texcoord[ 0 ].x, sample.x; MOV result.texcoord[ 0 ].y, sample.y; ADD result.texcoord[ 1 ].x, sample.x, -filterOffset.x; ADD result.texcoord[ 1 ].y, sample.y, -filterOffset.y; ADD result.texcoord[ 2 ].x, sample.x, filterOffset.x; ADD result.texcoord[ 2 ].y, sample.y, -filterOffset.y; ADD result.texcoord[ 3 ].x, sample.x, -filterOffset.x; ADD result.texcoord[ 3 ].y, sample.y, filterOffset.y; ADD result.texcoord[ 4 ].x, sample.x, filterOffset.x; ADD result.texcoord[ 4 ].y, sample.y, filterOffset.y;
END
antialias.fp (rename as gpuPeteOGL2.fp)
!!ARBfp1.0
TEMP color0, color1, color2, color3, color4, colorT;
PARAM divEight = { 0.125, 0.125, 0.125, 0.0 };
TEX color0, fragment.texcoord[ 0 ], texture[ 0 ], 2D; TEX color1, fragment.texcoord[ 1 ], texture[ 0 ], 2D; TEX color2, fragment.texcoord[ 2 ], texture[ 0 ], 2D; TEX color3, fragment.texcoord[ 3 ], texture[ 0 ], 2D; TEX color4, fragment.texcoord[ 4 ], texture[ 0 ], 2D;
ADD color0, color0, color0; ADD color0, color0, color0; ADD color2, color1, color2; ADD color3, color3, color4; ADD colorT, color2, color3; ADD colorT, colorT, color0;
MUL result.color, colorT, divEight;
END
Ciao.
|
<Luigi> unregistried
| Created on 21.09.2004 - 18:24 |  |
And, at last, my implementation:
antialias.vp (rename as gpuPeteOGL2.vp)
!!ARBvp1.0
OPTION ARB_position_invariant;
# program.env[1].x/y will give the plugin's "effect level" offset (I suggest to only use 1-Minimum)
PARAM filterOffset = program.env[1];
ATTRIB sample = vertex.texcoord[ 0 ];
MOV result.texcoord[ 0 ].x, sample.x; MOV result.texcoord[ 0 ].y, sample.y; ADD result.texcoord[ 1 ].x, sample.x, -filterOffset.x; ADD result.texcoord[ 1 ].y, sample.y, -filterOffset.y; ADD result.texcoord[ 2 ].x, sample.x, filterOffset.x; ADD result.texcoord[ 2 ].y, sample.y, -filterOffset.y; ADD result.texcoord[ 3 ].x, sample.x, -filterOffset.x; ADD result.texcoord[ 3 ].y, sample.y, filterOffset.y; ADD result.texcoord[ 4 ].x, sample.x, filterOffset.x; ADD result.texcoord[ 4 ].y, sample.y, filterOffset.y;
END
antialias.fp (rename as gpuPeteOGL2.fp)
!!ARBfp1.0
TEMP color0, color1, color2, color3, color4, colorT;
PARAM divEight = { 0.125, 0.125, 0.125, 0.0 };
TEX color0, fragment.texcoord[ 0 ], texture[ 0 ], 2D; TEX color1, fragment.texcoord[ 1 ], texture[ 0 ], 2D; TEX color2, fragment.texcoord[ 2 ], texture[ 0 ], 2D; TEX color3, fragment.texcoord[ 3 ], texture[ 0 ], 2D; TEX color4, fragment.texcoord[ 4 ], texture[ 0 ], 2D;
ADD color0, color0, color0; ADD color0, color0, color0; ADD color2, color1, color2; ADD color3, color3, color4; ADD colorT, color2, color3; ADD colorT, colorT, color0;
MUL result.color, colorT, divEight;
END
Ciao.
|
PeteBernert Admin
    

Status:Offline Date registered: 04.10.2003 Post:818 Send Message | Created on 26.09.2004 - 16:09 |  |
that's a small variation of my internal "Fullscreen smoothing" shader effect and the public available "simble blur" shader (available on my homepage).
Well, maybe somebody else likes your shader, so if you want I can put it on my homepage in the "OGL2 shaders" section, no problem 
|
<Luigi> unregistried
| Created on 27.09.2004 - 11:39 |  |
Pete, if you think they are good enough, put them without problems. Ciao.
|
<Luigi> unregistried
| Created on 01.10.2004 - 19:04 |  |
Pete, I have modified my implementation of "blur" effect introducing a cut-off. The vp code is the same. Here the fp code:
!!ARBfp1.0
TEMP color0, color1, color2, color3, color4; TEMP temp;
PARAM cutoff = {0.2, 0.2, 0.2, 0.0 }; PARAM divEight = { 0.125, 0.125, 0.125, 0.0 };
TEX color0, fragment.texcoord[ 1 ], texture[ 0 ], 2D; TEX color1, fragment.texcoord[ 1 ], texture[ 0 ], 2D; TEX color2, fragment.texcoord[ 2 ], texture[ 0 ], 2D; TEX color3, fragment.texcoord[ 3 ], texture[ 0 ], 2D; TEX color4, fragment.texcoord[ 4 ], texture[ 0 ], 2D;
# remove the values higher than color0 + cut-off
MUL temp, color0, cutoff; ADD temp, color0, temp; MIN color1, color1, temp; MIN color2, color2, temp; MIN color3, color3, temp; MIN color4, color4, temp;
# blend colors
ADD color0, color0, color0; ADD color0, color0, color0; ADD color1, color1, color2; ADD Color3, Color3, color4; ADD Color1, Color1, Color3; ADD Color0, Color0, Color1;
# calculate result
MUL result.color, color0, divEight
END
Ciao.
|
<Luigi> unregistried
| Created on 18.10.2004 - 17:09 |  |
Pete, no news? In Italy no news, good news...
|
PeteBernert Admin
    

Status:Offline Date registered: 04.10.2003 Post:818 Send Message | Created on 21.10.2004 - 18:48 |  |
don't panic, I will upload your shaders soon 
...
OK, I've uploaded your shader to my domain, in the GPU section.
[Dieser Beitrag wurde am 23.10.2004 - 11:31 von PeteBernert aktualisiert]
|
<Luigi> unregistried
| Created on 26.10.2004 - 18:49 |  |
Pete, thanks a lot for your interest Ciao. P:S: i'm working on 5x5 convolution matrix filter that use all eight texture coordinate vertex attributes and 4D vectors (x,y,z,w coordinate) for store the voxels...
|