difference of materiall and shader

Started by
1 comment, last by Scouting Ninja 7 years, 4 months ago

hi.

im a unity developer. in unity we have material assigned to object that receives shader as a parameter. as I read material is answer of object surface to light that receives. but I don't know what really shader is and what is shader programming.

please give me a good explanation what exactly they are and what is the difference and how they work.

thank you for helping

Advertisement

In terms of Unity, a shader defines HOW things get handled. It defines the pixel programs and whatever passes may be needed, and how the input data (meshes typically) are displayed on the screen.

For something like forward passes, shaders need additional properties like albedo, normal maps, roughness maps, etc. These are variable and can change frequently, despite the core shader itself staying the same. The material fills in those properties for the shader that it is linked to, so that everything you display can look different.

A none technical way of thinking about it is that the Material is a interface for the developer, to interact with the shader.

The shader does all the work you see on screen but if you wanted to change the color, you would create a variable in the shader that could be changed in the material, allowing the developer a easy way to do things.

This topic is closed to new replies.

Advertisement