Game Development Stack Exchange is a question and answer site for professional and independent game developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

What relationship is there, if any, of "materials" and vertex/pixel shaders (or the "effects" that combine the latter two)?

I have the impression that before the advent of HLSL, materials were explicitly handled by Direct3D or OpenGL. I also have the impression that with HLSL, many prior effects are now handled directly (and generically) via the rendering pipeline in vertex/pixel shaders. In other words, I hae the impression that materials are often little more than what DirectX would call an "Effect." If so, this means that many models that specify materials would be transformed by a content pipeline into an "Effect".

Is this correct? Where can I get a little more history/info that either corroborates or corrects the impression I have?

share|improve this question
up vote 2 down vote accepted

Materials in the Direct3D 9 sense were simply parameters for the fixed function pipeline, which implements a Gouraud shading model (IIRC). The values of a D3DMATERIAL9 struct can be thought of as nothing more than shader constants. The definition of a "material" is entirely dependent upon context.

It's the distinction between fixed function and programmable that is most important here. When you're using shaders, you define the shading model yourself. Therefore, even though many of the surface properties that are described by a D3DMATERIAL9 (e.g. diffuse color) would likely apply to your shading model of choice, it's up to you to do something with those values.

The fixed function pipeline was essentially one monolithic "effect" (or pair of vertex/pixel shaders) that you couldn't change. You could only pass it different parameters to control the behavior, whether these parameters were render states or D3DMATERIAL9 structs.

You might find this instructive: FixedFuncShader

It's a partial reimplementation of the fixed function pipeline using D3DX effects. It'll help you understand the parallels between the two concepts.

share|improve this answer
Are the days of D3DMATERIAL9 virtually gone? That is, does "everyone" use the programmable pipeline for "materials" in modern games? And since the def of "material" is varied, can you give the top most-common meanings / contexts? – Mystagogue Sep 3 '10 at 23:53
Often, engines will define "physical materials" for surfaces that determine things like friction coefficients, as well as collision/footstep sounds, impact particles, bullet decals, etc. Or UT3, where "material" represents a huge bundle of configuration properties, as well as a node graph-based visual shader editor that compiles down to HLSL behind the scenes. See here: – Neverender Sep 6 '10 at 8:15
@Mystagogue There still exist hardware platforms limited to fixed function pipelines, in particular mobile phones. For example Windows Phone 7 does not support custom shaders- you would need to apply your own parameters to a BasicEffect class that handles the shader work (which is actually not so basic when you dig deep into it). – ChrisC Sep 21 '11 at 19:23

The meaning of this words are not set in stone. I use the following distinction :

  • a shader is the low level code that implements a material
  • a material is an instance of a material type with all slots set. it uses a shader.
  • a material type is a kind of material. it defines a format (like 3 textures, the first being used for diffuse, the second for normal and the third for specular.) but not the value of the slots (at this level we know the format but not what are the DNS textures). not the slots can be of any type (int, float, mat4, symbol).


share|improve this answer
If a shader implements a material, then how were materials implemented before shaders came along (roughly before the year 2002)? – Mystagogue Sep 3 '10 at 19:08
>"then how were materials implemented before shaders came along?" ...with register combiners, blending, texture modulation modes and fixed functions. See glMaterial/glFog/glLight for OpenGL equivalents, and DirectX APIs before DX9. – jpaver Sep 3 '10 at 20:48
Basically because the shader implementations were set in stone, hence the name fixed pipeline. If we go in the details, we had a few high level operations (as jpaver said) and that was it. – Lionel Barret Sep 7 '10 at 11:39

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.