What is a hardware shader?

Basically it is a text file. It will be loaded by the application, slightly modyfied and passed to the OpenGL driver. The OpenGL driver compiles the file and stores it into the OpenGL fragment processors.

What do i need to write or modify a hardware shader?

You need a simple text editor. You can send shaders via email or copy and paste them on a website. There is no binary component in these shaders. The shaders are platformindependent because OpenGL is platformindependent.

Example?

If you open negative.mxf in the applications effect directory with a text editor, you will see a negative effect in six lines:

uniform sampler2D texUnit; 
void main(void)
{
vec2 texCoord = gl_TexCoord[0].xy;
vec4 color = texture2D(texUnit, texCoord);
color.r = 1.0-color.r;
color.g = 1.0-color.g;
color.b = 1.0-color.b;
gl_FragColor = color;
}

This is a fully qualified fragment shader running at full speed in your hardware. You can copy this code fragment, paste it into a new text file called "mynewshader.mxf" start MXwendler, and use it. But those shaders can do a lot more, see a complete reference to writing fragment shaders here (PDF, 400k)

Are hardware shaders faster than software effects?

Yes. A recent graphics board has about 32 pixel pipelines. This means, it is as fast as a 32-CPU cluster.

Do shaders reach the same quality as software renderers?

In most cases, hardware shaders reach much higher quality levels. First of all, the effect is calculated per screeen pixel, not per footage pixel. You will see one-pixel-wide fine grain effects on your screen even when using lower resolution footage. Second, the internal color calculation is based on float precisision, which is much more precise (32 bits per channel) than a software system using full 32-bit RGBA (32 bits for four channels).

Can i write shaders, too?

Of course you can. See the examples and the tutorials. These shaders use the official OpenGL Shader language. Go to OpenGL.org for a full documentation. Also, you will find a little utiliy called glslvalidate.exe in your effects-folder. With this utility you can check the syntactical correctness of your shaders. Please check your shaders in combination with the other effects you use. Be aware that fragment shaders are derived from a fullscale massive parallel computing concept. Thus, every pixel color value has to be calculated completely independent.

Can i use Freeframe effects in MXwendler?

No. Freeframe effects are platform dependent software effects.

Is DirectX faster than OpenGL?

No.

Bauhaus-Universität Weimar     Gründerwerkstatt - Technische Hochschule Berlin
  AboutConceptsProductsDownloadFAQ / Help / ForumCase studiesBlogJobs
About   Concepts   Products   Download   FAQ / Help / Forum   Case studies   Blog   Jobs