Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

I am trying to figure out the difference between a "Material" and a "Material Pass" (in theory). Is it basically that a Material will have multiple "Material Pass"'es, along with a name. Then the "Material Pass" will have the references to the texture, shaders and property values that need to be set?

share|improve this question
add comment

2 Answers

up vote 4 down vote accepted

You haven't given us much context about where you heard these terms. Their meanings can vary, but generally they mean the following.

A material usually refers to the collection of textures that produce a certain surface look. This can include the ambient/diffuse light texture, the normal map, the ambient occlusion map, the specular exponent map, the specular intensity map, etc.

A material pass in a forward rendered pipeline refers to using the material textures to apply lighting and color to an object. This is the step where we draw part or all of the colors on objects to the scene texture. With forward rendering, this usually means including all of the lighting effects during this pass. There is often only one material pass, but sometimes multiple material passes are done in order to apply part of an effect at a time, as an optimization, or to overcome hardware/software limitations.

A material pass in a deferred rendering pipeline usually refers to the pass where materials are applied. Several "passes" are done in a deferred rendering pipeline. We have a depth pass where we draw all the depths in the scene to a texture, a lighting pass where we draw all the lights to a light buffer texture, a material pass where we draw all of the object colors to a material texture. These multiple textures are then later combined into a final image.


In other words, a material is a collection of textures to be applied to a piece of geometry, and a material pass is where we actually apply some or all of the color and light effects that the material represents to the geometry.

share|improve this answer
    
So a "Material" would information if the material can recieve lighting, where the "Material Pass" would contain the shader references and shader variables. So shader variables would be set on a per "Material Pass"/"Shader Pass" basis, not per material? –  judeclarke Jul 10 '11 at 16:35
    
Again, these words have different meanings in different rendering pipelines. Ultimately a material usually refers to how a particular piece of geometry will have lighting and color applied to it. A material pass is always where you actually draw the lighting and color effects. In some engines, a material might be an object in the engine, that contains references to the textures for an object, but also the shader variables and the particular shader to use to draw that type of material. In other engines, all materials might use the same shader, so the shader reference goes in the material pass. –  Olhovsky Jul 10 '11 at 23:48
    
The underlying API (like DirectX) has no knowledge of a "material" or a "material pass". These are just terms that graphics programmers use to communicate and understand what different parts of an engine is doing. The material will refer to whatever engine object contains all of the data needed to know how to draw a specific color/lighting scheme on a piece of geometry. Anything information that is global to all materials can be stored by another object though, as the global characteristics of objects will always be used in the material pass. –  Olhovsky Jul 10 '11 at 23:51
    
Ah, terminology can be a killer. When I refer to a "Material Pass" I mean when rendering a single piece of geometry, that has multiple shaders being applied to it (think for deferred rendering, and in the getting the color of the geo for the color map). In that case, would each of these "passes" have their own vertex/pixel shader and texture? –  judeclarke Jul 11 '11 at 2:39
    
That depends on what effect you are trying to apply to the geometry. They may require their own pixel and vertex shader. More often they will only require their own pixel shader. In some cases you can use the same pixel and vertex shader. It all depends on what you're trying to draw -- the phrase "material pass" does not imply that you will have one or multiple pixel/vertex shaders. It's common to do a single pass to draw a piece of geometry that has multiple different looks, using a texture to specify where the shiny parts are, where the dull parts are, etc. –  Olhovsky Jul 11 '11 at 2:43
show 3 more comments

The term "Material" usually refers to a specific set of surface characteristics, which are used by a lighting model to compute the reflectance at a point on a surface. But if it does, then "Material Pass" doesn't really make sense.

Therefore, let's assume that by "Material", what you really mean is "a visual effect that I would like to produce, using one or more light sources and arbitrary other data." In which case the term "Material Pass" is a single shader that implements some part of this visual effect.

Note that the typical terminology for this "Material Pass" is "Shader Pass" or something of the like, while the term for what you seem to call "Material" is usually "Effect" or "Technique".

An Effect can be achieved by one or more Shader Passes. A Shader pass is a concrete piece of shader code, which has a number of parameters (uniforms/constants depending on the language). It will take certain inputs and produce certain output value(s). Multiple shader passes are composed with blending operations or possibly with direct shader feedback through render-to-texture.

share|improve this answer
    
So a "Material" would information if the material can recieve lighting, where the "Material Pass" would contain the shader references and shader variables. So shader variables would be set on a per "Material Pass"/"Shader Pass" basis, not per material? –  judeclarke Jul 10 '11 at 2:14
add comment

Your Answer

 
discard

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.