Brazil Shaders (Materials) Introduction

Introduction to the Brazil shader system

What are shaders?

In Brazil, everything that makes a visible impact on a rendering is referred to as a shader. This includes lights, environments, materials, textures, and camera lenses. Shaders are predefined behavioral patterns that affect the rays during the raytracing process.

Imagine raytracing a single pixel during a rendering. The process is something like this:

  1. A ray is shot from the pixel into the camera lens shader (A > B),
  2. The lens shader changes the direction of the ray based on the current camera projection and depth-of-field settings (B).
  3. The ray can now hit an object, such as the green, partially reflective sphere (C).
  4. From the impact point, new rays are traced towards all light-sources in the model (C > D).
    These shadow rays determine the intensity and color of the effect of every light on the geometry (C).
  5. The sphere's material shader combines this lighting information using a specified algorithm to calculate the color at C.
  6. Since the sphere is partially reflective, the material shader needs to know the total of all lighting and the color of whatever is visible in the mirror.
  7. Another ray is cast (C > E) that may intersect with geometry, setting off a new iteration.
    In our simplified case, the reflecting ray does not intersect any other objects and therefore terminates at the environment shader.

In a complex rendering with skylight, global illumination, glossy reflection, or subsurface scattering, and since most Brazil materials are actually composites of other shaders, the number of rays spawned from a single pixel ray can be very large. The diagram below is a schematic representation of a Brazil composite shader. It shows how various effects are combined to form the complete shader:


The material comprises five different effects:

  1. A texture specifies the diffuse color on every bit of the surface (Color channel).
  2. A Lambert shading algorithm controls how light affects the surface (Diffuse Illumination).
  3. A Phong highlight shader adds specular effects (Specular Illumination).
  4. A reflection shader (Reflection).
  5. A refraction shader simulates transparency (Refraction).

Although each of these shader nodes can be controlled individually, some advanced material shaders provide a simplified interface that deals with all the sub-shaders behind the scenes.

Shader libraries and types

Brazil's material shaders can be grouped in three categories:

Brazil recognizes basic Rhino materials. In Rhino V4, Basic materials can store the following settings, even though most options are not yet exposed in the Rhino interface:

  • Diffuse color and/or texture
  • Transparency
  • Index of refraction
  • Opacity texture
  • Specular color
  • Specular strength
  • Specular shine
  • Bump texture
  • EMap texture
  • Ambient color
  • Emission color

These settings can also be represented by Brazil. Other render engines such as Flamingo and VRay also create simulations of their own materials that can then be rendered through Brazil. This also works the other way around - other renderers should be able to render an approximation of Brazil shaders.

Brazil also supplies a number of Brazil-specific shaders that capitalize on Brazil's advanced features. These include effects that cannot be properly represented as a Rhino material including dispersion, absorption, glossy reflection, sub-surface scattering. Most Brazil shaders are grouped under a master shader called the Brazil Advanced Material (BAM). All the shaders in the BAM shader share sub-shaders. Some Brazil shaders do not fit into the BAM because they are too different. Examples of these are toon, glass, and chrome.

Brazil Advanced Material (BAM) Shader

The BAM is the base shader for many Brazil materials. It has a number of settings that are available to most sub-shaders, such as highlight and reflection.

BAM Default Shader

The BAM Default shader is an all-purpose shader that can be likened to the Rhino material. It exposes many features useful for creating realistic materials without committing itself to a specific effect. The out-of-the-box behavior of the BAM Default shader is similar to a gray diffuse material with a small specular highlight.

The default shader with a white color and no highlight. The surfaces are completely diffuse. The spheres are lit by a point light and a sky dome and some of them are displaced. This is a property of the geometry, not the shader.

The diffuse color of the shader can be any HDR color or texture - in this case, a simple olive green.

The BAM shader comes with three types of specular highlight shader: Blinn, Phong, and sheen. Blinn and Phong are visually very similar; they both boost the intensity of the surface sections that reflect light sources in the model. This is merely a computational trick, there is no actual reflection going on. You can use highlights to invoke a sensation of shininess without compromising your render-time performance.

The Blinn highlight can display anisotropicity (the highlight becomes stretched instead of round). This is useful for simulating shininess of materials with micro-grooves such as brushed metals or plastics.

The Sheen highlight mimics the reflection of light-sources on surfaces with micro-faceting. In other words, non-smooth surfaces such as fabrics and some plastics. Sheen highlights always appear along the edges of surfaces, and they are integral to shaders such as wax and velvet

The BAM Default is also capable actual reflections and refractions. Here, the highlight shader has been disabled, and the reflectivity of the material has been set to 50%. The green color of the diffuse illumination is almost swamped by the blueness of the reflection.

Reflection in the BAM shaders is sharp by default, but it can be made glossy (blurry)..

Using a texture override in the base color and a faint reflection, the BAM Default shader can mimic a wide range of mirroring objects.

Carpaint Shader

The Carpaint shader is designed to simulate metallic painted surfaces. There is more to real car paint than just reflection, and this shader captures those evanescent properties. In addition to the BAM Default shader, Carpaint adds three effects:

  • Falloff (controls the mutation of paint color at shallow angles)
  • Candy (controls the mutation of paint color at light reflecting angles)
  • Flakes (controls the sparkly look of metallic paint layers)

A BAM Carpaint shader without flakes looks like a BAM Default with reflection, but there is an unmistakable hue gradient in the upper left area of the sphere which is impossible to achieve using the BAM Default, this is the Candy effect. The diffuse color of this shader is orange, the Candy is pink, and the falloff is dark red. You can see all those colors fighting for dominance on the surface.

By adding a few faint flakes, the surface becomes more crisp. The scale of the flake noise immediately conveys a scale for the entire object.

By making the flakes less faint, the effect is amplified; however, the flakes are slightly too big to give a proper Carpaint feel.

Adjusting the flake size helps to increase the realism of the image. Note that flakes are a microscopic effect that should not be viewed at close range.

Increasing flake size.

Increasing flake size.

Increasing flake size...

Typically, the best Carpaint shaders use colors that have similar hue values. Departing from this rule yields some interesting, but unrealistic, results.

Glow-Worm Shader

The Glow-Worm shader is physically incorrect shader which can nevertheless be used to create realistic results. Essentially, it is the BAM Lambert shader with an incandescence factor. Whenever a Glow-Worm shader receives little light, it starts to emit its own:

With incandescence disabled, Glow Worm behaves identical to BAM Lambert.

With weak incandescence, the unlit portion of the sphere starts to glow, casting light on the ground plane.

Strong incandescence amplifies the effect. Glow Worm can mimic sub-surface scattering without adding computational.

Velvet Shader

The Velvet shader approximates cloth and fabric materials. The integrated Sheen highlight controls provide a good lighting model for rough materials.

Velvet material with a procedural color texture and decreasing Sheen values.

Wax Shader

The Wax shader  is the all-purpose sub-surface scattering shader that mimics real-world materials such as wax, jade, skin, milk, marble, and plastics. Sub-surface scattering is the effect created when light is diffusely spread across the interior of a shape. SSS is usually a very subtle effect.

With sub-surface scattering disabled, the Wax shader resembles BAM Lambert. The material completely absorbs or reflects all light that falls upon its surface.

Sub-surface scattering conveys a sense of scale. Progressively higher sub-surface thickness values allow light to penetrate the shape farther, making the object feel smaller and smaller. 2mm thickness.

5mm thickness.

20mm thickness.

Marble without sub-surface scattering. Sub-surface scattering can work well with reflection to create shiny materials such as wax, marble, jade, and milk. 

Marble with sub-surface scattering. The light source illuminates the inside of the tube through the wall.

Chrome Shader

The Chrome shader is only used for extremely reflective materials. It has no diffuse component.

The default Chrome shader reflects 100% of the incoming light. This is unrealistic behavior. The highest reflectivity achieved by human made materials is about 97~98%

Setting a filter color dampens the reflectivity significantly. 

Textures can be used for the filter property instead of single colors. The examples uses a gradient from green to purple.

Reflection Decay reduces the effect of reflected light based on distance to the shader. This is a very unrealistic material property but it simulates absorption of the volumetric environment, such as fog. It also fades sharp edges in the reflection.

Reflection can also be glossy (blurred). Example without glossiness (100% angular glossiness).

95% angular glossiness.

90% angular glossiness.

80% angular glossiness. The environment is an HDR environment containing colors that are brighter than white. These colors start to leak into neighboring pixels when they are blurred due to Bokeh aberations

Glass Shader

The Glass shader also lacks a diffuse component. The material only deals with refractions and reflections and has a number of controls over refraction properties:

The default glass is completely transparent with no extra properties. This is unrealistic, since all materials absorb at least some photons making the light coming out darker than it went in. The purple and orange colors are reflections of the HDR environment texture. Glass becomes highly reflective at shallow angles which means that there is a lot of internal reflection going on inside organic shapes. This is partly what makes the glass look so good.

Applying filters tint and darken the glass without adding any computational overhead. The effect of a filter color is the same as though the glass were coated in a thin layer of transparent material.

Absorbtions factors simulate colored glass. Truly colored glass absorbs more light in thicker areas since the light has to travel further through the glass. The example shape has a varying thickness. The glass is very transparent at the thin parts and becomes increasingly dark in the thick areas.

Dispersion is a property of all refractive materials in the real world, but is rarely included in renderings. Transparent materials are typically assigned an index-of-refraction (IOR) value that controls how sharply the light is bent when it enters the material. In reality, IOR differs per photon wave length. Red light contains less energy than blue light and tends to bend less when refracted (it has a lower IOR for any given material than blue light). Dispersion is also an extremely expensive shader property that significantly increases render time.

Refractions, like reflections, can become glossy, giving the impression of imperfect or opalescent materials. This image has no glossy refractions.

Glossy refractions enabled (Phong = 50,000).

(Phong = 5,000).

(Phong = 500).

Views: 3175

Comment

You need to be a member of Brazil for Rhino to add comments!

Join Brazil for Rhino

Videos

  • Add Videos
  • View All

Members

© 2017   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service