Managing Shaders is a hard and complicated task in any Modern Engine, in this post we are going to give a brief description on our material/shader pipeline which handles the both artist side (content creation) and programmer side (runtime graphics) of the development process.

There are several major problems in a game development pipeline when it comes to content creation and its usage in game:

  • In many engines, artists doesn’t have clear view of what object will like in the final Render of the Engine, due to different material/shading systems of Content creation tools like 3dsmax, maya, etc. and the Engine itself. So in many occasions they are forced to do models in their content creation tool, export it to the Engine/Editor, Setup materials and then preview it and see if there are any problems for Textures/Materials like Normal maps, Specular maps, etc. which makes iterative modeling very time consuming and complicated for development process.
  • Many Not-so-Famous engines and most indie Engines does not have a proper Material and Shader tools in order to streamline content creation process. They support limited subset of material properties, which concludes to broken materials and cumbersome work from artists, they also does not propose a unified material system like commercial engines. For Example they only export diffuse maps and leave the rest (Normal, Specular, Ambient Occlusion maps,…)  to be set and tested by artists later.

The ideal solution would be a unified material pipeline, in which the artists could see the final look of their work inside the modeling tool itself, they also need to be able to export their models easily to the engine without any extra processing phase. Our in-house engine uses Deferred Rendering pipeline, so our shaders inside the engine are a little different than casual forward shaders.

What we did was building a ShaderAuthor tool which creates our desired set of shaders from two Uber-Shaders, A special forward lighting model for 3dsmax viewport DirectX (.fx) materials, and another one for our Deferred lighting renderer. both of them have the exact same output. We keep these generated shaders in a Shader Repository that can be accessed by the engine and 3dsmax, Artists design their models and preview them using the shaders from repository in a WYSIWYG fashion. After modifications made, models will be exported to the engine using COLLADA format or our own Proprietary model format, but at runtime, the engine loads their corresponding deferred shaders from the repository which have the exact output.

Of course it took couple of months for us to figure out the process and overcome some of the problems listed below :

  • 3dsmax support for DirectX shaders is quite tricky and undocumented.
  • Many bugs where found in 3dsmax viewport regarding DirectX materials, even with their own default .fx materials.
  • Common exporters like FCollada have limited support for .fx materials, and even discontinued support for recent versions of 3dsmax.

Here is a diagram of our Shader Pipeline in Content creation process :

As a result, we could manage to make an efficient enough pipeline that gives much more freedom and speed for the artists in order to iteratively test and export their models in to the game. As you can see in the image below two model shots are taken from the Modeling app (which is 3dsmax), and the same model exported into our engine :

6 comments so far

Add Your Comment
  1. Hi
    at first congratulation for new site :)

    The idea about writing/editing shaders in 3dsmax/maya is perfect and good solution at first look. but some questions rush the mine after a while:
    - has the 3dsmax/maya a cool/easy shader editor?
    - dose the shader export pipeline supports sub materials/shaders for a single object ( for example burned/old style/wet/… ) ?

    • Hi
      - As for the first question, I think u got it wrong about what we do, we are not using any Shader editor within 3dsmax or any other tool (although If you want a nice ShaderEditor for max, ShaderFX is always there), As u can also see in the diagram, we are using uber shaders and a ShaderAuthor tool to automatically generate special shaders that we need , one for max, and one for engine.
      - For the second one, yes we support sub-materials for a single object

      • ok. I got it.
        thank you

    • Hi,I’m currently away from my dvleeopment PC for a few days, but I’m sure the FX Composer Help/Documentation has a section about annotations that you can use to expose parameters to the UI. I usually did this by examples. I looked through the shader library, and saw the annotations they used to expose certain parameters to the UI.I can’t say my experience is very vast, because as I mentioned in this post, I only recently began actually using FX Composer. Up until now, I did it all in Visual Studio, just like writing text.

  2. [...] Faith &#959f Steel – Th&#1077 Game » Shader Pipeline – P&#1072rt #1 [...]

  3. hi!!!