Mechanical Simulation

Technical Memo755 Phoenix Drive, Ann Arbor MI, 48108, USA
Phone: 734 668-2930 • Fax: 734 668-2877 • Email: info@carsim.com

carsim.com

3DS MAX: OBJECT and OPEN
SCENE GRAPH Setup and Export
3DS Max is a 3D modeling software, which, when used properly, has the capacity to set up
and export objects (OBJ) and open scene graph (OSG) files to the VS Visualizer. The purposeof this document is to walk through basic setup and export processes of these particular filetypes, that can be used with the VS Visualizer to create advanced render features. This
document assumes you will be using version 2015 of 3DS Max. Later/Earlier releases have notbeen validated by Mechanical Simulation Corporation.
NoteThis document assumes you have a basic knowledge of 3D modelingand basic knowledge of UV/texture setup in 3DS Max.

Before You Start
Below is a list of general guidelines and best practices to get your asset set up prior toexporting. These are good habits to get into to avoid potential shading and converting issues.
········

Maintain good edge flow, such as avoiding long tri’s and pinched geometry
Set display units and system units to metric (meters)
Proper UV layouto Every face should have some form of UV layout, and no uvs collapsed to zeroo Checked for overlapping or inverted faces and correct orientation
Welded verts
Reset xform
Zero out transforms
Set the Diffuse and Ambient color swatches of your materials to white in the material
editorCollapse stack

3DS Max OSG Plugin
The 3DS Max OSG Exporter can be downloaded here:
http://sourceforge.net/p/osgmaxexp/mediawiki/Main_Page/
Documentation for the OSG Exporter and how to use the OSG helpers can be found here:
http://sourceforge.net/p/osgmaxexp/mediawiki/Documentation/

1/6

December 2019

Here is a list of the OSG helpers that have been validated in the VS Visualizer.
····

BillboardStateSet
OccluderLevel of Detail (LOD)

Standard OBJ and OSG Shape Setup
Both OBJ and standard OSG files are set up the same way, and use the same texture naming
convention. All UVs are on channel 1 in 3DS Max.
Note

Only the base diffuse map is assigned in 3DS Max with a standard
shader. All other textures are optional and are loaded automatically
based on the below naming convention.

Given a referenced base diffuse texture within the OSG file named“example_texture.tga”, you can provide the following override textures beside it:····

Base Diffuse (example_texture_di.tga)
Normal Map (example_texture_nm.tga)
Light Masks (example_texture_lm.tga) have a grayscale effect on lightcontributions per pixel.
§ Red Channel- diffuse (mask for primary light)§ Green Channel – specular multiplier. Also multiplies by object
shininess when computing lighting§ Blue Channel- ambient (ambient occlusion)
Fresnel (example_texture_fr.tga)
o Fresnel maps affect the reflectivity of an object.
§ Red Channel = Power – How sharply reflections ramp up with respect
to viewing angle to the surface normal.
§ Green Channel = Scale – The amount of reflectivity added, controlled
by the viewing angle and Power.
§ Blue Channel = Bias – The amount of reflectivity that is always
present, regardless of viewing angle.
§ Alpha Channel = Alpha – The alpha is used to scale (or mask)
reflectivity.
o The Fresnel Term is computed by adding the computed Scale and the Biasvalue. If the term is 0.0 there is no environment reflected, and if the term is
1.0 the pixel will be fully reflective.

2/6

Advanced OSG shape setup
With the OSG format you can access an advanced multi-texture shader that uses three UVchannels for blending multiple diffuse textures and a normal map (Figure 1). The first channel
is for the base diffuse texture , the second channel is for the blend diffuse
and the thirdchannel is for the normal map . This will allow you to have a very tightly tiled base-diffuse(UV channel1) with a larger tiled blend-diffuse (UV channel 2) to break up the repeat
patterns. The normal map (UV channel 3) can be matched to the base diffuse or tiled
differently to add more variety to your material. The Light Mask (lm) and Fresnel (fr) textures
are optional and use UV channel 1.
·····

Base Diffuse (example_texture_di.tga) uses UV channel 1
Blend Diffuse (example_texture_di1m.tga) uses UV channel 2 and ismultiplied over the base diffuse texture
Normal Map (example_texture_nm.tga) uses UV channel 3
Light Mask (example_texture_lm.tga) also uses UV channel 1
Fresnel (example_texture_fr.tga) also uses UV channel 1

To get the OSG file to export with the 3 UV channels, the use of a mix node plugged into thestandard shader diffuse color channel is required. The base diffuse texture will be assigned tocolor 1, the blend-diffuse assigned to color2
and the normal map assigned to the mix
amount .

Figure 1. Blending multiple diffuse textures.

3/6

Alpha Blending
The VS Visualizer currently supports two modes of alpha blending, standard and on/off. Youcan manually set the mode by placing objects into specific renderbins.
1. Standard alpha blending (bin name DepthSortedBin)a. The objects are sorted back to front by the object’s center point before
rendering. This could cause issues with large objects, or objects close enoughthat the center point doesn’t provide enough information to properly sort fromevery angle. This would manifest by objects appearing to flicker in front ofeach other, depending on view angle.
b. Z buffering is disabled
2. On/Off alpha-blending (bin name OnOffAlphaBin)
a. The objects are not sorted before submission to the hardware. The result isthat no blending occurs, pixels aren’t written unless they’re at 1.0 alpha(completely opaque).
b. Z buffering is enabled

Figure 2. OSG Exporter Helper Node (formatted to fit on page).

OSG Exporter Helper Node
Objects are put into the standard DepthSortedBin by default. Any objects intended for use
with On/Off alpha should have the bin appropriately named , as in items 1 and 2 above. Thebin number
only matters for manually setting their render order. An object’s render bin canbe manually specified by using the OSG StateSet helper node in 3DS Max. Just create theStateSet node, add your object, assign a number and add the bin name (OnOffAlphaBin) .
4/6

NoteYou may need to create manual mipmaps with On/Off alpha, as theautomatic mipmap creation will blend the alpha into the object, which
can make it appear to shrink as lower mip levels are used.

Exporting
To properly export OBJ from 3DS Max, the following settings need to be applied (Figure 3).
If these settings are not checked and configured properly, things will not import correctly, andissues will arise. Please check your settings, and confirm the below boxes and fields are filled
in or populated as shown.

Figure 3. OBJ Export Settings.

Figure 4. Objects and textures file structure.
Note

All your objects and textures should be placed in the same folder asobjs.

5/6

Figure 5. OSG Export Settings (formatted to fit on page).
Note OSG files should have images in an images directory at the same level
as the OSG file.

Figure 6. OSG file structure.

6/6