<ShadX> unregistried
| Created on 23.11.2004 - 13:45 |  |
.slv
uniform vec4 OGL2Param; uniform vec4 OGL2Size; varying vec2 TCoord;
void main() { gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;
TCoord = gl_MultiTexCoord0.xy; }
.slf
uniform vec4 OGL2Param; uniform vec4 OGL2Size; uniform sampler2D OGL2Texture; varying vec2 TCoord;
void main() { float offsetx = 1.0/OGL2Size.x; float offsety = 1.0/OGL2Size.y; float param = OGL2Param.z; float tmp; vec3 togray; togray.x = 0.10000000; togray.y = 0.19666667; togray.z = 0.03666667;
vec4 c = texture2D(OGL2Texture, TCoord); //center vec4 bl = texture2D(OGL2Texture, TCoord + vec2(-offsetx,-offsety)); //bottom-left vec4 l = texture2D(OGL2Texture, TCoord + vec2(-offsetx, 0.0)); //left vec4 tl = texture2D(OGL2Texture, TCoord + vec2(-offsetx, offsety)); //top-left vec4 t = texture2D(OGL2Texture, TCoord + vec2( 0.0, offsety)); //top vec4 tr = texture2D(OGL2Texture, TCoord + vec2( offsetx, offsety)); //top-right vec4 r = texture2D(OGL2Texture, TCoord + vec2( offsetx, 0.0)); //right vec4 br = texture2D(OGL2Texture, TCoord + vec2( offsetx, offsety)); //bottom-right vec4 b = texture2D(OGL2Texture, TCoord + vec2( 0.0,-offsety)); //bottom
vec4 border = (bl - c) + (l - c) + (tl - c) + (t - c) + (tr - c) + (r - c) + (br - c) + (b - c); tmp = (border.x * togray.x + border.y * togray.y + border.z * togray.z); if ( tmp >= (0.4 - 0.1 * param))
gl_FragColor = (c + bl + l + tl + t + tr + r + br + b)/9.0; }
|
<ShadX> unregistried
| Created on 25.11.2004 - 15:50 |  |
correction...
.slf
uniform vec4 OGL2Param; uniform vec4 OGL2Size; uniform sampler2D OGL2Texture; varying vec2 TCoord;
void main() { float offsetx = 1.0/OGL2Size.x; float offsety = 1.0/OGL2Size.y; float param = OGL2Param.z; float tmp; vec3 togray;
togray.x = 0.30; togray.y = 0.59; togray.z = 0.11;
vec4 c = texture2D(OGL2Texture, TCoord); //center vec4 bl = texture2D(OGL2Texture, TCoord + vec2(-offsetx,-offsety)); //bottom-left vec4 l = texture2D(OGL2Texture, TCoord + vec2(-offsetx, 0.0)); //left vec4 tl = texture2D(OGL2Texture, TCoord + vec2(-offsetx, offsety)); //top-left vec4 t = texture2D(OGL2Texture, TCoord + vec2( 0.0, offsety)); //top vec4 tr = texture2D(OGL2Texture, TCoord + vec2( offsetx, offsety)); //top-right vec4 r = texture2D(OGL2Texture, TCoord + vec2( offsetx, 0.0)); //right vec4 br = texture2D(OGL2Texture, TCoord + vec2( offsetx, offsety)); //bottom-right vec4 b = texture2D(OGL2Texture, TCoord + vec2( 0.0,-offsety)); //bottom
vec4 border = (bl - c) + (l - c) + (tl - c) + (t - c) + (tr - c) + (r - c) + (br - c) + (b - c);
tmp = (border.x * togray.x + border.y * togray.y + border.z * togray.z);
if ( tmp >= (0.4 - 0.1 * param)) // or (tmp >= 0.3 - 0.1 * param)
gl_FragColor = (c + bl + l + tl + t + tr + r + br + b)/9.0; }
|
guest  Real addict
  

Status:Offline Date registered: 30.07.2004 Post:856 Send Message | Created on 30.07.2005 - 11:15 |  |
There are manny nice shaders on this board which are not yet fully optimised.
I, on my behalf, am thinking about making a revision and add better texel maping and so.
With swizzling or diagonal-coord-sharing speedups up to 30% can be achieved.
PS: Perhaps Pete could help you out to delete the "obsolete" shaders of the ShadX(nr). 
|