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

In a game a material does only influence the visual appearance of the object. The visual appearance is effected by shaders. So regarding to terminology is there a difference between materials and shaders? Should you write one shader for one material?

share|improve this question
I've seen a few engines where a material is a shader + diffuse texture + bumpmap, but I don't think there is one concise definition. – Roy T. Dec 19 '12 at 13:02
@RoyT. Those engines would be misusing terminology. A material isn't equivalent to a shader -- a shader is a program, a material is a bunch of data values. 2 different shader programs can render the same material and get different results. – bobobobo Dec 19 '12 at 17:33
@bobobobo Or more commonly, a single shader would be used to render many materials, by plugging in different textures, parameter values and such. – Nathan Reed Dec 19 '12 at 23:38
up vote 26 down vote accepted

A material is a combination of attributes which describe how a surface of the given material should look like.

Some engines use different shaders for different materials, in which case a material definition could look like this:


Other engines use one shader for all objects (or rather the engines decides what shader to use dependent on the parameters, the capabilities of the GPU and other factors such as distance), in which case a material would look more like this:

share|improve this answer
couldn't one extend the definition of a material to every senses supported by the game engine? For instance, the sounds that the material will produce when hit, stepped upon, etc. , or its friction parameters? – didierc Jun 25 '13 at 0:46

A material specifies how an object responds to light.

There are a couple of common parameters:

  • Kd: Diffuse response to light
  • Ks: Specular response to light
  • Ns: "Shininess"
  • map_Kd: Texture

Now say you have a triangle rendered with material M. M has Kd=(1,0,0) (red diffuse response), Ks=(1,1,1) (white specular response), Ns=25 (specular highlight will be quite sharp and not fuzzed out) and no map_Kd (no texture).

The job of the shader is to use math to take the vertex positions of triangle, the position of the light, the material color values, and figure out what color the triangle should appear. A vertex shader does this "shading computation" once at each vertex and interpolates the color across the triangle.

A common operation in a shader to compute the diffuse response at a vertex is:

// hlsl
float3 vertexToLight = normalize( - ) ;

float3 diffuseColor = max( dot( vertexToLight, vertexNormal ), 0.0 ) * kd * lightColor ;
share|improve this answer

A material is what you apply to geometry to give it a colour and pattern. A texture is a component of a material.

A shader is a small program that allows this material to be rendered at runtime. The nice thing about shaders is that you can do everything from simply rendering the material, to adding dynamic effects like specular highlights and reflections all the way up to extremely clever things such as rendering fake holes through walls where a bullet has hit.

so in answer to your question - yes there is a difference, there is a little overlap too - you could either make a red material or write a shader to render things as red, but both of them also allow you to a lot of things you could not with the other.

and no, you don't need one shader per material. although a material requires a shader to be rendered, you could have one for all you materials if you wanted. they do specific things so if you wanted everything to be shiny for example, you could just write one.

A nice example of shaders is in gears of war. there is one set of materials for the scene, but when you press a button to switch to tactical view, the shaders that are rendering these materials change so things look outlined and generally different. The same thing happens in batman: arkham's 'detective mode'.

share|improve this answer
Technically a texture isn't really a material on it's own, it's usually part of a material. – bobobobo Dec 19 '12 at 17:26

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.