利用者:Karl.wilcox/Simple Explanation of Complex Materials

提供: wiki
移動先: 案内検索

A Simple Introduction to Realistic Blender Materials

Introduction

NOTE:

This document is not intended to replace the Blender manual, or any of the many materials tutorials available. The manual is a reference source for every feature in Blender, and of necessity is quite brief in many ways. Materials tutorials are an excellent way of following the process by which a particular material is created. What I hope to do in this document is to provide a deep understanding of materials and how they work in Blender. Where the manual provides a simple description of a feature, for example "hardness" in the specular shader, we will look at the range of values that hardness can take, what effect appears at the extreme values, and what "typical" values everyday objects have. Where a tutorial can show you how "these settings" and "these textures" produce "this effect", we will look at exactly how any given pixel in your image gets its final colour - how the diffuse, specular, and mirror colours are calculated and combined, how textures are then applied and how the rendering process affects the final appearance. And I intend to do this one small step at a time! This is a difficult task, and I may not manage it, but we will see how far we get.

The purpose of this document is to provide a thorough understanding of how materials work in Blender - that is, we want to understand why an object looks the way it does when we render our final image. This is a complex subject but we will tackle it in a series of small, simple steps, simple enough for me to understand!

The appearance of an object in our final image is determined by a number of factors:

  • The material which the object is "made of"
  • The characteristics of the light source(s)
  • The relative positions of the camera, object and light source(s)
  • The atmosphere (for example, mist or rain)
  • The environment (for example, shadows, reflections and the colours of nearby objects)
  • The process used to create the final image (the "rendering" process)

We will consider most of these factors and also try to explain how they interact.

Keeping Things Simple

Objects - We will use two simple shapes, a cube and a sphere in our discussion. To begin with we will keep things even simpler and often only consider one face of the cube.

Lights - we said above that the characteristics of the light source will affect the appearance of the object. Again, to start with we will use only pure white light sources. All the discussion below assumes a single, pure white light, unless otherwise stated

Object Material

Let us consider our simple cube. We will give the whole cube a material but for the sake of our discussion we will mostly just focus one face and consider how we can make it look increasingly "real". First, we need to give the object a basic colour.

Diffuse colour

Most objects have a simple, basic, overall colour, as seen when illuminated by white light. This is known as the Diffuse colour It is the colour that we would use to describe the object, for example "The red car". This colour appears the same regardless of the viewing angle, we would still describe it as a "red car" regardless of which direction we were looking at it from.

In Blender, we set the Diffuse colour of an object using the Materials menu [key example]. Press the Col button and choose the colour using the individual red, green and blue sliders, or by picking a colour from the colour selector accessed by clicking on the colour sample. [Screen shot here?] Colorchoice

As well as this basic colour, a material also has a reflectivity - how much light that hits it actually gets reflected to the viewer. This is the Ref parameter. A value of 0 means that no light is reflected and the object appears black (whatever colour we actually assign). A value of 1.0 means that the object appears as fully illuminated, exactly as seen in the colour sample. In reality, most materials are not completely reflective and a default value of 0.8 is used in Blender.

Remember that the angle between our viewpoint and the object does not change the diffuse colour that we see. What does matter is the angle between each face of the object and the light source. If the light source shines directly onto the face it will appear bright, if the object is angled away from the light source it will appear less bright. With a single light source, each face of our cube will have a different brightness, depending on its angle to the light source.

The important feature of the face is its normal. This is the angle "outward" from the face and perpendicular to it. Remember that in blender, faces can be triangular or square but must always be completely flat ("all vertices in the same plane"). The normal is just the vector (a line with a direction) that is at a right angle to this plane. It is important because the angle between the normal and the direction of the light source determines how much light the face receives, and hence how bright it is. A small angle means that the light is almost "face on" to the face, a large angle means that it is "sideways" one to the face and provides less light.

The normal is also used in other parts of the material process, as we will see later.

The parts of Blender responsible for working out the appearance of objects are called shaders. The appearance of the diffuse colour is calculated by a diffuse shader. Blender provides several diffuse shaders which provide differing degrees of "reality".

Diffuse Shaders

Lambert - This is a basic shader which calculates the appearance of diffuse colour based on the reflectivity and the angle between the normal of the face and the light source. It has one parameter, reflection, ref which can vary from 0 (black, no reflection) to 1.0 (all of the incident light is reflected back). The default value is 0.8. [What is tangent vector shading???]

Oren-Nayar - This works the same way as the Lambert shader but with a roughness parameter, rough which is how (microscopically) "rough" the surface appears. It can vary from 0 (smooth - like the Lambert shader) to 3.14 (which looks like pi to me!). A rougher surface tends to look darker for the same reflectivity.

Minnaert - This works the same way as the Lambert shader but has a "darkness" parameter that darkens (up to 2.0) or lightens (down to 0.0) the edges of the face. A value of 1.0 appears to be same as the Lambert Shader [Is this right?]

Toon - produces flat, cartoon like colour. As we are trying to understand realistic materials, we will not consider this one further here!

Fresnel - [Not known]

Specular Reflection

We know how to give an object a basic, overall colour, but at the moment it is completely "flat", a true matte finish. In reality, many objects are at least partly shiny - that is, some of the incoming light is reflected straight back to the observer, without picking up much of the object colour. This is known as Specular Reflection.

Because this is a reflection phenomenom it is dependent on the relative positions of the observer, object and light source. The angle at which the light strikes the face is angle at which it shines off. (The normal is used for this calculation). The amount of light striking a face that gets reflected is set by the Spec button, which runs from 0 (no highlight) to 2.0 (very bright highlight). In addition to Spec, there is also a hardness parameter which determines how "tight" the highlight is, from 1 (virtually all the object) to 511 (just a small portion of the object).

In theory, over the area of the highlight the Spec value and Ref values should add up to not more than 1.0. For example, with a Spec of 0.8, and a Ref of 0.1, 80% of the incoming light is seen as the diffuse colour, 10% is directly reflected as a highlight and 10% is "absorbed" by the object. If however, we make Ref 0.4 we have 80% of the incoming light showing the diffuse colour and another 40% showing the highlight, so that the face is illuminated by 120% of the incoming light and hence is brighter than reality would allow! However, the highlight area is usually much smaller than the total visible area of the object so I would not let this worry you. The aim of realistic image creation is to produce an image that "looks" real, not one that necessarily provides an accurate model of real, physical processes.