General

Exporting a mesh to a file

Exporting a mesh from the Maya GUI

Exporting a mesh from MEL

The .vrmesh file format

Proxy parameters

Notes

 

Search Keywords: proxy, mesh, VRayMesh, .vrmesh

General

VRayProxy allows you to import geometry from an external mesh at render time only. The geometry is not present in the scene and does not take any resources. This allows the rendering of scenes with many millions of triangles - more than Maya itself can handle.

Exporting a mesh to a file

Before you can import a mesh through a VRayProxy object, you need to create the mesh file first. This can be done either from the Maya user interface, or through a MEL command.

Exporting a mesh from the GUI

To export a .vrmesh file from the user interface, open the scene where you have the object(s) you'd like to export as VRayProxy objects, select the object(s) and from the Create menu select V-Ray > Create Proxy. This will bring out the create proxy dialog:

 

 

Path - this is the directory where the mesh file wil be created.

 

Export all selected objects in a 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.

 

Export each selected object in a separate file - this option will create one file for each selected object. The name of each file is derived from the name of the correspondig Maya 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.

 

File Name - this is the name of the file, if you have selected the Export all selected objects in a single file option. You don't need to specify a path - the Path folder will be used.

Overwrite existing vrmesh file - when checked V-Ray will automatically overwrite any existing vrmesh files.

 

Export Animation - if the mesh is animated you can export that animation in the .vrmesh file by enabling this option. Note that when exporting each mesh to a separate file, only the vertex animation will be included in the file. Any animations that are part of the transformations of the original mesh will be left there.

 

Export velocity - checking this option will export velocity information for the moving objects. This makes it possible to add motion blur to the final animation. However exporting this extra information takes longer. If you are not going to need motion blur it makes sense to disable this option.

 

Velocity interval start - specifies the beggining of the range for which velocity information will be exported

 

Velocity interval end - specifies the end of the range for which velocity information will be exported

 

Use Playback Range - the current playback range will be exported to the .vrmesh file.

 

Use Animation Range - the whole animation range will be exported to the .vrmesh file.

 

Specify Range - specify exactly which frames are going to be exported by setting values for the Start Frame and the End Frame parameters.

 

Faces in preview - allows you to specify how many faces are going to be used to show a preview of the proxy in the viewport.

 

Export vertex colors - when this option is checked V-Ray will store information about the color sets of the exported mesh(es) into the .vrmesh file. Otherwise this information will be omitted in order to speed up the export process.

 

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. If Export each selected object in a separate file is selected, the transformations of the orginal meshes will be used, otherwise a new transformation will be created and the original objects will be deleted.

 

Overwrite existing vrmesh file - when this option is not selected V-Ray will warn you if you are saving over an existing file. Otherwise it will automatically overwrite the existing file.

Exporting a mesh through MEL

.vrmesh files and proxy objects can also be created through the vrayCreateProxy MEL command. The command operates on the current selection and has the following syntax, where curly braces {} denote a choice between several values, and options in brackets [] can be missing:

 

vrayCreateProxy

-exportType {1|2}

-previewFaces $previewFaces

-dir $path -fname $filename

[-makeBackup] [-overwrite] [-vertexColorsOn] [-ignoreHiddenObjects]

[-createProxyNode -node $newNodeName]

[-animOn -animType {0|1|2} -startFrame $startFrame -endFrame $endFrame]

[-velocityOn -velocityIntervalStart $velocityIntervalStart -velocityIntervalEnd $velocityIntervalEnd];

 

The various options are described below:

 

OptionDescription
-exportType

Specifies the type of export:

1 - export all selected objects in a single .vrmesh file;

2 - export each selected object in a separate .vrmesh file;

-previewFaces Specifies the number of faces in the viewport preview for the proxy object
-dir Specifies the path where the .vrmesh file(s) will be created.
-fname Specifies the file name when exporting to multiple .vrmesh files
-makeBackup Create a backup .ma file containing just the exported objects.
-overwrite If specified, any existing .vrmesh files will be overwritten; otherwise, an error will be printed.
-vertexColorsOn If specified, vertex color sets are also exported.
-ignoreHiddenObjects If specified, hidden objects are not exported.
-createProxyNode After successful export, replaces the original geometry with proxy nodes.
-node The name for the new proxy node when -createProxyNode is specified, and a single proxy is created.
-animOn If specified, animated .vrmesh files are created.
-animType

If -animOn is specified, this option determines the animation interval to export:

1 - playback range;

2 - animation range;

3 - explicit frame range specified with -startFrame and -endFrame

-startFrame Specifies the start animation frame when using explicit range.
-endFrame Specifies the end animation frame when using explicit range.
-velocityOn

If specified, vertex velocity is also exported. This enables motion blur and smooth interpolation of the resulting animated proxies. The time samples within a frame for computing the velocity are specified with the -velocityIntervalStart and -velocityIntervalEnd options.

-velocityIntervalStart A value between 0.0 and 1.0 with the time position within a frame for the initial vertex positions.
-velocityIntervalEnd A value between 0.0 and 1.0 with the time position within a frame for the ending vertex positions.

 

The .vrmesh file format

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. More information about the .vrmesh file format is available in the documentation of the V-Ray SDK.

 

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. There is no way to recover the original mesh from a .vrmesh file (this can be done in principle, but is currently not supported). Therefore, if you plan on doing modifications to the mesh, you should keep it in a Maya file (which may be different from the file that gets rendered in the end).

Proxy parameters

Basic Parameters

 

File Name - this is the source .vrmesh file. Animated proxies can be stored either in one single file, or as a sequence of files with one file per frame. In the latter case, you can use the string %0nd in the file name to have it replaced with the current frame number at render time, where n is an integer number specifying the number of digits. For example, if you enter my_proxy_%04d.vrmesh as the file name, this will be expanded to my_proxy_0000.vrmesh for frame 0, my_proxy_0001.vrmesh for frame 1, and so on. If you use a sequence of files, the Playback type option will be ignored, as V-Ray won't know how many frames are in the animation. The Playback speed parameter may also work unreliably with sequences of files.

 

Bounding box - when this option is on the mesh is represented as a box in the viewports.

 

Animation Parameters

 

Playback speed - this is a multiplier for the speed of the animation. Putting negative numbers here will make the animation play backwards. This option may not work very well for sequences of .vrmesh files.

 

Start offset - use this parameter to offset the beginning of the animation by the given number of frames. You can use positive as well as negative values here.

 

Playback type - 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 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 Start offset parameter.

 

This option will be ignored if you use a sequence of separate .vrmesh files.

 

Shaders - shows a list of the shaders attached to the proxy. This option is mostly for backward compatibility with previous versions of V-Ray for Maya.

 

Restore the mesh

 

Create a mesh from this proxy - when you press this button the actual object will be imported into the scene. Note that some of the original information may be lost in the export/import process, so it is better to have a copy of the mesh saved as a Maya file.

Notes