Friday, December 4, 2009

Radial Brushed Metal Material

The Theory:

If you were to take the cross section of a brushed metal object you would find a series of small grooves etched into the object. You could attempt to simulate this using a very fine/high resolution bump map however the sampling rate required to eliminate aliasing would probably be prohibitive come render time.

In this shader we're going to use a blend material and surface normals to create a similar effect but much more rapidly than a brute force approach.

Instead of a series of small grooves we'll just have one material which simulates one side of a pyramid and a second for the opposite side. When blended together it'll give the impression that it's reflecting both directions simultaneously. By reducing the glossiness of the reflection we can also give the illusion of smoothing the grooves slightly.

In Practice:

Enough theory here is how to do it in Brazil. First let's start with 'one side' and then we'll instance all of our settings to the second material which will render the opposite angle.

1) Create a new Brazil2 Chrome material. We'll call it "Radial_Reflect_A".

2) In the Bump map slot we'll add a Gradient Ramp map. Go ahead and give it a name such as "Radial_Grad".

3) Under Gradient Type in the properties rollout select Radial. This will create the angled normal for one side of the pyramid.

[This step could also be replaced with a texture if you wanted to create overlapping brushed metal spots. The only important thing is to have a radial gradient of some sort.]

4) Back up at the B2 Chrome level: Enable Glossiness and choose "Phong" from the type rollout.

5) In the Focus map create an RGB Multiply map.
Give it a name such as "Refl_Gloss"
Set Color#1
to about 128 gray.

This will later let us instance the glossiness setting between the two materials.

6) Back up at the B2 Chrome level: Instance the Refl_Gloss map into the Specular Glossiness.

7) Create another RGB Multiply Map ("Spec_Level") in the Specular Level Map slot and set color #1 to white.

8) Create another RGB Multiply Map ("Refl_color") in the Specular Col. Channel.

9) Instance Refl_color into the reflection Filter map slot.

The first copy of the material is done. Next it'll just be a matter of creating its doppelganger.

10) Click the material type slot next to the materials name (Brazil2 Chrome) and choose Blend. When prompted be sure to choose "Keep old material as sub-material".

11) Set the Blend's Mix Amount to 50.0

12) Copy Radial_Reflect_A into slot #2 and rename it to something like "Radial_Reflect_B"

13) Go into your Radial Reflect B and change the Bump amount from 30 to -30.

14) The only thing left to do is Copy and Paste (instance) each map from Reflect A into the corresponding map slots in Reflect B. (Right click "Copy" on source. Right click "Paste (Instanced)" on destination map)

You can now adjust any of those maps and have them carry over to the opposite material automatically.

Tuesday, April 28, 2009

Facing glass panels in Brazil r/s V2

Real world examples:
Here are some photos of real world glass sculptures with facing panels.

Author: Vaclav Cigler

What options do we have?:
All testing will be done on simple scene with glass sculpture composed from 3 glass blocks. Material used is Brazil2 Glass material with enabled absorbtion (light blue).

Option 1 - Facing panels
At fist we can let the geometry as we have modeled it. Less work for us but causes artifacts from some angles due to Coincident Faces Crud.

Benefits: no need to modify model parts positions
Drawbacks: causes erros due to Coincident Faces Crud

Option 2 - Intersecting panels
What will happen if we will try to slightly intersect the panels? This will let us to get rid of artifacts and may look like right solution. But the refractions/reflections will be inacurate due to fact that in real world this can´t be done and we are making additional interractions.

Benefits: no errors from Coincident Faces Crud
Drawbacks: inacurate reflections/refractions

Option 3 - Gap between panels
In real world if the glass panels aren´t baked together there still remains some small gap filled with air/other interface (glue...etc.) between them. So when we offset the panels with leaving a small space between them we should get the right result by simulating this fenomen.

Benefits: no errors, acurate reflections/refractions
Drawbacks: moving with the model

I hope that this simple demonstration will help to those who has problems with this part of glass objects rendering. Any additional ideas or contributions are wellcome and I´ll add them into article.