Software: 3ds max 2020 | V-Ray Next | Unreal Engine 4.25
This post details basic steps and tips for exporting models from 3ds max & V-Ray to Unreal Engine using the Datasmith plugin.
The Datasmith plugin from Epic Games is revolutionary in the relatively painless workflow it enables for exporting 3ds max & V-Ray architectural scenes into Unreal Engine.
Bear in mind however, that Datasmith‘s streamlined workflow can’t always free us from the need to meticulously prepare models as game assets by the book (UV unwrapping, texture baking, mesh and material unifying etc.) (especially if we need very high game performance).
That being said, the Datasmith plugin has definitely revolutionized the process of importing assets into Unreal, making it mush more convenient and accessible.
Make sure all materials are VRayMtl type (these get interpreted relatively accurately by Datasmith)
Make sure all material textures are properly located so the Datasmith exporter ill be able to export them properly.
In Rendering > Exposure Control:
Make sure Exposure control is disabled. Explanation:
If the Exposure Control will be active it will be exported to the Datasmith file, and when imported to Your Unreal Level/Map a “Global_Exposure” actor will be created with the same exposure settings. Sounds good, right? So what’s the problem?
The problem with this is that these exposure setting will usually be compatible with photo-metric light sources like a VRaySun for example, but when imported to Unreal, the VRaySun does not keep its photo-metric intensity. (in my tests it got 10lx intensity on import). the result is that the imported exposure settings cause the level to be displayed completely dark.
Of-course you can simply delete the “Global_Exposure” actor after import, but honestly, I always forget its there, and start looking for a reason why would everything be black for no apparent reason…
* If your familiar with photo-metric units, you can set the VRaySun to its correct intensity of about 100000lx, and also adjust other light sources intensity to be compatible with the exposure setting.
Select all of the models objects intended for export,
And File > Export > Export Selected:
* If you choose File > Export > Export you’l still have an option to export only selected objects..
In the File Export window,
Select the export location, name the exported file,
And in the File type drop-down select Unreal Datasmith:
In the Datasmith Export Options dialog,
Set export options, and click OK.
* Here you select whether to export only selected object or all objects (again)
Depending on the way you prepared your model,
You may get warning messages after the export has finished: Explanation:
Traditionally, models intended for use in a game engine should be very carefully prepared with completely unwrapped texture UV coordinates and no overlapping or redundant geometry UV space.
Data-smith allows for a significantly forgiving and streamlined (and friendly) workflow but still warns for problem it locates.
In many cases these warnings will not have an actual effect (especially if Lightmap UV’s are generated by Unreal on import), but take into account that if you do encounter material/lighting issues down the road, these warnings may be related.
Note that the Datasmith exporter created both a Datasmith (*.udatasmith) file, and a corresponding folder containing assets.
It’s important to keep both these items in their relative locations:
In Unreal Editor:
Go to Edit > Plugins to open the Plugins Manager:
In the Plugins Manager search field, type “Datasmith” to find the Datasmith Importer plugin in the list, and make sure Enabled checked for it.
* Depending on the project template you started with, it may already be enabled.
* If the plugin wasn’t enabled, the Unreal Editor will prompt you to restart it.
In the Unreal project Content, create a folder to which the now assets will be imported:
* You can also do this later in the import stage
In the main toolbar, Click the Datasmith button to import your model:
Locate the the *.udatasmith file you exported earlier, double click it or select it and press Open:
In the Choose Location… dialog that opens,
Select the folder to which you want to import the assets:
* If you didn’t create a folder prior to this stage you can right click and create one now.
The Datasmith Import Options dialog lets you set import options:
* This can be a good time to raise the Lightmap resolution for the models if needed.
Wait for the new imported shaders (materials) to compile..
The new assets will automatically be placed into the active Map\Level in the Editor.
All of the imported actors will be automatically parented to an empty actor names the same as the imported Datasmith file.
In the Outliner window, locate the imported parent actor, and transform it in-order to transform all of the imported assets together:
* If your map’s display turns completely dark or otherwise weird on import, locate the “Global_Exposure” actor that was imported and delete (you can of-course set new exposure setting or adjust the light settings to be compatible)
1. Import the BitmapManager class needed to load image files.
2. Set a variable containing the path to the image file
3. Call the MaxPlus.Factory class’s CreateStorage method to initiate a BitmapStorage object.
This is embarrassing IMO..
And it may very well be that I simply didn’t find the correct way it should be done..
I couldn’t find any other way to independently initiate the BitmapInfo object needed for loading the image, other than Initiating a BitmapStorage object and getting referece to its BitmapInfo object. (the BitmapInfo class has no constructor..)
* If you know a better method to do this I’ll be very grateful if you take the time to comment.
that the 17 integer argument we supply sets the storage to be compatible with: 32-bit floating-point color depth format (without an alpha channel).
See list of other color format options in this example here: https://help.autodesk.com/view/3DSMAX/2020/ENU/?guid=__developer_using_maxplus_creating_a_bitmap_html
* They wrote a class containing convenient named constants of the integer arguments (see example code below).
* In this example of creating the BitmapStorage just as a way to generate a BitmapInfo object the actual format you’l supply doesn’t matter, but you can’t use a format that can’t be written to like 8 for example (see list below)
4. Get a reference to the BitmapInfo object contained in the BitmapStorage object.
5. Setting the name property (full file path) of the BitmapInfo object.
6. Loading the image.
7. Displaying the image in 3ds max‘s image viewer window.
BMM_NO_TYPE = 0 # Not allocated yet
BMM_LINE_ART = 1 # 1-bit monochrome image
BMM_PALETTED = 2 # 8-bit paletted image. Each pixel value is an index into the color table.
BMM_GRAY_8 = 3 # 8-bit grayscale bitmap.
BMM_GRAY_16 = 4 # 16-bit grayscale bitmap.
BMM_TRUE_16 = 5 # 16-bit true color image.
BMM_TRUE_32 = 6 # 32-bit color: 8 bits each for Red, Green, Blue, and Alpha.
BMM_TRUE_64 = 7 # 64-bit color: 16 bits each for Red, Green, Blue, and Alpha.
BMM_TRUE_24 = 8 # 24-bit color: 8 bits each for Red, Green, and Blue. Cannot be written to.
BMM_TRUE_48 = 9 # 48-bit color: 16 bits each for Red, Green, and Blue. Cannot be written to.
BMM_YUV_422 = 10 # This is the YUV format - CCIR 601. Cannot be written to.
BMM_BMP_4 = 11 # Windows BMP 16-bit color bitmap. Cannot be written to.
BMM_PAD_24 = 12 # Padded 24-bit (in a 32 bit register). Cannot be written to.
BMM_LOGLUV_32 = 13 BMM_LOGLUV_24 = 14
BMM_LOGLUV_24A = 15 BMM_REALPIX_32 = 16 # The 'Real Pixel' format.
BMM_FLOAT_RGBA_32 = 17 # 32-bit floating-point per component (non-compressed),
RGB with or without alpha
BMM_FLOAT_GRAY_32 = 18 # 32-bit floating-point (non-compressed), monochrome/grayscale
BMM_FLOAT_RGB_32 = 19
BMM_FLOAT_A_32 = 20
Using the GradientRamp procedural texture map in Mapped mode can very useful for creating procedural material effects.
The Idea is that the lightness value from a different map will determine what part of the GradientRamp is sampled.
In this example the GradientRamp uses values produced by a procedural Falloff map set to Perpendicular-Parallel mode, as its coordinates source, to create richly colored metal that changes its Hue depending on View/Incident angle:
In this example the GradientRamp uses values produced by a procedural Noise map as its coordinates source to create an irregular color effect:
The examples here were rendered using V-Ray Next for 3ds max, but this technique could also be used with other rendering engines.
In theory, all clear* refractive surfaces should have their shadow calculated using a refractive caustics calculation in-order to render the refractive lensing** effect correctly, have their transparency color calculated as volumetric absorption of light through the medium in-order to render the color correctly for areas of different thickness, and have not only external reflections, but also internal reflections calculated, in-order to render the interaction between light and the transparent body correctly.
However, for thin surfaces of even thickness, like window glazing and car windshields, these optical effects can be rendered in much cheaper (non physical) methods, with very little compromise on final image quality or look, and even have an easier setup in most cases.
For this reason most popular render engines have object (mesh) and material (shader) parameters that allow configuration of the way these transparency effects will be rendered.
In this short article we’ll cover the different methods for rendering transparency effects, the reasoning behind them and the way to configure these settings in different render-engines.
In the comparison images below (rendered with Cycles), the images on the left were rendered with physically correct glass settings, 8192 samples + denoising,
And the images on the right were rendered with “flat” transparency settings and 1024 samples + denoising.
> See the shader settings below
Note that while for the monkey statue, the fast flat transparency settings produce an unrealistic result, the window glazing model loses very little of its look with the flat fast settings:
Lensing, caustics and transparent shadows:
It’s a common intuitive mistake, that transparent objects don’t cast shadows, but they actually do. they don’t block light, they change its direction. light is refracted through them, gets focused in some areas of their surroundings (caustics) but can’t pass through them directly, so a shadow is created.
A good example of this would be a glass ball, acting like a lens, focusing the light into a tiny area, and otherwise having a regular elliptical shadow. if we tell the render-engine to just let direct light pass through the object we won’t get a correct realistic result, even if the light gets colored by the object’s transparency color.
There is however one case where letting the direct light simply pass through the object can both look correct and save a lot of calculations, and that is when the object is a thin surface with consistent thickness like window glazing.
So in many popular render-engines, when rendering an irregular thick solid transparent body like a glass statue or a glass filled with liquid, we have to counter-intuitively set the object or material to be opaque for direct light and let the indirect refracted light (caustics) create the correct lensing effect (focused light patterns in the shadow area) > physically, light passing through a material medium is always refracted, i.e. indirect light. but for thin surfaces with even thickness like glazing, the lensing effect is insignificant, and can be completely disregarded by letting light pass directly through the object and be rendered as ‘transparent shadow’.
So the general rule regarding calculating caustics (lensing) vs casting transparent shadows (non physical), is that if the transparent object is a solid irregular shape with varying thickness like a statue or a bottle of liquid it should be rendered as opaque for direct light but with fully calculated caustics i.e. refracted indirect light.
Physically, the color of transparency*** is always created by volumetric absorption of light traveling within the material medium. as light travels further through a material, more and more of it’s energy gets absorbed in the medium**** (converted to heat), therefore the thicker the object, less light will reach its other side, and it will appear darker. this volumetric absorption of light isn’t consistent for all wave lengths (colors) of light so the object appears to have a color.
For example, common glass, absorbs the red and blue light at a higher rate than green light, and therefore objects seen through it will appear greenish. when we look at the thin side of a common glazing surface we see a darker green color because we see light that has traveled through more glass (through a thicker volume of glass) because of refraction bending the light into the length of the surface. tea, in a glass, generally looks dark orange-brown, but if spilled on the floor it will ‘lose’ its color, and look clear like water because spilled on the floor, it’s too thin to absorb a significant amount of light and appear to have a color.
Most render engines allow setting the transparency (“refraction”/”transmission”) color of the material both as a ‘flat’ non physical filter color, and as a physical RGB light absorption rate (sometimes referred to as ‘fog’ color), that can in some cases be more accurately tuned by additional multiplier or depth parameters.
Setting an object’s transparency color using physical absorption (fog) usually requires more tweaking because in this method, the final rendered color is dependent not only on the color we set at the material/shader, but also on the model’s actual real world thickness.*****
In general, the transparency color of thick, solid, irregularly shaped objects (with varying thickness) must be set as a physical absorption rate color, and not as a simple filter color, otherwise the resulting color will not be affected by the material thickness, and look wrong.
For thin surfaces with consistent thickness, like window glazing, however, it’s more efficient to setup the transparency color as a ‘flat’ filter color, because it’s more convenient and predictable to setup, and produced a correct looking result.
For example, if we need to render an Architectural glazing surface that will filter exactly 50 percent of the light passing through it, it’s much simpler to set it up using a simple 50% grey transparency filter color, because this method disregards the glass model’s thickness. This approach isn’t physical, but for an evenly thick glazing surface, the result has no apparent difference from a physical volumetric absorption approach to the same task.
It’s not intuitive to think that the air surface itself has reflections when seen through a transparent material volume like water or glass.
Viewed from under water, the air surface above, acts like a mirror for certain angles, reflecting objects that are under water. a glass ball lit by a lamp has a very distinct highlight, which is the reflected image of the light source itself (specular reflection), but it also has an internal highlight appearing on inside where the glass volume meets the air volume. we can easily ‘miss’ this internal highlight because in many cases it’s appearance converges with the bright focused light behind the ball, caused lensing (refractive caustics). the distinctly shiny appearance of diamonds, for example, is very much dependent on bright internal reflections, diamond cutting patterns are specifically designed to reflect a large percentage of light back to the viewer and look shiny, and if we wish to create a realistic rendering of diamonds, we will not only have to setup the correct refractive index for the material, but also model the geometric shape of the diamond correctly, and of course, set the material to render both external (“regular”******) reflections and internal reflections.
Your probably already guessing what I’m about to say next..
For thin surfaces with even thickness, the internal reflection is barely noticeable, because it converges with the main surface reflection, an for this reason, when rendering window glazing, car windshields, and the like, we can usually turn the internal reflections calculation off to save render time.
Simplified settings summary table:
Physical (irregular volume)
External and Internal
Example Cycles (Blender) shaders: > The Flat glazing shader is actually more complex to define since it involves defining different types of calculations per different type of rays being traced (cheating).
In general, for Shadow and Diffuse rays that shader is calculated as a simple Transparent shader and nor a refraction shader, and when back-facing, the shader is calculated as pure white transparent instead of glossy to remove the internal reflections. > While the flat glazing shader is only connected to the Surface input of the material output, the physical glass shader has also a Volume Absorption BSDf node connected to the Volume input of the material output node. > Note that a simple Principled BSDF material will have flat transparency and physical shadow (caustics) by default.
> For caustics to be calculated, the Refractive Caustics option has to be enabled in the Light Path > Caustics settings in the Cycles render settings.
Example V-Ray Next for 3ds max material settings:
> In V-Ray for 3ds max (and Maya) the Affect Shadows parameter in the VrayMtl Refraction settings determines weather the shadows will be fake transparent shadows suitable for glazing or (on) or opaque (off) which is the suitable setting for caustics. > The caustics calculation is either GI Caustics which is activated by default in the main GI settings or a dedicated Caustics calculation that can be activated, also in the GI settings. > For flat glazing the color is defined as Refraction Color and for physical glass the Refraction color is pure white and the glass color is set as Fog color.
Example Arnold for Maya settings: > In Arnold 5 for Maya the Opaque setting in the shape node Arnold attributes must be unchecked for transparent shadows, and checked for opaque shadows suitable for caustics. > For rendering refractive caustics in Arnold for Maya more settings are needed. > When the Transmission Depth attribute is set to 0 the Transmission Color will be rendered as flat filter color, and when the Transmission Depth attribute is a value higher than 0 the transparency color will be calculated as volumetric absorption reaching the Transmission Color at the specified depth.
> in Brute Force Path Tracers like Cycles and Arnold the Caustics calculation is actually a Diffuse indirect light path. this seems un-intuitive, but the light pattern appearing on a table surface in the shadow of a transparent glass is actually part of the table surface’s diffuse reflection phenomenon.
> what we refer to as ‘Diffuse Color’ in dielectric (non-metals) is actually a simplification of absorption of light scattered inside the object volume (SSS).
* Optically all dielectric materials (non-metals) are refractive, but not all of them are also clear, the is, most of them actually have micro particles or structures within their volume, that scatter and absorb light that travels through them, creating the effects we’re used to refer to as “Subsurface Scattering” (SSS) and in the higher densities “Diffuse reflection”.
** Lensing is a term used to describe the effect of a material medium bending light, focusing and dispersing it, and so acting as a lens.
*** Actually all color in dielectric (non metallic) materials is created by Volumetric Absorption.
**** Light isn’t only absorbed as it travels through medium, it’s also scattered.
***** Volumetric shading effects usually use the model original scale (the true mesh scale), so to avoid unexpected results it’s best that the object’s transform scale will be 1.0 (or 100% depending on program annotation)
Continuing this example,
If you need to select objects (nodes) of a certain type i.e. lights, cameras etc.
You can use the INode class’s GetObject() method to get a reference to the node’s object, or “modified object” in 3ds max terms, and use the object’s GetSuperClassID() method to get the integer id representing the object’s superclass.
An example of a script that selects all light objects in the scene:
from MaxPlus import SuperClassIds
from MaxPlus import SelectionManager
list = 
for c in node.Children:
list = list + list_children(c)
for o in scene_objects():
obj = o.GetObject()
if obj.GetSuperClassID() == SuperClassIds.Light:
* note that when copying and pasting a script from this example, the indentation may not be pasted correctly.
To model a terrain form an DWG (Autocad) file containing a topographical plan:
Import the DWG file to into the 3ds max scene, and move the plan to the center of the 3ds max scene if necessary.
Select the VIZBlock object and extract its linked geometry:
Right click the Linked Geometry object and select: Convert To: Editable Spline
Enter Spline editing mode, select all the splines that are not part of the topography, and delete, or detach them so only the terrain ‘height lines’ will remain.
With the topographical plan editable spline selected,
Choose Create > Compound Objects > Terrain
A Terrain object is now created:
To retopologize the terrain mesh to more usable quad polygon mesh:
Create a new Plane primitive above the terrain mesh, slightly smaller at the sides, that has the wanted polygon resolution:
From the Top view (important), with the new plane selected, choose: Create > Compound Objects > Conform:
Set the creation method to ‘Move“, click Pick Wrap-To Object and than click the terrain mesh.
It will now take some time for the new conformed mesh to be calculated..
When the new object is ready, right click the viewport to exit the object picking mode.
The Conform object is no ready, and contains both the terrain mesh and the new conformed quad polygon mesh:
Right click it and choose:Convert To: Editable Poly
In Element editing mode, select the terrain mesh part and delete it to remain only with the new quad polygon mesh:
Fix non conformed mesh parts by either moving or deleting them:
The VRayFur is grown on a beveled surface, that has no bottom side surface to avoid growing fur at the bottom, and also because it’s unneeded.
The surface is beveled at the edges so that the fur there will grow to the sides,
And a noise modifier is applied to the surface to break its uniformity and give it a more organic shape.
* You could have a bottom surface set the fur not to grow on the bottom polys.
A combination of 3 procedural Noise maps (for each of the RGB channels) is used to create a direction map for the fur threads. the maps are added together using a VRayCompTex map.
The reason the pattern is separated to it’s RGB channels is that it allows more control.
A VRayFur direction map works like a normal map in tangent-space and this means we can’t have the blue channel be less than a value of 0.5 because that would cause the fur to grow down into the surface.
For the fur material, a VRayFastSSS2 is used to achieve a ‘fluffy’ organic look combined with a VRayDirt map to accentuate the shadows between the fur threads.
tyFlow is a new advanced event driven particle / dynamics system plugin for 3ds max that can somewhat be described as the “next generation of Particle Flow*“.
An ‘event driven particle system‘ is a particle system in which the behavior of the particles is defined in ‘events‘. each event contains a collection of ‘operators‘ that control the different aspects of the particle behavior, like their shape, their speed, direction etc. special ‘test operators‘ are used to check if the particles should switch to a different event and so change their behavior.
Setting up an event driven particle system in 3ds max is done through a node based visual interface, in which the nodes in the flow graph are the particle events, each event is a collection of operators and their parameters.
This tutorial demonstrates some fundamental concepts of event driven particles and tyFlow:
Using Property Test operators to switch between different motions and shapes.
Using the PhysX Shape and PhysX Switch operators to switch between physical and non-physical particle behavior.
Spawning new particles and deleting them.
> Note that while understanding the logic of this example is relatively easy, tweaking all the parameters to get it right takes a lot of tests and fine tuning. Download the example file and playing with the system parameters to get to know how the different operators affect the particles.
> To create a tyFlow particle system:
In Command Panel > Create > Standard Primitives,
Click tyFlow, and then click and drag in the viewport to create a tyFlow object.
When the tyFlow object is selected, in the Modify panel press the Open Editor button to open the tyFlow editor. Drag operators from the library below to the work space in order to create a new event containing them, or drag them into existing events.
> Note that almost all of the system’s events contain a Display operator set to Geometry mode so that the particle’s actual animated shapes will be displayed in the viewport, and also a Mesh operator needed for particles to be exported to a render engine for final rendering.
Particles are initially created in event: ‘Birth’ using a Birth Objects Operator, and are immediately sent to the next event: ‘Physical Falling’ by the Send Out operator.
> The Birth Objects operator is used to initialize particles directly from scene objects.
Initial setup of the spheres as sources of particles for the Birth Objects operator:
The event titled ‘Physical Falling’ is the only event in the system in which the particles behave as PhysX objects who’s motion is governed by physical simulation i.e they fall and collide with the slide model (named Box001).
The PhysX Shape operator turns the particles into physical simulation objects, and the PhysX Collision operator adds the slide model as a collision object to the simulation.
A Property Test operator checks if the falling balls fell below -35 in the Z axis, and if so sends them to the event titled ‘Rocket Upward’. > Note that in the PhysX Collision operator, the Hull Type of the slide model is set to Mesh rather than Convex to allow the sphere particles to slide inside the slide (a convex hull type would behaves as if it’s filled making the balls fall to the sides)
> Note that in the tyFlow PhysX settings, the default ground collider has been disabled to allow the balls to fall freely below the 0.0 Z axis position.
> The (standard) Shape Operator and Speed operators are in this event in order to reset the shape and speed of particles in case they entered this event after already having different shapes ans speeds.
The event titled ‘Rocket Upwards’ uses a PhysX Switch operator to deactivate the particles participation in physical simulation, assigns them a new (rocket shape),
A Force operator referring to a tyWind object causes the particles to accelerate upwards, and a Spawn operator to have each original particle spawn new particles as the rocket trail.
A Property Test operator checks if the particles have reach a height of 200 and if so sends them to the event titled ‘Chopper back to start’. > Note that the Slow, and Rotation operators are in this event to force the particles back to default orientation so the rockets will be aimed upwards. > The Spawn operator creates new particles and at the original particle location and sends them to the event titled ‘Rocket flare’.
The event titled ‘Chopper back to start’ assigns the particles a new ‘little chopper’ animated shape, and uses a Force operator to make them affected by the tyWind object pointing back to the start.
> Note that the Shape operator has the Animated Geometry option checked, and set to sync by particle age. the animation speed is played back 3 times faster than the original animation. > A Property Test operator checks if the particles Y position higher than -150 and if so sends the particles to the event titled ‘find drop location’.
The event titled ‘find drop location’ uses a Find Target test operator to make the particles move to the Point Helper object located above the slide and when they have reached it send them back to the event titled ‘Physical falling’ where they start their journey all over again.
> Note that the Slow operator slows the particles velocity that was inherited for the previous event so they wont overshoot and ‘fly’ further beyond the point helper.
The event titled ‘Rocket flare’ defines the shape, speed and direction of the spawned rocket trail particles and uses a Time Test operator to check if the trail particles have existed more than 3 frames and if so send them to the event titles ‘Delete Flare’
The event titles ‘Delete Flare’ uses a Delete operator to delete the trail particles.
System setup with the tyWind objects responsible for moving the particles in the non-physical events of the system, and a Point helper object that serves as a ‘find target’ for the particles to get back to the initial location above the slide:
Particle shapes for the ‘Rocket Upward’, ‘Chopper back to start’ and ‘find drop location’ events.
Note that the shape pivots are consistently at the center of the ball for the shape switching to work well, and that the ‘chopper’ animation is done at the mesh level using Poly Select and XForm:
* Particle Flow is a powerful event driven particle system that was originally developed by ThinkBox software, ans later bacame 3ds max’s built in particle system.
In-order for objects in 3ds max to be rendered as volumes with Arnold, the object mesh has to be converted to a volume, and a Standard Volume material assigned to the object:
Add an Arnold Properties modifier to the object.
Under Volume set the Step Size to a value higher than 0.0.
Assign a Standard Volume material to the object and set it’s parameters to design the volumetric effect:
* Note that both Density and Depth control the transparency or ‘thickness’ of the volume. (lower Depth setting creates a thicker volume)
* When Scattering is set to 0.0 the volume will have only a absorption effect
In this example an Arnold Noise map is connected to the Standard Volume‘s Density parameter:
* Note that the Scale values must be set correctly in order to actually get a ‘cloudy’ effect.
* Note that the noise color values are now controlling the Density of the volume.