Productivity Corner: Make Your Renderings Look More Realistic14 May, 2005 By: James Dyer Cadalyst
MicroStation's lighting and materials options help renderings look more like photos
Last month's column explored MicroStation V8's rendering capabilities, primarily basic rendering of images and rendering methods.
This month's Productivity Corner will expand our exploration with an introduction to lighting and materials. Lighting techniques are the most significant contributor for achieving more photorealistic results. With the correct illumination, a 3D scene looks alive and 3D.
MicroStation uses source and global lighting types. You may apply source lighting by placing special cells in a model, which I'll cover later. Global lighting is available for all models within a DGN file. You may control the global lighting parameters with the Global Lighting dialog box.
As you begin using the design visualization tools of MicroStation, choosing the rendering method and experimenting with the results is quite common. However, the results can be very unpredictable. Sometimes, the default global lighting parameters for a given model are configured well enough and provide acceptable rendering results.
Global Lighting Types
MicroStation provides three main global lighting sources within each and every DGN file: ambient, flashbulb and solar. Additionally, you can introduce lighting sources for sky lighting to solar and distant lights. Let's briefly explore the effects of each global light source type.
Ambient light illuminates all surfaces equally. As mentioned above, the settings are controlled in the Global Lighting dialog box (figure 1). The intensity of ambient light can be adjusted from None (0) to Full (1.0). Additionally, you can control the color parameters of the ambient light. You may include or exclude the effects of the ambient light at the material level by setting the material's ambient property. Materials with ambient values equal to zero will not illuminate by global ambient light regardless of their intensity settings. Due to the fact that ambient light illuminates all surfaces equally, you can reduce the depth, or contrast, of the shaded view by increasing its intensity (figure 2).
Figure 1. MicroStation's Global Lighting dialog box.
Ambient light does not cast shadows in the resulting image. That said, ambient light simulates background lighting or illuminates surfaces that would not otherwise receive light.
Figure 2. Ambient lighting with intensity set to 0.20.
Normally you would turn off global ambient lighting when producing radiosity and particle tracing renderings. If you forget to turn off the ambient lighting, an alert box gives you this option prior to rendering. Ambient lighting by itself is not meant to be the main source of lighting. However, it may be used, in conjunction with other lighting, to add background light to materials that have an ambient setting above zero.
Flashbulb global lighting is quite different from ambient lighting because it provides a single-point light source. In a similar process to adjusting the ambient lighting, you control the lighting parameters through the Global Lighting dialog box. You can adjust the intensity of flashbulb light from None (0) to Full (1.0), as well as its color. Flashbulb lights also will not cast shadows within the model (figure 3).
You may experience hot spots on highly specular and reflective surfaces with flashbulb lighting. Hot spots will likely appear where the camera directly opposes these surfaces.
MicroStation needs to calculate a new ray trace solution for each frame when your camera is moving through a scene and rendering animation frames. Should you wish to use flashbulb lighting for such cases, consider the additional processing time required for each frame in the animation. If you are animating a camera through a scene, turn off flashbulb lighting. The exception to this case is when other objects, materials or lights are animated -- as with using the flashbulb lighting, MicroStation needs to compute a new rendering solution for each frame.
Figure 3. The effect of flashbulb lighting off (left) and on (right).
With ambient and flashbulb lighting, the images are missing shadows. Since neither ambient nor flashbulb lighting produce shadows, you will need to use the solar lighting type (figure 4) to cast shadows within the model.
Solar intensity and color settings automatically become active when you incorporate solar lighting in your model. To control the solar parameters simply expand the Solar section of the dialog box by selecting the Show Solar Settings button, located to the left of the Solar toggle, to reveal more solar lighting settings.
Figure 4. Global lighting dialog box, fully expanded.
You can control solar lighting parameters by adjusting the solar direction using azimuth angle and altitude or by entering the month, year and time of day (provided you know where the model is on the planet). Simply pick a large city near its location, and MicroStation determines your longitude and latitude, as well as set the appropriate time zone. Setting the time, date and location is a great method for producing a relative rendering. However, setting the azimuth and altitude angles to adjust the solar direction vectors is perhaps the easiest way to get the light to shine exactly where you want.
MicroStation's design visualization capabilities let you create photorealistic images of your designs. In order to create these images, you need to apply materials to the elements in your models. Assigning materials makes your designs more realistic than just adding.
MicroStation relies on two types of files for material definitions and assignments: the palette (PAL) file which stores the material definitions and the material (MAT) file, a material allocation table that references the palette files and records the assignments by level/color.
The palette and material files are both ASCII text files, which makes them easy to modify. Typically each DGN file has one MAT file that references one or more PAL files -- so you can store similar materials in separate palette files. Therefore, you can easily categorize your palette definitions in separate files.
When you render a 3D scene in MicroStation, the surfaces are rendered using the element color of the currently attached color table unless an associated material file exists. Of course, you can customize the color table to change the appearance of rendered images. The changes to the color table automatically apply to any rendered image where an assignment from a palette file has not been made via a material file.
When assigning materials I recommend linking the assignment with the element level and color, which assigns the same material to all of the elements of a particular color on a particular level (figure 5). The combination of the palette file storing the material definitions and the material table storing the assignment information defines the material associations rendering result.
Figure 5. Materials Assignment dialog box.
In addition to the level/color material association method, MicroStation lets you attach material definitions directly to the elements (figure 6). When you assign materials to a specific element, the element renders with the attached material regardless of the element's color or level. The only requirement is that MicroStation must have access to the attached material's definition. If the reference file is not available, the element renders in its native color. If a material is attached to an element, the element material takes priority over materials assigned by level and color. There are many advantages of attaching materials over assigning materials by level/color. What many people do is create a cell library with the materials attached to the geometry for each given cell. The resulting cells render properly without concern about level and color assignments. Of course, MicroStation must be able to find the definition of the material attached to the cell geometry to render the geometry properly.
Figure 6. Materials Assignment option.
Occasionally you may need to change a material that was created and assigned, or you may need to find out which material is assigned to an element. The Query Material tool can identify the current material assignments or attachments.
Removing Assigned or Attached Materials
Finally, sometimes you need to remove the association of a material to one or more elements within your model (figure 7). When you have material assignment by color/level, changing geometry color or level could leave you with a level/color assignment that is no longer relevant.
Figure 7. Materials Removal option.
As an alternative, you can right-click on the material assignment or attachment in the Material Editor list box and select Delete from the menu to remove unwanted assignments or attachments.
The more you explore MicroStation's built-in design visualization capabilities, the more the possibilities will reveal themselves. We only scratched the surface of the power you have at your fingertips. We will explore more of the 3D modeling and design visualization concepts and power of MicroStation in the future.
Until next time -- enjoy MicroStation!
Cadalyst's MicroStation tips included in "Productivity Corner" are compiled by James Dyer and were tested using MicroStation V8 2004 edition. Cadalyst welcomes MicroStation tips: E-mail them to firstname.lastname@example.org. By submitting a tip or code, you grant Cadalyst magazine the right to print and distribute your tip or code in print, digitally and by other means. Cadalyst magazine and the authors retain the rights to the tip or code, which are not to be downloaded or copied for commercial use.