Render a SolidWorks Model in Maya

A Wikibookian believes this page should be split into smaller pages with a narrower subtopic.

You can help by splitting this big page into smaller ones. Please make sure to follow the naming policy. Dividing books into smaller sections can provide more focus and allow each one to do one thing well, which benefits everyone.

SolidWorks is one of the main product design solid modellers. It has a built in render engine called PhotoWorks. With the release of PhotoWorks 2, rendering within SolidWorks has become more realistic and easier. In a lot of cases PhotoWorks will be the most convenient way to render your model, because you don't have to leave SolidWorks. However, in some cases you will find the need to make renders that are more realistic (or even photo-realistic), and PhotoWorks is not sufficient anymore. This is when you might consider using an external program for rendering. In this how-to, I will describe how to do this using Alias Maya with mental ray. I will be doing this with SolidWorks 2005 and Maya 6.5, but it will probably work in most other (recent) versions aswell.

Before you can import your model into Maya, you need to export it to the IGES format first. In this how-to I will describe how to do this with an assembly, but it is essentially the same for a separate part.

Open your assembly.

If you don't want to export all the objects, select the objects that you DO want to export first. If you want to export the complete assembly, don't select anything.

It is recommended that you now close SolidWorks for better performance. We'll now import the exported IGES data into Maya. It will probably look like a mess, but don't worry, we'll get to that.

Start Maya.

Go to File > Open Scene..., locate your IGES file and hit Open. Note: large assemblies can take Maya a while to convert, so be patient!

Note: If Opening an IGES file is not available, you need to enable the plug in as follows.

Select Window > Settings/Preferences > Plug-in Manager to display the list of all known plug-ins. Click the loaded or auto load check box to load one of the ge2Export.mll, or ge2Export.so, or ge2Export.lib and igesadd.mll plug-ins.

As you might or might not see, Maya will have quite a lot of duplicate parts and some settings need to be changed as well. Because this can be quite a lot of work, we'll do this by using the following MEL-script:

Click the "Change Image..." button and locate the icon you just downloaded.

Hit close and VOILA! There you have your very own SW-cleanup button!

Now you can finally cleanup your scene: simply press the button you just created. This button will still be there the next time you start Maya, so it'll be much faster next time. important note: If you imported a part model and not an assembly, you won't have duplicate geometry, and you don't have to cleanup the scene either!

If everything has gone well, you will now have a clean version of your SolidWorks model in Maya. Time to save!

Because the aim of this how-to is to get you started on photorealistic rendering, we will be using an HDRI environment. HDRI stands for High Dynamic Range Imaging, and is basically a technique to use a picture of the environment for lighting your scene. This will result in very realistic and convincing shadows, higlights and reflections. This is very important for realistic emulation of chrome for example.

You will now see how the texture is connected to the mental ray IBL node in the bottom of this window:

Now go to Create > Color Utilities > Gamma Correct

Drag the gamma node to a convenient location, so that you can still see the "file1" node, and the "mentalrayIblShape1" node; preferably between these two. You can zoom / pan in the views with the standard camera controls.

Select the "out"-arrow at the right bottom of the "file1"-node, keep pressing it and go to outColor > outColor.

Click on the "in"-arrow on the left bottom of the gamma node and select value. You have connected the "file1" and the "gammaCorrect1" nodes with a green line.

Connect the outValue of the "gammaCorrect1" node (outValue > outValue) with the color of the "mentalrayIbleShape1" node in the same way. If you have done everything as described, you should see something that is connected like this:

Now you can adjust the gamma of the HDR image. If you don't do this, your renders will be extremely bright in most cases.

Click on the gamma node to select it. The properties open in the Attribute Editor (in the main Maya screen).

Set all three gamma values to 2.2

Normally a gamma of 2.2 will do fine, but if you still think it is too bright (or even too dark) after you render the scene (we'll get to that later) you can always go back to this node and adjust the values: a higher value means "darker", and a lower value means "lighter".

As a final step in this part, you need to turn off the default light. This is because Maya places a light in the scene if there isn't already one. Apparently Maya doesn't recognize our IBL-node as a light, so you have to turn it off manually - otherwise your scene will be overexposed.

Go to the Render Globals window

Select the "Common" tab.

Turn off "Enable Default Light" at the bottom of this window (you may need to scroll down).

We've now imported the SolidWorks model into Maya and set up an environment for it, so we're ready to assign materials to our model. It will not go into deep detail of how exactly you should tune your shaders - that's beyond the scope of this how-to - but it will provide you with a good basis to start from.

Right now, your model doesn't have any materials assigned to it, so when you render it, it won't be visible. Because it's more convenient if you can see the complete model when you test-render, we'll assign a temporary, bright and shiny material to the complete model. We'll also create a plane for the model to lay on.

The first material we'll create will be plain plastic. We'll apply this material to the middle part, the gas regulator and the push button. Whenever you're going to create a new material, think of it in terms of how much it should reflect, how much it diffuses light, how transparant it is etc. because these are your parameters within Maya.

To create the plastic material:

Open the Hypershade window.

Create a Blinn material just like you did before. Blinn differs from Lambert for example (which is the standard material in Maya) that it has a reflectivity parameter.

Set the Color to black (not completely! set the slider at about 5%).

Set the Eccentricity to 0.175

Set the Specular Roll Off to 1.000

Set the Specular Color to 100% white

Set the Reflectivity to 0.400

If you're not sure about the settings, you can look at the picture beside this text on the right. You have now created a material that is a bit reflective, but with sharp, bright highlights. I strongly encourage you to play with these settings, and those of other materials; it will learn you what parameters you need to quickly set the material/look you are after. To apply this material to the middle part, the gas regulator and the push button, select these first. Normally these would be easy to recognise in the outliner (Window > Outliner...), because they get the same name you gave them in Solidworks. In this example (the lighter), the creator of that assembly didn't give names to the parts, so you'll have to browse through the Outliner. Watch out! If you select the parts in the viewport, there's a big chance you'll miss some faces, so in most cases you should use the Outliner for selecting. In this case it's Part020, Part017, Part013 & Part015. Use CTRL click to select all of these together. Now go back to the Hypershade, right click on your new black material and drag your mouse to "Assign Material To Selection".

The metal part needs to be nice & shiny, so we'll make a chrome-like material for that.

Again, go to the Hypershade

Create a Phong material.

Set the Cosine Power to 5.000

Set the Specular Color to 100% white

Set the reflectivity to 1.000

Assign this material to the metal part - Part014 in the Outliner. Chrome is quite a difficult material to make, because you're all dependent from you're environment - it's nearly "all" reflections. Because we have the HDR environment, that problem is not so big anymore, but to make it more convincing, it would need more reflections from things that are closer to the lighter. It could be the table it's lying on or the person that is watching it. Right now it's lying in an empty street on a completely homogenic plane. Anyway, you can check the results, I think this looks quite realistic already. You really need to experiment with the settings for each material to make it work, and if you really want realistic images, you would probably want to apply a texture to the plane it's lying on.

As stated before, to make it make the lighter more realistic, it needs a realistic environment. We already made part of this environment with the HDR-image, but to make it even more convincing, we're going to turn the ground-plane into a realistic looking table. We need an image of wood to apply to the plane. I'll use one from Mayang's Free Texture Library, called "parallel wooden planks".

In the Hypershade, select the "Lambert1" material

Go to the Attribute editor and click on the checkered icon next to the "Color" option.

Choose "File" and load your texture into the "Image Name" field (click on the folder icon)

You can now see a preview of the texture in your viewport (if not, press 6 while in the viewport)

In my case, the lighter was not really fortunate positioned, so I selected everything in the outliner and dragged the lighter a bit back

If you render now, you will see it has become quite realistic! Tune your materials a bit more and tweak your mental ray settings, and no-one will be able to tell it from real.

In general, setting mental ray's render quality to a lower quality level is appropriate while you are tweaking your materials, changing camera angles, and any other process that may require repeatedly rendering your scene. But when you are relatively satisfied with how it looks you can then switch your mental ray settings to a level appropriate for production rendering:

Either click the render settings button (black clapperboard icon with the two radio buttons) or go to: Render > Render Current Frame > []

On the "Quality" tab, change the quality preset dropdown to "Production"

On the "Indirect Lighting" tab, under the "Final Gathering" heading, check the box to enable Final Gathering

The default accuracy of 100 is usually insufficient. Raising this to 256 is usually a good place to start

If, at 256, you are getting spotty artifacts in your render, try raising the point interpolation to 30

If you have multiple layers of transparent geometry, it may be necessary to raise the reflection, refractions, and trace depth under "Final Gathering Tracing"