Search This Blog

Welcome to Rendering Tutorial Site

Welcome to Rendering Tutorial site. This site is develop to help artist, architects, advertisers, visual artists and hobbyist a place to share, gain and learn from tutorial writers, important knowledge, tricks and tips in using rendering and image processing software. Some of the link here were cross posted from other sites, some of them were develop for this site, and some of them were shared wholeheartedly by different individuals.

Monday 26 March 2012

Some Procedural Maps


Introduction to Gradient Ramp maps, 3D maps and blend materials
by Montree T.  Smoke3dStudio

 


Gradient ramp


The Gradient Ramp is a 2D map similar to the Gradient map, however, the Gradient ramp can be shaded more than 3 and there are several different types of effects that this map can produce . The Gradient ramp can produce unbelivable effects when it is mixed with ifself and other maps. It's also easier to use gradient ramp tiling instead of using 2d maps.

There is not much explanation required for Gradient ramps, so just take a look at the example pictures below.

Gradient ramp: linear type


 
Single Linear   Tiling Linear

Example picture of a linear ramp type: This louvre example uses a linear gradient ramp on the diffuse and bump map channels.

Gradient ramp: box type

 
Single Box   Tiling Box

Example picture of the box type: assigned to bump and diffuse map channels


Gradient ramp: radial type

 
Single Radial   Tiling Radial



Example picture of the radial type: used as an opacity map

Gradient ramp: sweep type

 
Single Sweep   Tiling Sweep


Example picture of the sweep type: using sweep gradient ramp on the specular level map
Gradient ramp: Mapped type

The Mapped type is used for adding colors (or sub-maps) on a black and white map. The different values on a black and white map are replaced with the color on the gradient bar as the end result.



Example picture of mapped type masked by a black and white brick map. The shades of black are replaced with blue on the bar and the white is replaced with orange.



The end result of the gradient ramp: mapped type


Example of mapped type, colorful mosaic tile

Tips: Basically, I use gradient ramp as a mask map for a 2d mix map or blend material. It's an easier way to change the color of a map by using gradient ramp under a mix map rather than putting the color in gradient ramp itself (unless you have more than 2 color in your map).
Change the colors in the gradient ramp map itself.



Change the colors under mix map is easier




3D maps
Noise, dent, celular, specle, splatter and etc. I will skip defining these 3D maps as I assume that you have had some basic experience with them already. We simply use a single 3D map as a bump map, diffuse map etc.

The effect of a material that has more than two of these 3D maps with itself or other 2d map ie. gradient ramp, mixed together looks much better.



The example above shows a stone wall done with pure 3d cellular maps in several layers assigned to the diffuse, specular and bump maps. The rest of the materials on other objects are done with gradient ramp with 3D maps.



Another example with all materials created without any bitmaps. The rice is a cellular map and the meat is gradient ramp, and the plate uses noise and cellular maps.


Blend material
The Blend material is a mix of two independent materials with different shaders (can also be the same). The border of the two materials are specified by a black and white map that we call a "mask map". The first material in the blend slot refesr to the black color in the mask map and the second material refers to white. Both materials are overlaid in an area of the mask map which contains grey. I have a few examples which are practical to architectural rendering.

Example 1 : Creating a grid ceiling with a blend material.
From the picture, the material is composed of a grid area and diffuse light (fluorescent) which are specified by a mask map.




1. Mask map
I use a gradient ramp in black and white shade and a gradient type of box with 1x1 mirror tiling. The black in the mask map refers to grid ceiling area which is material 1 and the white is fluorescent area (material 2).





This is how the mask map look like.

2. Material 1 


Material 1 (grid ceiling)

Go into material 1, which is thegrid ceiling. I use gradient ramp with box type again as a diffuse and bump map.



We also need to adjust the tiling of the grid which is now 3x3 mirror tiling to match with the mask map (1x1 mirror).




If the tiling numbers are diffirent from this sample, when you create a material on your own, the offset distance may also be changed to match with the tiling as well.

The example below shows a mismatched position of the tiling ,caused by the wrong adjustment on offset distance



3. Material 2



Material 2, fluorescent

Material 2 is fluorescent that is easy to create. I just change its self illumination parameter to 100 or color it white. If you want more detail on this fluorescent, you may add a gradient ramp map as its self illumination map.

I use 2 layers of gradient ramp to create this self illumination effect.






Grid Ceiling Chart



The ceiling in the image below is done with a blend material.


Example 2: Wet floor
Now that we have covered the blend material and using 2d gradient ramps, I hope you understand how to use them in your projects. The following example is for using 3d maps for a blend material that mostly needs no UVW map.



First, let me explain more about the legend of this material and its maps before we go onto the material chart.
The wet floor consists of 3 materials, mixed together which are:
1. Dry floor
Assign a 3d noise map to the the diffuse and bump channels. The shader is an Oren-Nayar-blinn type as I want the floor have roughness.



2. Damp floor
I just copy the dry material, but change specular level to be brighter, more glossy and make the diffuse color a bit darker as the damp floor contains a bit of water that makes its color darker. I then put in a little raytrace reflection.



3. Wet floor
This is the floor underneath the water. I still use the same material but change the specular and glossiness to be more glossy than the water. Remove Bump and add more reflection.



4. Mask map
As there are 3 basic materials (dry, damp and wet) there will be one more blend material that is overlayed on another blend material. I use 2 different dent maps (also 3d map) to specifiy the area of each material.


Mask 1


Mask 2





Below are 3d iamges,wet floor, using blend material




 

Material Masking

Material Masking by
Ted Boardman 

Who was that masked material?
Masking is the process of hiding and revealing portions of a pattern using the luminance values of another pattern or map. The concept is simple, as is the fundamental application, but by using masking upon masking you are able to generate very complex materials that are convincing to the viewer.

This column will introduce you to the process of masking at both the map and the material level in 3ds max or Autodesk VIZ, both programs share the same capabilities. We will start with the simple applications to see how masking functions, then work into more complex examples including animated masks.

Grayscale images generally function best as masks. It is the Luminance value of a pixel that controls the masking effect, white is opaque…black is transparent…levels of gray are somewhere in-between. Color images may be used as masks, but it is very difficult for most of us to judge a particular luminance value of a color. For example, green and yellow look very different, but might have the same luminance values and would be ineffective as a mask.

As with all topics in max or VIZ it is best to start simply to get a feel for the functionality and controls, then work into more complex applications. I will include a VIZ 4 file for downloading that can be opened in either VIZ 4 or 3ds max 4 and 5. For those of you with previous versions of max or VIZ the descriptions should be enough for you to build your own similar scenes and examples.

Where can masks be applied?

Masking can occur at either the map or the material level. If masks are applied at the map level the effect is only for that particular material component; Diffuse Color, Opacity, Reflections, etc. The material masking allows all components of materials to be hidden or revealed by the mask.

Two examples of masking at map level would be the Mask map that allows one map and one mask that allows the underlying Diffuse Color to show through and the Mix map that allows two maps with an optional mask. Another map type called Composite can be used for masking effects that use image Alpha Channels that will act as the masking agent. Alpha Channels will be discussed later in the column.

At the material level my favorite is the Blend material that allows two materials with a mask. This allows you to reveal two separate complete materials with different color, bumps, reflections, for example, with the mask.

The depth of masking is unlimited, for example you can have a mask map within a mask map within a mask map or a Blend material made of a material plus another Blend material, each with it’s own mask. Like I said earlier, though, start simply and build on your knowledge as you become comfortable with the process.

Masking at map level

As mentioned, there are several methods for applying masks at the map level of a material and the one we’ll look at here will be the Mask map.

The scenario is a tile floor with solid red tiles alternating with marble pattern tiles and can be accessed by downloading Tile_viz4.max. (Download zip file at end of article) The red color will be set as the Diffuse and Ambient Color swatches of the material. A Mask map is applied to the Diffuse Color slot and is composed of a Perlin Marble map and a Checker mask. The white areas of the Checker mask are opaque and show the marble map. The black areas of the Checker mask are transparent and reveal the underlying solid red Diffuse Color. See Figure 1.

 
Figure 1: The Material Editor shows a Mask map in Diffuse Color slot that contains a map and a mask. The viewport and rendered image show the effect of black and white masking of the map. Perlin Marble shows in the white areas and diffuse red shows in black areas.
 
This example shows how the process works in a Diffuse Color example. In the next example I use a Mask map in conjunction with a Raytrace reflection map on a tile floor that can be found in Wall_viz4.max. The scenario here is a ceramic tile floor with Brick maps defining the color and the bump pattern and a Raytrace map that causes the material to reflect its surroundings.

In the Mask map of the Reflection slot I have disabled the Bricks mask by unchecking it in the Mask Parameters rollout causing the reflection to be the same for both the tiles and grout. See Figure 2.


Figure 2: The mask of the floor tile Reflection slot has been disabled and you can see the reflection of the cylinder is the same in the grout and tile.

By applying the same Brick map I used in the Bump slot of the material to a Mask map with a Raytrace map, the reflections only occur in the white areas of the mask. See Figure 3.


Figure 3: Enabling the Bricks mask reveals reflections in the tile areas but not in the grout areas for a more convincing floor material.

Masking at the material component level offers a lot of possibilities for experimentation. The same Reflection masking as above could be used with Raytrace and a Noise mask to give the illusions of puddles on a road surface. A combination of Bricks map in the Bump slot with a Gradient Ramp mask could create the illusion of a knurled surface on a tool handle. Use your imagination and experiment.

Masking at the material level

Masking at the material level functions the same as at the map level but increases the control another notch. Each material can have widely varying attributes like color, shininess, and bumps, each revealed or hidden by the mask. In the example here I’ll use the Blend material with the optional mask.

The scenario will be a wall that needs a combination of brick and stucco. As in most projects the exact material placement will be held in secret by the designer right up to the last minute of the deadline. I want to be able to make last minute changes quickly and easily. This is also using the file Wall_viz4.max. (Download zip file at end of article)

Blend material with masking allows us to do this nicely. I create the Blend material with a Brick and a Stucco material, each with different patterns, colors, and bumps. I’ll use a Gradient Ramp mask that has been adjusted for solid bands of black and white to reveal the two materials exactly where I want them on the model.

This wall example also illustrates a powerful feature of max and VIZ called Map Channels. Because the patterns of the brick, the stucco, and the mask repeat differently over the wall surface I needed different mapping coordinates for each map. The wall has three UVW Map modifiers each set to a different Map Channel. The Gradient Ramp mask is set to use Map Channel 1, the Brick map uses Map Channel 2, and the Stucco map uses Map Channel 3 so that each pattern may be adjusted independently. The Map Channel in the UVW Map must match the Explicit Map Channel setting of the map in the Material Editor.

The Gradient Ramp map has been rotated in the W axis in the Coordinates rollout for proper orientation on the wall. An alternative would be to rotate the UVW Map modifier Gizmo.

Figure 4 shows the Gradient Ramp map and the rendered image shows the result of the masking. Each material has it’s own color and bump information.


Figure 4: A Blend material with a Gradient Ramp mask reveals Brick or Stucco at the appropriate location.
A simple change to the Gradient Ramp updates the position of the materials with no other adjustments needed. See Figure 5.


Figure 5: By adjusting the position of the flags in the Gradient Ramp map used as the mask, you can quickly reposition the location of the materials.

This same wall material could have been used with a Noise map to simulate a stucco wall with sections of plaster fallen off to reveal bricks below. You could also create the illusion of rust coming through a metal panel or grassy areas with patches of rock and dirt.

Animated masks

Masks do not have to be static images or maps. Interesting effects can be created by using animated masks in the form of avi or mov files or as sequentially number still images. You might say that it sounds logical, but you don’t have a 2D animation program to create the animated maps. Don’t fear, it is easy to create animated masks in 3ds max or Autodesk VIZ.

In the file called Rope_viz4.max (Download zip file at end of article) is a section of coiled rope made by lofting a circle around a helix and applying a material to it. The task at hand is to make the rope disappear over time, not all at once, but from one end to the other.

The solution here is to use a Blend material and a mask again. In the Blend material is a rope material and a material that is completely invisible. The opacity and glossiness of the material have been set to 0. It is important to set the glossiness to 0 to avoid a highlight on the invisible portion of the rope.

The mask is created in VIZ 4 by assigning a pure white material to a flat plane and animating the plane moving from just off screen to filling the viewport of a camera view. In this case it is Camera02. The animation was rendered as an avi file and used in the Mask slot of the Blend material.

Figure 6 shows the Blend material level in Material Editor and the result of rendering frame 15 of 30 frames. Half the rope that you see in the Camera01 viewport is invisible in the rendered image. See Figure 6.


 
Figure 6
The same technique could have been used to reveal a shiny new material under an old crusty material over time or to make a surface appear to bubble from the heat by revealing the base material with same material with a bump map added.

Note that it is important in this case that the rope be created in max or VIZ by lofting. Lofted objects are the only objects that generate mapping coordinates that allow the patterns to follow the curvature of the objects. For example the rope material and the mask both follow the rope as it winds upward.

Alpha channel and masking

You will often hear the term Alpha Channel in conjunction with maps in max or VIZ. It refers to information that is stored in certain bitmaps that determine transparency. The most popular files types with alpha channels are tga, tif, and png.

Computer generated images are displayed in pixels, either on screen or when printed. Since the early days of computer graphics anti-aliasing has been used to smooth diagonal lines and edges caused by stair-stepping across squarish pixels.

Anti-aliasing is done by blending the pixels at the edges of contrasting colors to make the edge appear smoother. If a red diagonal line is applied to a yellow background then some pixels are quite red with a little yellow, some are half red, half yellow, and others are quite yellow with a little red. This smooths the transition when seen from a distance.

However, if the red line is lifted from the yellow background and composited onto a blue background the yellow remnants look terrible and are worse than no anti-aliasing. 32 bit files or files with 24 bits of color and 8 bits of alpha channel use transparency pixels instead of the background color to create the anti-aliasing effect. Now when the red line with varying transparent pixels are composited to another background there is no problem and everything has clean edges that appear smooth.

Max and VIZ both can take advantage of files with Alpha Channel in the masks for a cleaner blend at either the map or the material level. Workings on the examples in this column don’t require Alpha Channel to work, but keep it in mind if you are experiencing problems with detailed masks in your explorations.

Summary

Masking gives you control of materials you never thought possible. The concept and application are simple at its base level, but by combining masks at different levels you can create materials that are complex yet easily edited.

As a personal plug, if you are a 3ds max 5 user, my new 3ds max 5 Fundamentals book by New Riders Publishing is set to appear in late October or early November. It is somewhat different than my previous fundamentals book in that I focus on the many new max 5 features in a series of exercises that take you from a medieval village to building a personal transporter, and a trip to the fortune tellers. The exercises are designed to be an interesting and informative way to learn uses for max 5 features from modeling, to materials and radiosity lighting, to collision detection and scene editing and compositing.

In any case, good luck and have fun!

Ted