Keywords: main

Next: 2.4 Photon Tracing Up: 2. Physics Shaders Previous: 2.2 Light Shader: physical_light

# 2.3 Materials

The material shaders dgs_material and dielectric_material implement different physically based models of reflection and refraction.

Diffuse-glossy-specular Material Shader: dgs_material

The dgs_material material shader can simulate mirrors, glossy paint or plastic, anisotropic glossy materials such as brushed metal, diffuse materials such as paper, translucent materials such as frosted glass, and any combination of these. This shader cannot be used as a shadow shader because shadows can only be computed along straight light rays, which does not agree with the definition of DGS materials. Use global illumination to illuminate objects in partial shadow from DGS objects.

        color "dgs_material" (
            color           "diffuse",
            color           "glossy",
            color           "specular",
            scalar          "shiny",
            scalar          "shiny_u",
            scalar          "shiny_v",
            scalar          "transp",
            scalar          "ior",
            array light     "lights")

diffuse is added to the result for each light, after multiplication with the color returned by the light and a weight based on the dot product of the incident light direction and the light direction.

glossy provides the color of glossy highlights.

specular provides the color of mirror reflections.

shiny determines the width of the isotropic glossy reflection, in a manner similar to the Phong reflection exponent: 5 is very wide and 100 is very narrow. If shiny is nonzero, the following five anisotropic parameters are ignored.

shiny_u and shiny_v are used for anisotropic glossy reflection. The specify the width of the glossy reflection is in the first derivative U and V directions. (Derivatives must be enabled or specified on the polygons or free-form surfaces that this shader is applied to.) The regular shiny parameter must be undefined or set to 0.

transp specifies transparency (if ior is 1) or refractivity (if ior is not 1). It also indirectly specifies reflectivity, as 1 - transp. Specular transmission is the same as refraction, while glossy and diffuse transmission is known as translucency.

ior is the index of refraction of the material. Metals typically have higher index of refraction than glass.

lights is a list of light instances that illuminate the material.

For isotropic reflection, use the shiny parameter and leave the shiny_u, shiny_v, angle, min, and max parameters undefined. If the shiny parameter is undefined or zero, the shader will check whether shiny_u and shiny_v are defined and nonzero, and if so, compute anisotropic reflection. The surface U direction is used by default as the anisotropic brushing direction. It can be altered with the angle parameter. Assigning a texture shader to the angle parameter allows fine, sample-by-sample control over the brushing direction.

Dielectric Material Shader: dielectric_material

The dielectric_material shader is a physically based material shader which can be used to simulate dielectric media such as glass, water, and other liquids. The shader uses Fresnel's formulas for dielectric interfaces. This means that most light is transmitted through the surface for perpendicular incident directions while most light is reflected by the surface for grazing incident angles, simulating the behavior of real dielectric materials. The shader also uses Beer's law for absorption of light that passes through a medium. This means that the light is subject to an exponential falloff as it is transmitted between two surfaces with dielectric material.

Two types of dielectric interfaces are supported: dielectric-air simulates the interface between a dielectric material and air, such as glass-air, and dielectric-dielectric simulates the interface between two dielectric materials, such as glass-water.

Two achieve physically correct simulations it is important to use the correct surface interfaces. When modeling a glass of cognac three different interfaces are required: glass-air, glass-cognac, and cognac-air. The dielectric material uses the normals of the surface to distinguish the media on either side of the interface. For a dielectric-air interface the normals point into the air. For a dielectric-dielectric interface the normal point into a dielectric material which is ``outside''. To use the dielectric material the model normals must be oriented correctly unless the ignore_normals parameter is set to true. This shader cannot be used as a shadow shader.

        color "dielectric_material" (
            color           "col",
            scalar          "ior",
            color           "col_out",
            scalar          "ior_out",
            boolean         "ignore_normals"
            scalar          "phong_coef",
            array lights    "lights"
        )

The components of the declaration are:

col is the ``persistence'' coefficient which corresponds to the fraction of light which is left after traversing one unit of material. Thus 0.9 means that 90% of the light is absorbed per unit length of the material. Lengths are measured in world coordinates.

ior is the index of refraction of the dielectric material.

col_out: if specified, the material is a dielectric-dielectric interface and col_out is the persistence coefficient of the outside dielectric material.

ior_out is used in combination with col_out to describe the outside dielectric material.

ignore_normals: normally the decision whether a ray enters or leaves the object is based on the direction of the normal (towards or away from the incident ray). If the object is poorly modeled and the normals cannot be trusted, this flag can be set to make the dielectric material shader count the number of times the ray has entered and left the object before instead of relying on the normal direction.

pcoef is a phong coefficient used to compute normalized phong highlights which again is used to generate a fake impression of an area light source. If this component is zero there will be no fake highlights and only the reflected rays can create highlight effects if they hit something bright.

lights is a local list of light instances specifying just those light sources which should be used with the normalized phong highlight. If this list is omitted, the global list of light instances is used (that is, all light sources in the scene graph).

Next: 2.4 Photon Tracing Up: 2. Physics Shaders Previous: 2.2 Light Shader: physical_light