StitchUp: generating shaders from HLSL fragments

StitchUp: generating shaders from HLSL fragments

  • Comments 1

Back in 2004 I wrote an article for a book called ShaderX3 about how to tackle the shader permutation problem by automatically generating shaders from combinations of smaller code fragments.

Now Tim has created an XNA 4.0 implementation of this same idea.  Sweet!  (not to mention very flattering for me personally :-)

  • I have created a way to handle shader perm. problem too.

    It's kind of the same. There are NO custom variables in common shaders. Variables are constant per shader or are common variables that get set by the renderer: SetPerMaterialParam(), SetPerObjectParam(), etc. The renderer sorts geometry based on a few things and then just starts rendering. The effect variables are all common so the engine can set them for every shader, based on some booleans that come from the material.

    Material is just an effect with some booleans/enums to specify how to render the object: DoAlpha, DoLighting, etc.

    It works like a charm, but due to the fact that you cannot insert data from the engine that is very specific, it's a bit limiting.

Page 1 of 1 (1 items)
Leave a Comment
  • Please add 2 and 5 and type the answer here:
  • Post