Architectural Glass - April 2005

Ted Boardman tedb@tbmax.com         http://www.tbmax.com

Even if there is 8 inches of new windblown snow and temperatures near 10°F on the morning of March 9, there really is a chance that spring will arrive in New England one of these days.

Well, I wrote that early in the month and was dead wrong! It’s now the end of the month and there have been several of those snowstorms since, but areas where the sun hits are showing bare ground, even if my backyard still has 2 feet on the flat. I’ve got a few business trips coming up that will take me south, hopefully into some warmer weather for a few days and I can open some windows and let the spring breezes blow in. Of course, I’ll be complaining about the heat in just a few months!

Speaking of glass…one of the most frequently asked questions is “why can’t I make good glass material in max and VIZ?” The answer is more about perception than reality and the fact that most people have trouble describing what they think they want is much of the problem. My hotel at Siggraph in Los Angeles last summer looked out onto the KPMG and Wells Fargo buildings which are polished stone and glass banding. If you ever presented your client with the real reflections on those buildings you would have been fired immediately. It was a chaotic mess of reflections from different refractive materials and coatings and multi-pane windows that no one would have accepted. Strike “reality” from your visualization vocabulary.

Architectural Glass: An adjustable template

I don't believe that there is a single answer that will satisfy the quest for a material to represent "good glass" under all conditions or under a wide range of conditions for that matter. Glass is transparent, therefore, it can hardly be seen at all and what we are actually trying to simulate is the dynamic, and contradictory, interaction of transmittance, reflection, and specular highlights. The numbers of variables that influence the outcome are many; even slight changes in the position of lights or the viewing angle can ruin the effect. Trying to come up with a good recipe for architectural glass is much the same is trying to get your favorite cookies judged at the county fair; I know they're good and you know they're good, but the judges may have totally different tastes and might find the cookies inedible. Such is life!

What I'll attempt to do in this column is to document the material and mapping of a sample glass material for you to try in your scenes that will allow you to adjust various aspects to fit your needs.

As always, remember that the placement of lights in the scene are very important to the end result, so you're on your own in that respect. Figure 1 shows the Map/Material Browser for the template material that we'll start with.

Figure 1: The maps of choice for flexibility are the Falloff map and the Gradient Ramp map.

Architectural Glass Material.

Creating an architectural glass material that will satisfy of viewers all of the time is an elusive target because of differing perspectives on what glass should look like. Most glass is completely transparent, therefore, what we're dealing with here is a combination what can be seen through the transparent glass, the reflections on the glass, and specular highlights.

I suggest that you take the time to really study a variety of windows around where you live or work before playing with this material so you have a good idea of what you're trying to reproduce in max or viz.. My observations show that glass with no direct light falling on it will appear as very black voids in a wall as seen very early in the morning on the dark side of the building, where there is no bright sky to reflect and no direct light penetrates the interior. Even though this effect is a very common occurrence in the real world it is usually unacceptable to visualization clients because of preconceived notions of what glass "looks" like.

For windows where the sun is shining directly into the interior and the viewer is looking straight into the window much of the interior is visible with slight reflections, depending on sky conditions and surrounding objects.

As the viewing angle becomes more oblique the transparency of the glass diminishes and reflections becomes stronger, again depending somewhat on the scene being reflected. Remember the transparency and reflections are mutually exclusive; you can't have high transparency and strong reflections at the same time.

A good way to test the sample material is to clear all the check boxes for all the maps and render the scene, then check one map the time and render the results to compare the difference. The RAM Player, found in the Rendering pull-down menu, is an ideal tool for comparing renderings. You should also adjust the Diffuse colors for both materials in the Blend material and adjust the colors of the Gradient Ramp Background map. I find it handy to use particularly bright colors initially to clearly see how and where they affect the rendered image, then adjust the colors to something more realistic for the final render. Finally, in the Blend material, clear the checkboxes for Material #2 and the Mask and render the scene. Then clear the checkbox for Material #1 and check Material #2 to render just that material and then check all 3 checkboxes to see the final results. In other words, test this material systematically so you clearly understand what effect each setting has.

Note: In the 3ds max 6 file I'm including as an example this Blend material is the second material in a Multi-/Sub-object material. The building is all one object with separate Material ID numbers for the bricks and for the glass.

Top-level Blend material: the Blend material is used because it allows you to use 2 separate materials with the option of mixing or masking between them. This makes it easier for you to control transparency independently from reflections with the added flexibility that masking provides. See Figure 2.

Figure 2: The Blend material consists of two materials with a mask.

Material #1: this is primarily the reflective material but also has an Instance clone of the Opacity map from Material #2 for more consistent transparency for all the glass. See Figure 3.

Figure 3: The Reflective material in slot #1. The checkboxes to the left of Opacity, Bump, Reflection in the Maps rollout can be cleared to disable the maps.

Diffuse and Ambient colors: these areset to black to allow pure transparency and reflections. Of course, these colors can be changed to influence the glass went to understand how all the elements function.

Specular highlights: a high Specular Level value and a low Glossiness value create broad, bright highlights on the surface of this material.

Opacity: this material uses an Instance clone of a Falloff map that I'll described in more detail for the next material.

Bump: a Noise map with a fairly large Size and a low Amount setting gives the illusion that each pane of glass is out of plane with the others for a more convincing look.

Reflection: this is actually two maps, a Raytrace map and a Falloff map as a mask. See Figure 4.

Figure 4: The Mask map controls where and with what intensity the reflections will show.

The Raytrace map has its Attenuation set to Exponential falloff type. The Start Range at 0 means that the reflections would begin to attenuate at the glass surface and the End Range at 10,000 means that no objects beyond 10,000 inches will be reflected. These values are always in system units. The Background radio button means that what ever map is in the rendering background, in this case a blue and white Gradient Ramp map, will replace any pixels in the scene beyond the 10,000 units that are cut off by the attenuation. If the Specify radio button were used or if the rendering background was left the default black, any pixels beyond the cutoff point would be black. This Attenuation is very important for two reasons; it reduces the math involved in calculating Raytrace reflections and it allows you to tint the distant color in the reflections for a more convincing illusion. See Figure 5.

Figure 5: Exponential attenuation is set with ranges appropriate for the scene and to have pixels beyond the end range filled with the colors of the background rendering map.

Note: The rendering Background is set from the Rendering pull-down menu, Environment dialog.

Mask: the mask is a Falloff map set to the default Perpendicular/Parallel falloff type is determined by the Viewing Direction in the viewport. The default map colors are black and white. This means that faces perpendicular to the viewer have no reflections and faces parallel to the viewer have full reflection. Faces at a 45° angle to the viewer get half the full reflections. The Mix Curve is adjusted to control how quickly the transition between for reflection and no reflection occurs, which is very subjective based on your perception. See Figure 6. You can also control the maximum and minimum amount of reflection by lightning or darkening the color swatches of this Falloff map.

Figure 6: The Falloff mask controls the amount of reflections based on the angle of the glass to the viewer. The steeper the viewing angle, the more reflections are visible.

Material #2 : this is the transparent material and is quite simple. The Diffuse and Ambient colors are set to black but could be adjusted to tint the transparent areas. Specular Level and Glossiness are set to give lower specular highlights in the transparent areas. See Figure 7.

Figure 7: The transparent material is made up of a single Falloff map in the Opacity slot.

Opacity: the Falloff map used in the Opacity slot is also set to Perpendicular/Parallel falloff type and the black color represents transparency, whereas the white color represents opacity, so faces perpendicular to the viewer are fully transparent. While faces parallel to the viewer are fully opaque and at a 45° angle the faces are semi-transparent.

The Mix Curve has been adjusted to cause the faces to become less transparent more quickly. See Figure 8.

Figure 8: The glass is transparent when viewed straight on and becomes opaque rather quickly when viewed at an angle.

The Blend Mask: the two complete materials are masked to reveal one or the other based on the viewing angle with a Falloff map. The Mix Curve is adjusted for a rather quick transition from transparent to reflective. See Figure 9. Again, you can see the effect of the mask by clearing the checkbox at the Blend material level. The transparency and reflections are then mixed at 50% each, regardless of the viewing angle.

Figure 9: The Falloff map at the material level controls the angle at which the viewer sees either the reflective or the transparent material.

Other Factors: a few other factors that are important for this particular scene are the sky is a hemisphere with a map on the inside and that the standard Sunlight as a contrast setting of 60. There are also other buildings and trees in the scene, so that the reflections have something to reflect. A lack of objects to reflect is often a key reason why glass doesn't look convincing. While it has nothing to do correctly with this material, the scene is also rendered with Mental Ray using Final Gather and a Skylight to generate the fill light in the scene.

There are ceilings objects within the building that have self-illuminated maps to represent ceiling lights and there is a solid object to represent interior walls. The trees and bushes in the scene are simply triangles arranged in the form of the tree canopy with a very bumpy material that you can read about in my April 2003 column.

I've adjusted the Global Raytracer settings to reduce the number of reflection bounces as I mentioned in my February column. At a resolution of 720 x 486, the scene renders in under five minutes on my laptop using 3ds max 6 and in under one minute on my dual Xeon workstation with 3ds max 7. See figure 10 for the result of this particular scene.

Figure 10: The steeper the viewing angle to the glass surface, the less transparent and more reflective it is and the reflections are somewhat distorted by the Bump map.

Summary

Play with this material and make adjustments to the various falloff maps to see if it's something you can adapt to your work. Even if it doesn't apply your glass it may give you some ideas for other materials such as water or metals, for example.

By using a Blend material if you can more easily isolate each component, and then mix or mask them after you have determined how each looks independent of the other. Taking advantage of this aspect of max or viz allows you to make quicker changes on-the-fly without reinventing the wheel each time.

Good luck and have fun.
Ted


Download the MAX file (441KB)