Rendering with Realism

[Editor's Note: Jason is making tutorial files available for this article through his web site, www.jase.ca. You can go there to download the files and see additional information.]

With all the effort that goes into creating your CAD models, it is a shame not to render them to visualize the finished product in your proposals and presentations. This article is meant to help you do just this, first explaining how to export your data and then providing a short tutorial on how to render your models realistically. Hopefully, this information will either encourage you to learn more about rendering yourself or provide basic understanding about what happens behind the scenes if you contract out this service.

There are many rendering packages available, ranging in cost from $300 to $10,000. For purposes here, I have chosen to use LightWave 8.5 from NewTek. LightWave is quite reasonably priced at $795 and is currently undergoing a major upgrade. Other products I suggest looking into are Maxon's Cinema4D, Autodesk's 3D Studio Max, and Caligari's trueSpace. All of these products offer reasonable import/export options and have capable rendering platforms.

I have purposely left PTC's Pro/PHOTORENDER off this list. In my opinion, the product is not mature enough and does not provide the typical tools to deal with alpha masks, multiple textures, global illumination, and the like. In addition, the material functionality is a bit weak and the software cannot maintain your model display in OpenGL.

Preparing Your Models

One of the biggest tasks in the rendering process is exporting your models from Pro/ENGINEER to your rendering application. For small parts or even small assemblies (say a 10-part assembly), you can just use the .slp, .stl, .obj (wavefront) export. But these formats do not support hierarchies. Since most rendering applications support the .obj and .stl formats and recognize distinct parts, however, you can recreate the hierarchy in the renderer.

For the options that deal best with Pro/ENGINEER files, I recommend either PolyTrans from Okino (www.okino.com) or Deep Exploration from Right Hemisphere (www.righthemisphere.com). Both products allow you buy modules to support Granite so that you can natively open and convert Pro/E files.

Assembly Organization (Reps and Datums)

Assemblies are generally what you'll want to render. But assemblies contain a tremendous amount of information, not all of which is necessary. The following list presents the minimum set of simplified reps that your assemblies should contain. From here you can build on your requirements.

·       All parts. You can, however, skip seals, fasteners, labels, and unimportant hardware (like crimps, and other small items).

·       Piping only. If your assembly has piping, create a rep that contains all the piping, including fittings within the piping run.

·       Fasteners only. In most shots, the fasteners are barely visible so you can treat them separately and possibly even omit them. If you need detail to represent fasteners, you can export this rep and reduce the polygon count by increasing the chord height or within your translation software.

You want to group assemblies of components by either function or material, or some mix of the two.

1.      Function. This grouping is typically shared assemblies that work together. For example, the front suspension of a car would likely include both front wheels and the rack system so you can easily link them together.

2.      Material. This grouping is for ease of applying a specific material to more generic types of parts such as piping, fittings and fasteners. I use this grouping to deal with low-detail items.

Grouping is a grey area, but here are some useful guidelines to bear in mind.

·       Keep your subassemblies manageable so you can work on a specific subset and keep the render application responsive. You should be able to turn everything off from display but still work on a specific subset of models.

·       Make groupings easy to replace so that they are quick to update when CAD models change.

·       Simplified reps are a good way to group assembly items across different levels of a BOM structure.

Part Organization (More Reps)

Following the example of assemblies, we can use simplified reps for parts as well. The ideal candidates for simplified reps are fastener parts and parts utilizing hole, rounds (fillet), or chamfer features. The idea is to limit the number of features shown at the assembly level. For example, our bolt fastener models need a rep to exclude the shaft because all we see in many instances is the head. For parts using many rounds, holes or chamfers, you can exclude these features as well if they won’t be visible. 

It is far easier to implement this methodology using start parts or company standard practices.

Formats for Exporting from Pro/ENGINEER

·       Native Format (Using a third-party translator). Using native geometry is preferable, BUT! Yes, there is a but. The downside is that you will be dealing with unprocessed data. If you have a large assembly, importing and exporting the data is very time-consuming. I therefore recommend using the native format only for smaller assemblies.

·       STEP Format (Using a third-party translator). If the translator supports the Granite kernel, you will have access to STEP. I prefer STEP because it handles geometry the best and maintains the hierarchy within one file. STEP retains models as solid geometry. Ideally, you can break your assembly into logical groups using simplified reps and then export the groups with a consistent coordinate system.

·       IGES Format (Using a third-party translator). While most translators support IGES, you need to ensure that the one you choose supports the latest version and can handle trimmed as well as untrimmed surfaces. Like STEP, IGES is useful because you can export and retain hierarchy and utilize simplified reps.

·       Native Triangulated Formats (Pro/ENGINEER direct). Exporting triangulated formats is the last resort reserved for small parts or assemblies of very limited size. But if you need to do part replacement, this can be a quick fix. If you want to do an individual part export with the .stl or obj format, there are a couple of things to consider.

-        Use a consistent coordinate system. This will allow easy reassembly in the rendering application.

-        Experiment using the chord height and chord angle options. These options control your mesh (triangle) density.

·       VRML. You can experiment with VRML, but be prepared for some oddities and frustration. In my experience, I have not seen any applications that properly support Pro/ENGINEER Wildfire's VRML 2.0 export. In addition, the VRML export creates extra objects.

The Export Process

Prior to exporting, you should give some thought to what your requirements are. Although you will inevitably need to do some organization and cleanup in the rendering application, organizing your data beforehand can eliminate a lot of problems.

First off, if you don't have a third-party translator, you are very much restricted to the native import types of your render engine—typically IGES, .stl, .obj, 3ds, and a few others. The native IGES implementation in most rendering software cannot deal with large assemblies and is often problematic, so do not count on it. Since the 3ds format is not available from Pro/ENGINEER, that leaves .stl and .obj. Almost every rendering application supports these formats and will have a free script to allow those types if they aren't natively supported.

In general, I export my Pro/ENGINEER data to a neutral format such as IGES, STEP, or Pro/E Neutral. This lets you quickly modify an assembly without fear of conflicting with parent/child relationships. To do this, you can reuse Pro/ENGINEER (or your native CAD tool) to import the file back into session. Then you may edit the assembly. I then export the file to the rendering application.

 

A Primer of Rendering Terms and Techniques

For those who are new to rendering, this section describes some basic terms and techniques.
(Click here to view...)

 

Now on to Some Rendering!

In our example, we're going to use LightWave rendering software (discovery edition available by contacting NewTek sales www.NewTek.com). Although undergoing major updating for release 9, this is still one of nicest renderers around. It is extremely cost-effective and yields good results quickly. At the end of this article are a few of the many resources available on the web to get you going with LightWave.

Open the file torch.asm in Pro/ENGINEER. You will see that each major portion of the model has a part. When we convert our assembly for use in LightWave, we want to maintain this hierarchy. You may want to export from Pro/ENGINEER in the wavefront format and open these files within LightWave directly to fully understand the export process and mesh details. In this case, however, I chose to import the native assembly file into Nugraf (PolyTrans is the same without the renderer) to convert to the LightWave scene file. I have included the .bdf file for you to open within PolyTrans (demo available at www.okino.com). 

Mesh versus speed. At this point, we need to assess what end result is required of our render. The part files have chamfers and small details. To maintain those details in the rendering, we need to ensure we are bringing a highly defined polygon model, which means more polygons. Basically, we can output the models for one of two purposes:

1.                Up-close product shots. This output has a high polygon count. For these types of renderings, we want to maintain edge detail.

2.                General rendering or ”set” pieces. This output has a low to medium polygon count and is suitable for use in a large assembly rendering that won't be close to the camera. In this case, if you add auxiliary models to the scene to help break up the dead space, keep poly counts minimal.

Scene lighting and setup. For the most part, you can use area lights to mimic studio lighting. Spotlights are another choice because they allow you to create soft shadows. Area lights do this as well, but I find the glow property of area lights more pleasing. Experiment to discover what your own preferences are 

The most famous (or infamous) scenario is called three-point lighting, which illuminates the object with:

1.      Key light. Provides the main illumination and typically the shadow caster.

2.      Fill light. Adds a gentle amount of light to break up dark areas or shadows.

3.      Rim light. Used behind the object to illuminate its silhouette, helping to separate the object from the background. 

Three-point lighting can be a starting point and you can add your own variation. In this sample scene, I want to use soft lighting and shadows.

 

 

As for setting up the scene, I encourage you to do some research on composition. One basic principle is to avoid placing your object dead center, but instead follow the “rule of thirds.” This means dividing your picture into three columns and rows, and then placing the object a little above, below, or to the side to keep the focus where the three rows and columns intersect. In this scene, I placed the object slightly above the horizon to bring attention to the light shining through the flashlight. This also leaves a little space to add specifications or logos for a branding shot.

 

 

Scene setup requires careful thought. In reality, you will have set gear, people and such around a photography shoot, so you need to compensate for this. In our example, we are dealing with reflective materials so they need something to reflect. We could, for instance, add abstract shapes with color to simulate drapes, or set gear like posts, chairs, and the like.

 

In this case, I added two “bounce” cards, which are commonly used in product shots. Bounce cards not only act like fill lights, but also give the object something to reflect.

 

 

To get our scene set up in LightWave,

1.      Select File->Load Scene to load the torch_orig.lws.

2.      Click Shift +c to select the camera. Then, using the coordinate manager on the bottom left, set its position.

-        Hit t for translate and enter the coordinates as x=-71.68m, y=43.82m, z=-82.25m.

-        Hit y for rotate and enter heading=-0.6, pitch=76.9, bank=0.

This sets up the scene for our camera. If you want to experiment, I recommend you save here first. Lighting is extremely view-dependent, so revert to your saved scene before continuing. 

3.      To set up the lighting, we'll convert the existing light to an area light. Remember: the larger area lights are, the softer their shadows but their output level must also increase.

Select the light either by using Shift+l or by selecting the light button at the bottom of the screen and then using the drop box. Once the light is selected,

-        Hit t to translate and enter the coordinates in the bottom left input boxes as x=15.5, y=134.25, and z=-21.55.

-        Hit y and enter h=15.5, p=134.25, b=-21.55.

-        To size the light, hit h and enter x=52, y=48.67, z=1.

-        Hit p for properties and enter the values shown.

 

 

4.      To adjust the flashlight, select the objects button at the bottom and, with the selection tab above, select torch.asm.6. Hit t to translate and enter 6.9m in the coordinate box. 

5.      To add the floor, use File->Load Object and select floor.lwo. 

6.      We can set up the fill light, rim light, and bounce cards. First clone the area light by selecting it and the hitting Ctrl+c.

-        In the clone item dialog box, enter 2.

-        Select one of the clones and enter the coordinates for its position as x=-7.9, y=-3.4, z=-90.7 and then its rotation as h=10.4, p=6.6 and b=0.

-        With the light still selected, hit p for properties and enter the values you see below.

-        Change to the shadow tab and make sure shadows are off.

 

 

-        Now select one of the other clones and enter the coordinates as x=-41.7, y=90, z=123.6, and a rotation of h=-203, p=23.6, b=0.

-        Modify the properties (hotkey p) and then enter the properties below. Be sure to note this light becomes a spotlight.

-        Change to the shadow tab and ensure shadows are off.

 

 

7.      The last lights we’ll set up are for the flashlight. Activate the Items tab and from the lights tab, select a point light.

-        Set the point light position as x=-5.75, y=7.05 and z=0.

-        Enter the light properties page and input the settings below.

-        Open the objects tab and tick the same items shown below.

 

 

8.      The next light is for the beam itself. Create a spotlight now and

-        Enter its position as x=-5.75, y=7.05 and z=0.

-        Enter the rotation as h=-90, p=0, b=0.

-        Enter the properties page and enter the properties below.

-        After enabling the volumetric lighting option, click the volumetric light options and enter the values below.

 

 

The idea of the point light is to illuminate inner components locally and to allow the glow to penetrate through the holes because the stud part is translucent. 

9.      Save your work now before creating the materials for the components. (Although I've created the materials for this example, we will tour through the settings to create the final render.) 

10.    Open the surface editor, using the F5 key, and set up the view to use scene materials. LightWave allows you to adjust all like-named materials in one interface.

 

-        Aluminum_powder material: For this material, I wanted to do a glossed speckled material with a high reflected specular. Some key areas of note are the blurry reflection and reflection falloff due to the fresnel effect. The gradient texture is very powerful, and I like the way NewTek has put this feature in LightWave. The bump adds to the texture and assists in breaking the reflection.

 

Aluminum basic properties

 

-        Color is a basic setting, which you then modify based on the values in diffuse, reflection and such. What you will notice is that the diffuse, specularity, reflection, and bump values are driven by a texture (highlighted T box). Click these boxes to modify them. When the textures are activated, the values in the named boxes usually have no effect.

 

Aluminum advanced properties

 

-        Under the advanced tab are two properties of note. First is “Alpha Channel,” which is set to “Surface Opacity.” This is important since LightWave will render an alpha channel that shows this material as white, so we can use it to block out the object in an image editor. Second is “Color Highlights,” which allows the material’s highlights to take on the color of the material.

 

Aluminum environment properties

 

-        Here is where we set the reflection blurring. The “Reflection Options” is noteworthy because we could instead use an image map to produce reflections rather than the time-consuming ray tracing.

 

Aluminum shader properties

 

-        The shader tab allows you to add rendering enhanced features like fresnel, brdf, and celshading effects. Here I've added a quick fresnel effect to the material.

 

11.   Using the above panels you can explore other materials. In particular, pay attention to the stud, which has a translucent value. Turn this off and render the scene. The fact that it allows light to pass through it explains why the little holes glow.

Advanced Features

To whet your appetite for further experimentation with rendering, let’s add some radiosity to our scene.

1.      Hit Ctrl+F5 to open the backdrop options.

2.      Select Add Environment and then the image world option.

3.      Double-click this option and browse for uffizi_probe.hdr.

4.      Select lights from the bottom buttons and then open the properties page.

5.      Select global illumination and then enable radiosity. Set the options as shown.

 

 

6.      Hit F9 and take a break because rendering takes a while. What you will notice is the backdrop actually lights the scene. If you had used the monte carlo option, the light would instead bounce from other objects.

The two images below show the alpha channel produced by the rendering and then the modified alpha so we can adjust the flashlight.

 

Unmodified rendered alpha

 

Modified rendered alpha

 

Rendered image

 

Modified rendered image

 

Notice the color shift in the rendered images. The image was edited in Adobe Photoshop without having to render the image over again.

 

LightWave Layout Shortcuts

p

Item properties

F5

Surface editor

m

Motion properties

Shift+o

Objects

Shift+c

Camera

Shift+l

Lights

Ctrl+F8

Image processing

Ctrl+F5

Backdrop options

 

LightWave Resources

Here are just a few of the many online resources geared toward LightWavers.

http://www.NewTek.com/LightWave/—main page for LightWave

http://www.NewTek.com/forums/—NewTek-sponsored forums

http://www.NewTek.com/LightWave/tutorials/—extensive list of NewTek-hosted tutorials

http://members.shaw.ca/LightWavetutorials/Main_Menu.htm—mega list of learning material for LightWavers, managed by a LightWave user

http://www.spinquad.com—online forum

http://www.simplyLightWave.com/—online forum and training resource

 

Other Resources

Jeremy Birn's Lighting: http://www.3drender.com/light/index.html

HDRI making tutorial: http://www.luminous-landscape.com/tutorials/hdr.shtml

Paul Debevec (a defacto in HDRI): http://www.debevec.org/

 

Jason Clark is an engineering visualization consultant with his company Jase Design. In addition Jason is a senior designer and PTC applications administrator at OceanWorks International, Inc. Jason can be reached by email at jason@jase.ca or jclark@oceanworks.cc.

Rendering with Realism

Setting the Standard

CADTRAIN Goes to PTC University

Prove Your Mettle in the 2006 PTC Awards Competition

PTC Executive Meeting Summary: Progress Continues

Generating a 3D PCB in Pro/ENGINEER

Creating Flexible Components in Pro/ENGINEER Wildfire

Planning Your Upgrade from Pro/INTRALINK 3.x to 8.0

Logging System for Developing in Windchill 8.0