Material FX

Return to Introduction  Previous page  Next page

How It Works

 

You can optionally use your own material FX shader (such as those created by nVidia's FX Composer) in DX Studio.

 

By using your own shader, you can have full control over the rendering of this material, but will also have to control any lighting of the surface yourself.

 

The engine will pass in to your shader data based on sematics.  e.g.

 

float4x4 worldViewProj : WORLDVIEWPROJECTION

 

...will give you a matrix in your shader called worldViewProj tied to the render-time world view projection matrix.

 

Semantics handled are:-

 

WORLD - world matrix

VIEW - view matrix

PROJECTION - projection matrix

WORLDVIEW - world * view matrix

WORLDVIEWPROJECTION - world * view * projection matrix

WORLDINVERSE - world matrix inversed

WORLDINVERSETRANSPOSE - world matrix inverted and transposed

VIEWINVERSE - view matrix inversed

TIME - system.timer value

ENVIRONMENT - the current combined cubic environment map 3d texture

AMBIENT - the ambient light color

 

The nearest two light positions/colors are also passed in as:-

 

lightPos1, lightColor1, lightPos2, lightColor2

 

 

Reference

 

Just add your .fx file to the resources of the document (and also any .fxh header files it may reference).  You can't use directories in header include names, so be sure to remove those from the include lines if used.

 

Select the .fx file in the Effects section of the Material Properties dialog, and this will override all of the other settings.

 

Introduction



Copyright ©2004 Worldweaver Ltd. DX Studio Home