Exporting a mesh to a file
Importing a mesh from a file
The Mesh Export dialog
The .vrmesh file format
Creating a proxy object
Alembic mesh parameters
Search Keywords: proxy, mesh, VRayProxy, .vrmesh, Alembic
VRayProxy allows you to import geometry from an external mesh at render time only. The geometry is not present in the 3ds Max scene and does not take any resources. This allows the rendering of scenes with many millions of triangles - more than 3ds Max itself can handle.
Before you can import a mesh through a VRayProxy object, you need to create the mesh file first. You can do this in two ways:
- Through the quad-menu: select the meshes you want to export, right-click in the viewport and select the V-Ray mesh export option. This will cause the Mesh Export dialog to appear.
- Dialog from MaxScript: select the meshes you want to export and then type
in the MaxScript Listener window. This will cause the Mesh Export dialog to appear.
- Direct export from MaxScript: select the meshes you want to export and then use the vrayMeshExport() function:
vrayMeshExport [meshFile:"<mesh file>"] [autoCreateProxies:true|false] [exportMultiple:true|false] [animation:on|off] [animationRange:#scene|#explicit] [animationStart:<integer>] [animationEnd:<integer>] [animationRedrawViews:true|false] [maxPreviewFaces:<integer>]
where <mesh file> is the name of the desired .vrmesh file. If the name does not contain a path, the default 3ds Max mesh path is used. If the name does not contain an extension, a .vrmesh extension is automatically appended. If the name does not contain a file name, the scene node name is used instead. If the autoCreateProxies option is not specified, by default the meshes are just exported, no proxies are created in the scene. If the exportMultiple option is not specified, the meshes are exported to multiple files by default. If the animation option is set to on, an animated proxy file is created. In that case, the range of the animation is determined by the animationRange option - if set to #explicit, then the frame range for the export is specified by the animationStart and animationEnd options (in frames), otherwise the current scene animation range is used. If the animationRedrawViews option is set to true then the viewports will be updated during the animation export process. If the maxPreviewFaces parameter is specified, then the exported .vrmesh file will contain a preview with the specified maximum of triangles, otherwise a default value of 10000 triangles is used.
The function returns ok if the .vrmesh file was exported successfully, and undefined otherwise.
Once you have exported a mesh to a VRayProxy you can at any time import the mesh back. There are two ways you can import a mesh back from a VRayProxy object:
vrayMeshImport [proxy: <proxy mesh object(s)>] [explicitNormals: true|false] [weldVertices: true|false]
where <proxy mesh object(s)>. is a single VRayProxy object, an array of VRayProxy objects or an ObjectSet (for example $geometry) . If this option is not specified VRayProxy object(s) from the current selection are imported as mesh(es).
explicitNormals - in cases where the original mesh has explicit information about the vertex normals, that information is also saved in the .vrmesh file when the mesh is exported. When this option is set to true it makes sure that the explicit normals information contained in the proxy is taken into account during the import.
weldVertices - during a .vrmesh file export, V-Ray may split the original mesh in smaller chunks that can be loaded independently of one another. This may cause some vertices to be duplicated in more than one chunk. When this option is set to true will cause V-Ray to perform a weld operation after the mesh is imported, so that split vertices are merged.
The function returns an array of the newly created mesh objects or undefined when there are no valid VRayProxy objects specified.
The Mesh Export dialog allows you to specify the mesh file as well as some export options.
Folder - this is the folder where the mesh file(s) will be created.
Export as single file - this option will take all selected objects and will merge them into one mesh file. This option also stores the transformations of the selected objects. When you import the file with a proxy object, it must be centered at the origin, if you want the objects to be in the same place. Also, since the imported mesh is rendered using the material of the proxy object, all meshes from the file will render with that material. You must use subobject materials and different material IDs if you want them to have different materials.
File - this is the name of the file, if you have selected the Export as single file option. You don't need to specify a path - the Folder path will be used.
Export as multiple files - this option will create one file for each selected object. The name of each file is derived from the name of the corresponding 3ds max node. The transformation of an object is not included in its mesh file, and the corresponding proxy must have the same transformation as the original object, if it is to appear in the same place. Note that you can use this option even with a single object, which will cause the object pivot to be preserved in the exported .vrmesh file.
Export animation - if the mesh is animated you can export that animation in the .vrmesh file with the animation by enabling this option.
Frame range - specify what part of the animation to be exported into the .vrmesh file.
Scene animation range - the whole animation will be exported into the .vrmesh file.
Frame range - specify exactly which frames are going to be exported by setting values for the Start Frame and the End Frame parameters.
Redraw views during export - when this option is selected you will be able to see the animation playing in the view port while it is being exported. This is an easy way to monitor the progress of the export.
Automatically create proxies - this option will create proxy objects for the exported meshes. The proxies will have the correct transformations and materials derived from the original objects. The original objects will be deleted.
Export point clouds - this option will add a point cloud representation of the mesh separated in different levels of detail that can be used by proxies for memory saving when rendering distant objects.
Lowest level point size - determines the size of point cloud disks at the most detailed level. If the size is small point cloud rendered at lowest level will appear closer to original mesh but used memory size will increase. Example
Faces in preview - allows you specify how many faces are going to be used to show a preview of the proxy in the view port.
Warn for existing files - when this option is selected V-Ray will warn you if you are saving over an existing file
Pressing the OK button will create the mesh files and the proxy objects. The export process may take some time, depending on the amount of geometry that must be processed.
Meshes are exported to a special .vrmesh file format. It contains all geometric information for a mesh - vertices and face topology as well as texture channels, face material IDs, smoothing groups, normals - in short, everything that is needed to render the mesh. In addition, the mesh is preprocessed and subdivided into chunks for easier access. The file also contains a simplified version of the mesh used for preview purposes in the viewports. Also, there is an option for adding a point cloud data to the file which is a simplified geometric representation of the mesh in the form of 3D disks with different levels of detail. Each level comprises disks with equal radius which is greater for levels of lower detail and smaller for the more detailed ones. When the object is rendered a point cloud geometry level is chosen depending on the distance between the object and the camera - for distant objects lower resolution point clouds are used. Thus original mesh is replaced by the simpler point cloud geometry with the appropriate level of detail allowed by distance.
It is important to realize that the mesh is in a "ready to render" format. No further modifications to the mesh are expected. You can't apply modifiers to the mesh, or animate it in any way except if you animate the position/orientation of the proxy object. If you need to make changes to the mesh, you can import it back as an Editable mesh (see the Import section below) and re-export it back to a .vrmesh file.
Starting with V-Ray 2.40, the VRayProxy object can load and render Alembic files (.abc). For the moment, only mesh geometry is recognized (no splines or particles).
At present, UV coordinates in the Alembic file are imported as mapping channel 0. This means that in Bitmap textures for materials applied on Alembic proxy objects, you need to select Vertex Color Channel:
This is essentially the same this as when bringing in .vrmesh files created in other applications (e.g. Maya). This will be corrected in a future release so that the default 3ds Max mapping channel 1 will also work.
V-Ray will recognize velocity information for motion blur if it stored either as standard Alembic velocity, or as a 3d vector array property called arbGeom.v or arbGeom.velocities.
Additional Alembic color sets are imported as mapping channels with indices greater than 0 (i.e. 1, 2 etc).
The VRayProxy has some additional parameters related to Alembic files. See the Alembic mesh section for more details.
After you export a mesh to a .vrmesh file, you need a proxy object to represent it in the 3dsmax scene. To create a proxy object, go to the Create panel and choose the V-Ray category; click the VRayProxy button and then click in a viewport to create the actual proxy object. A dialog box will appear that allows you to choose the .vrmesh file to import.
Mesh file - this is the source .vrmesh or .abc file.
Expand # to frame number - when this option is checked the symbol "#" can be used in the file name to specify that the loaded proxy is a part of an animation sequence. V-Ray will then load the other frames accordingly.
Flip axis - this checkbox switches between the y and z axis of the proxy being used as a vertical axis. It allows the user to align the vertical axis of the proxy with the vertical axis in the scene in cases where the proxy was not exported from 3ds Max, or when loading Alembic files.
Scale - allows to quickly scale the proxy geometry up or down.
Display - controls the display of the proxy in the viewports:
bounding box - the mesh is represented as a box in the viewports.
preview from file(edges) - displays the mesh preview info that is stored in the .vrmesh file showing only the edges of the object.
preview from file(faces) - displays the mesh preview info that is stored in the .vrmesh file showing only the faces of the object.
point - the mesh is represented as a point
Animation - holds the settings for animated proxies
Playback - select a playback mode from the drop down menu
Loop - the animation is looped by skipping to the first frame once it has finished
Play once - the animation is played just once
Ping-pong - the animation is looped by playing it backwards once the last frame has been reached and then playing it forward again when the first frame is reached
Still - the animation is not played. Instead just one frame of the animation is shown. You can select which that frame is with the help of the Offset parameter.
Offset(frames) - use this parameter to offset the beginning of the animation by given number of frames. You can use positive as well as negative values here.
Speed - this is a multiplier for the speed of the animation. Putting negative numbers here will make the animation play backwards.
Import - holds the settings for importing back a proxy as a mesh.
Import as mesh - imports the geometry from the .vrmesh as an Editable mesh object. Note that the new mesh will be created at the coordinate system origin (0,0,0), and not at the current place of the VRayProxy object.
Use explicit normals - in cases where the original mesh has explicit information about the vertex normals, that information is also saved in the .vrmesh file when the mesh is exported. Checking this option makes sure that the explicit normals information contained in the proxy is taken into account during the import.
Weld vertices in result - during a .vrmesh file export, V-Ray may split the original mesh in smaller chunks that can be loaded independently of one another. This may cause some vertices to be duplicated in more than one chunk. Checking this option will cause V-Ray to perform a weld operation after the mesh is imported, so that split vertices are merged.
Point cloud - holds the settings for using point clouds.
Level multiplier - determines the way point cloud levels are loaded. A value of 1.0 means that the level to load is determined exactly by the distance from the camera to the object. A value smaller than 1.0 means that the level will be of greater detail than required by distance. Values greater than 1.0 mean that the resolution of the level will be smaller than the one determined by distance. A value of 0.0 means that no point cloud level will be loaded and the original mesh will be rendered instead. Example
These options allow the user to control the visibility of a proxy's components when more then one meshes have been exported. The visibility can be controlled either by the objects names or by objec IDs
List type - Specifies wether the meaning of the lists
Exclude - when this option is enabled, the selected object in the list will be invisible.
Include - when this option is enabled, only the selected object in the list will be visible.
Object name list - a list of all the objects in the proxy file.
Object id list - a list of all the Object ID in the proxy file.
This section holds the controls for the V-Ray proxy when an alembic file (.abc) is loaded
Compute normals - this option allows you to force smoothe normals on the geometry in case they were not originaly smoothed.
Smooth angle - when the Compute normals checkbox is enabled this specifies the angle below which normals will be smoothed
Recompute bounding box - enabling this check box forces V-Ray to recompute the bounding box for the geometry before rendering. When this is off V-Ray will use the bounding box specified in the Almebic file. However, sometimes these bounding boxes are not correct and in that case the rendering will also be incorrect. To avoid such issues enable this option. Note that this option might slow down the rendering.
Preview faces - allows you specify how many faces are going to be used to show a preview of the proxy in the view port.
Use face sets - when this option is enabled V-Ray will consider information about face IDs found in the alembic file. This allows the user to apply different materials to different parts of the gemoetry based on those IDs. When this option is disabled all the faces in the geometry will have a face ID of 1 and only a single material can be applied.