New and Improved Rendering Tools1 Apr, 1998 By: John E. Wilson
This month, we will continue our explorations in the use of bitmap files in renderings that we started in the previous 3D column ("Rendering with Bitmaps," CADENCE, February 1998, pp. 83-89). These files can be used for making more realistic materials,
Table 1. AutoCAD's Rendering Material Attributes
|Color||Sets the overall color of the material.|
|Ambient||Controls the relative brightness of shaded areas.|
|Reflection||Sets the color of highlights on shiny surfaces.|
|Roughness||Controls the relative size of highlighted areas and the apparent shininess of a surface.|
|Transparency||Determines the percentage of light beams that pass though the material. The value of this attribute can range from zero (completely opaque) to one (completely transparent).|
|Refraction||Controls the degree to which light beams bend as they pass through a transparent material.|
As with the previous column, you will want to read this one while you are running AutoCAD; this way, you can participate in the experiments we describe. You will not need any experience in working with 3D models or in making renderings, and everything we describe can be done with out-of-the-box AutoCAD R14 or with R13 and AutoVision R2.
If you used the default R14 installation folder names, all of the bitmap files for renderings will be in the Program Files\AutoCAD R14\Textures folder. Unfortunately, if you used the typical AutoCAD installation, it's likely there are only three files in that folder. If this is the case for you, you should copy all of the files in the Acad\Textures folder on the AutoCAD R14 CD-ROM to your computer. This will give you more than 140 bitmap files to work with, including some you'll need for the activities in this article.
Your main use of bitmap files in renderings will probably be to enhance the realism of rendering materials. To refresh your memory, a rendering material is a set of appearance properties (or attributes) that is attached to a surface object, such as a 3D face, a polygon mesh or a 3D solid. The six attributes for standard AutoCAD materials are shown in Table 1. While these attributes work well for objects that have a uniform surface and color, such as a painted wall, they cannot simulate surfaces that have textures or patterns, such as tiled floors, wallpaper, wood or galvanized steel. Therefore, AutoCAD's renderer lets you supplement a material's attributes with bitmap images of textures and patterns. This use of bitmap images is often referred to as mapping, and the images themselves are called maps.
|Table 2. Rendering Map Types|
|Type of Attribute Map||Interface||Purpose|
|Texture||Color/Pattern||Simulates the pattern of a specific material, such as wood, floor tile, wallpaper or marble.|
|Reflection||Reflection||Simulates an image reflected from a shiny surface. The reflection of clouds on a polished automobile hood is an example.|
|Opacity||Transparency||Creates holes in surfaces; these maps enable you to make a window within an otherwise opaque surface.|
|Bump||Bump map||Creates patterns and images that have an embossed (raised) appearance.|
This type of mapping is the one that you will most often use in creating realistic rendering surfaces on your 3D models. Wood, concrete, rusted or oxidized metal, patterned carpets, shingled roofs and furniture fabric are just a few of the materials that can be simulated by texture maps. You do, of course, need to have a bitmap file with suitable images.
If you read and followed the exercises in the last 3D column, you already know a great deal about texture maps. You saw how they are created, how you can adjust the relative scale and proportions of their patterns, how you can compensate for surfaces that are not planar, how you can project images onto planar surfaces that are not parallel with the World Coordinate System x-y plane and how you can either have their pattern repeated (tiled) or have it displayed just once (cropped).
For an additional quick demonstration of texture maps, we will use the bitmap of a piece of wood. Start a new AutoCAD drawing-its initial set-up is not important-and draw a 3D face with the following command line input:
- Command: 3DFACE [Enter]
- First point: 0,0 [Enter]
- Second point: 3,0 [Enter]
- Third point: 3,1 [Enter]
- Fourth point: 0,1 [Enter]
- Third point: [Enter]
Zoom in so that the 3D face fills roughly half of the graphics area. Start the RMAT command from the View menu, the Render toolbar or the command line. In the Materials dialog box, make certain that the word Standard appears in the list box below the button labeled New, and then click the New button. This action brings up the New Standard Material dialog box. Enter any name that you like, such as test1, for the material's name. With the Color/Pattern attribute radio button (on the left side of the dialog box) checked, click the Find File button near the lower right corner of the dialog box. In the resulting list of folders, click the name of the folder that contains the bitmap files for rendering-the Textures folder if you accepted AutoCAD's default folder names during installation. Once you have located the bitmap files, find the one named whiteash.tga and double click on it. This selection will restore the New Standard Material dialog box with the selected bitmap file displayed in the File Name edit box.
Click the dialog box's OK button to return to the Materials dialog box. Be certain that the name of your material is displayed in the list box and that it is highlighted (Click on its name if it isn't). Then, click the Attach button. The dialog box will disappear, and you will be prompted to select objects to attach your material to. Pick one edge of the 3D face and press [Enter]. The Materials dialog box will come back, and you can now click itsOK button to end the RMAT command.
Now, start the RENDER command. Click Photo Real within the pulldown list at the top of the Render dialog box and click the Render button to render the current view. You might want to experiment with different scales and offsets of this material's texture map later. For now, we will move on to opacity maps.
Opacity maps are used to make transparent areas on surfaces. When rendered, pure white areas of the bitmap image will be completely opaque, pure black areas will be completely transparent and the transparency of gray shades will be proportional to their darkness. Colors take on their equivalent gray-scale values. You can adjust the scale and orientation of opacity maps in the same ways that you can adjust texture maps.
To try out an opacity map, erase the 3D face you used for the texture map and draw a new rectangular facethat is three units long in the x direction and two units long in the y direction. You can use command line input similar to what you used for the texture map but with different coordinates. Then do a ZOOM EXTENTS. The 3D face should almost completely fill the AutoCAD graphics area.
Since we intend to use a background image with this rendering, we need to move the 3D face away from the x-y plane to prevent the images from conflicting; therefore, use the MOVE command with relative coordinate input to move the 3D face one unit in the positive z direction.
Start the RMAT command. Begin another New Standard Material and assign it a name of your choice, such as test2. With the Color/Pattern attribute checked, clear the check box that is labeled By ACI, and move the slider bar for green to a value of about 0.25. This set-up will set the overall color of the rendered 3D face; it has nothing to do with the opacity map.
To set up the opacity map, check the Transparency attribute's radio button and then click the Find File button. Locate the bitmap file named checker.tga, and double click on it to enter it in the File Name edit box for the transparency attribute. With the transparency attribute's radio button still checked, set the value in the edit box near the top of the dialog box to 1.
Click the OK button to return to the Materials dialog box. With the name of your new material highlighted, click the Attach button and pick an edge of the new 3D face when you are prompted to select an object to attach the material to. Press [enter] to bring back the Material dialog box and click OK to end RMAT.
In demonstrating this opacity map, we will also use a bitmap image as a rendering background. Start the RENDER command. Make certain that the Rendering Type is set to Photo Real and click the button labeled Background. This action brings up a Background dialog box that has four radio buttons on its top. Click the button labeled Image and then click the Find File button in the lower-left corner of the dialog box. The file you want will be in the same folder as the material bitmap files, but you will probably have to change the setting of the File Type pulldown list box so that it shows TGA files. Find the file named cloud.tga and double click it. Press the OK button in the Background dialog box to return to the Render dialog box, and press the Render button.
Admittedly, this rendering is not impressive, but it does give you an idea of how opacity maps work. Although AutoCAD has almost no bitmap files that are suitable for opacity maps, it is not difficult to custom-make your own for simulating the panes of a window or a hole through a surface. Use a white AutoCAD background and black as an object color as you make planar surface objects in the shape of the hole you want. Circles do good as round holes, 3D faces work well as rectangular holes and regions can be used for more complex shapes. Invoke the SHADE command so that the surfaces will be black objects on a white background, and save the screen image with the SAVEIMG command to a TGA format. A paint program can be helpful for touching-up and cropping the image, but it is not a necessity.
AutoCAD uses the brightness values of pixels in bump map images to create the illusion of a slight change in height, as if the surface was embossed. Often, a texture map is used with the bump map. Both will have the same image, but the image for the bump map will have lighter colors. You can adjust the scale and alignment of bump maps in the same ways that you can adjust texture maps.
You can use the same three-by-two 3D face for a sample bump map that you used for an opacity map. You should, however, change to a SE isometric view, since the embossed effect of bump maps is not evident when your viewpoint and the lighting is perpendicular to the surface. You can make this change through the View menu, through the View flyout on the Standard Toolbar, or from the command line by entering the VPOINT coordinates of 1,-1,1. We will make two renderings to better demonstrate the effect of a bump map; therefore, divide the AutoCAD graphics area into two vertical viewports. You can do this easily from the command line: enter VPORTS, then enter the number two, then press [Enter] to accept the default vertical viewport layout.
Start the RMAT command to bring up the Materials dialog box. Highlight the material you used for the opacity map and press the Detach button. When you are prompted to select an object, pick an edge on the 3D face and press [Enter]. This action removes the 3D face's association with the material you used for the opacity map.
Start a new standard material, and give it any name you choose. With the Color/Pattern attribute's radio button on, press the Find File button and locate the file bmbrick.tga. It will be in the folder that contains the other bitmap files you have used. Double click its name to bring it into the File Name edit box of the New Standard Material dialog box. Click the OK button to return to the main Materials dialog box, attach your new material to the 3D face and end the RMAT command.
Invoke the RENDER command. We do not want a cloud-like background, so click the Background button to bring up the Background dialog box. Click the AutoCAD Background toggle button and press OK to return to the Render dialog box. Once there, press the Render button to render the current viewport.(The rendering for this figure, however, does have a background color that is most likely different than the one you are using.)
Start the RMAT command again. In the Materials dialog box, highlight the name of your latest material in the list box, and press the Modify button to go into the Modify Standard Material dialog box. Except for its name, this dialog box is the same as the one you've been working with, and it will contain all of your material's current parameters. Click the Bump Map attribute's radio button and use the steps you are now familiar with to locate the file bmbricb.tga and bring it into the File Name edit box. Just above the File Name edit box is an edit box labeled Bitmap Blend. Set its value to about 0.10. Lastly, click the OK button to return to the Materials dialog box and click the OK button to end RMAT.
Make the nonrendered viewport the current one by clicking in it. Start the RENDER command and click its Render button. The bump map, makes a definite improvement in the appearance of the rendering.
Reflection maps simulate mirror-like reflections on shiny surfaces, such as the reflection of clouds on a polished automobile hood. They are not the same as the mirror reflections you can have in ray-traced renderings. Several conditions are necessary for reflection maps to render well: the surface must be curved, the material's roughness attribute must be set to a low value and the bitmap used must have a relatively high resolution. Unlike the bitmaps of the other map types, you cannot adjust reflection map bitmaps.
Since you will need a curved surface for experimenting with reflection maps, you should erase the 3D face you have been working with or else pan until it is no longer visible. We will use the top half of a surface model sphere as our object to be rendered, and the easiest way to make one is through AutoCAD's commands for creating surface primitives. Pull the View menu down, select Surfaces and then select 3D Surfaces. A dialog box with image tiles of basic geometric shapes and a list box containing their names will be displayed. Double click on the name Dome, and in response to the subsequent command line prompts, pick any point for the dome's center, set its radius to about 1.0, specify 24 for its number of longitudinal segments and 12 for its number of latitudinal segments. Lastly, set a SE isometric view or zoom to extents if that is your current viewpoint.
Initiate the RMAT command. Start a new standard material and give it any name you wish. We want a dark underlayer for the reflection map, so with the Color/Pattern attribute checked, clear the By ACI toggle and move all three color slider bars to the left so that they have a zero value. Next, click the Reflection attribute and set the value of reflection to 1.00. In the cluster of buttons labeled Color, clear the Lock button and set reflection color to white by moving all of the color slider bars to their right. Still within the reflection attribute, click the Find File button and bring the bitmap file named cloud.tga into the File Name edit box. That finishes the settings for the Reflection attribute.
Click the radio button for the Roughness attribute and set its value to about 0.30. Return to the main Materials dialog box, attach your new material to the dome and end RMAT.
The information in this column, coupled with that in the last, gives you good, basic knowledge and experience in the use of bitmap files as maps and as backgrounds in renderings. Now, what you need to do is to put that knowledge and experience to work in making better and more realistic renderings from your 3D models.
In her easy-to-follow, friendly style, long-time Cadalyst contributing editor Lynn Allen guides you through a new feature or time-saving trick in every episode of her popular AutoCAD Video Tips. Subscribe to the free Cadalyst Video Picks newsletter, and we'll notify you every time a new video tip is published. All exclusively from Cadalyst!