ZBrushCentral

Request: ZBrush -> VRmesh Format

Hello Everyone,

I’ve just seen a very small tool which would be the most insanely useful thing to have in ZBrush.

Vlado at Chaosgroup has written a VRMesh exporter for Mudbox, it takes a lower subdivision level as the preview mesh and allows textures to be baked into the vertex color channels. This will cut out a huge portion of our workflow and make working with high resolution models painless and really easy to go from ZBrush to Max/Maya and render with VRay. And with the vertex color channel workflow we don’t even need to save the textures out.

At the moment exporting Displacement maps and getting them to displace correctly always seems to be some-what of a lottery and can eat RAM, so we normally export the full high-resolution models, import into 3dsmax and then convert to VRayProxy, which takes a little while and doesn’t automatically create a preview model that is representative of the final mesh. The voxelised VrayProxy mesh is incredibly efficient to use for rendering with it dynamically loading data in when needed.

I’m sure we could probably make a script which would export OBJ/PLY/FBX and then run the VRay Obj_to_VRmesh utility but for the sake of simplicity this would be a wonderful thing to have!

Upon seeing the Mudbox version, lots of us are instantly asking for a ZBrush version but Vlado says he doesn’t have API access to create this. can we find a way to help him? It would cut a hugely time-consuming portion of our workflow out and enable us to use ZBrush on more projects as it would be simpler to work with these amazing meshes we can make. We’ve just finally bought a site license here at www.TaylorJames.com and I would really like to see Zbrush used on every high resolution print job we do.

thanks

Dave

Here’s a video showing how this works going into Maya, but it’s exactly the same across 3dsmax/Modo/etc…

//youtu.be/UPAlC5nr2H4

Wow, yes please! This would be amazing :slight_smile:

Please to come true!

Give it here! now, please!

Hi Dave,

Do you happen to know what the file format looks like and what it describes? Is it a point cloud 3D format or an efficient way to describe polygons and textures for the V-Ray renderer? I have never used V-Ray.

Also, is there a link to the OBJ_to_VRMesh utility or were you just describing a possible solution.

I could not find a file format description for .vrmesh. Perhaps it is part of the V-Ray SDK?

great feature! it is interesting to see how this works with textures.

Hi Mark

Yes it is part of the VRay SDK, all the information you might need is with the VRay installation. You can get this even from the demo, just download it from www.chaosgroup.com

Then you will find links to the SDK documentation in the Program Files Menu…

It’s then stored locally on your computer such as…
C:/Program%20Files/Chaos%20Group/V-Ray/3dsmax%202014%20for%20x64/docs/vrmesh_format.html

It describes in detail, the format of the header, voxel table, voxel data and channel information with illustrated guides to how voxels are stored and example vrmesh data.

The obj2vrmesh exe is also included with the demo version: Running it from the command line with no arguments will give you the following information. Making a script which uses this to convert an exported OBJ file should be easy enough! Does the PLY format keep the vertex color channel information?

Converter of .ply .obj .bin .geo .abc and .vrscene files to .vrmesh files
Copyright © 2003-2015 by Chaos Group Ltd. All rights reserved.
Build from May 22 2015

Usage:
ply2vrmesh <inputFile> [<outputFile>] [options]
or
ply2vrmesh <vrmeshFile> -info [options]

Arguments:
<inputFile> - .ply .obj .bin .geo (.hclassic) or .bgeo (.bhclassic) .abc
.prt or .vrscene file name. The string may include wildcard
s.

<outputFile> - .vrmesh file name (extension must be specified). This
string may not include wildcards. If this is not specified
then the output is a file with the same name, but with the
.vrmesh extension. If multiple input files are specified
and <outputFile> is missing, then each input file will be
written to a separate .vrmesh file. If multiple input
files are specified and <outputFile> is also specified,
all input files are sorted in lexical order and
concatenated into one animated .vrmesh file.

Options:
-append - appends the information as a new frame to the .vrmesh file

-smoothNormals - generates smooth vertex normals. Only valid for .obj and
.geo files; always enabled for .bin files

-smoothAngle - a floating point number that specifies the angle (in
degrees) used to distinguish if the normals should be
smoothed or not. If present it automatically enables the
-smoothNormals flag.

-flipNormals - reverses the face/vertex normals. Only valid for .obj,
.geo, .bin and .abc files

-flipVertexNormals - reverses the vertex normals. Only valid for .obj, .geo,
.bin and .abc files

-flipFaceNormals - reverses the face normals. Only valid for .obj, .geo,
.bin and .abc files

-flipYZ - swap y/z axes. Needed for some programs i.e. Poser,
ZBrush. Valid for .ply, .obj, .geo and .bin files.

-flipYPosZ - same as -flipYZ but does not reverse the sign of the z
coordinate.

-flipXPosZ - same as -flipYPosZ but swaps x/z axes.

-mapChannel <chanIndex> - stores the UVW coordinates to the specified mapping
channel (default is 1). Only valid for .obj and .geo
files. When exporting a mesh that will be used in Maya,
currently this must be set to 0 or the textures on the
mesh will not render properly

-disableColorSetPacking - only valid for .geo and .bgeo files; disables the
packing of float1 and float2 attributes in vertex color
sets.

-materialIDs - only valid for .geo and .bgeo files; assigns material IDs
based on the primitive groups in the file.
-materialIDs_splitGroups - only valid for .geo and .bgeo files; assigns materi
al IDs
based on the primitive groups. These groups are split into
different voxels/meshes and appear in visibility lists.

-sortMaterialIDs - only valid for .geo and .bgeo files; sorts the list of
material IDs by the group name. Otherwise they are in
the same order as they appear in the .geo/.bgeo file.

-fps <fpsValue> - a floating-point number that specifies the frames per
second at which a .geo or .bin file is exported, so that
vertex velocities can be scaled accordingly. The default
is 24.0

-previewFaces <numFaces> - specifies the maximum number of faces in the
.vrmesh preview information. Default is 9973 faces.

-previewType <type> - specifies the method used to generate a preview.
clustering - works very fast, but is less accurate
edge_collapse - slower, but produces the best results
combined - fast, produces slightly better results than clus
tering
face_sampling - copies triangles from the original
(very fast, but leaves a disconnected mesh)

-facesPerVoxel <numFaces> - specifies the maximum number of faces per voxel
in the resulting .vrmesh file. Default is 10000 faces.

-previewHairs <numHairs> - specifies the maximum number of hairs in the
.vrmesh preview information. Default is 500 hairs.

-segmentsPerVoxel <numSegments> - specifies maximum segments per voxel
in the resulting .vrmesh file. Default is 64000 hairs.

-hairWidthMultiplier <multiplier> - specifies the multiplier to scale
hair widths in the resulting .vrmesh file. Default is 1.0.

-previewParticles <numParticles> - specifies the maximum number of particles
in the .vrmesh preview information. Default is 20000
particles.

-particlesPerVoxel <numParticles> - specifies maximum particles per voxel
in the resulting .vrmesh file. Default is 64000 particles.

-particleWidthMultiplier <multiplier> - specifies the multiplier to scale
particles in the resulting .vrmesh file. Default is 1.0.

-mergeVoxels - merge objects before voxelization to reduce
overlapping voxels

-velocityAttrName <name> - specifies the name of the point attribute which
should be used to generate the velocity channel. By
default the ‘v’ attribute is used.

-pointSize - if specified, turns on point cloud generation and
specifies the smallest size of the points. Default is
0.0 (point cloud generation is disabled).

-velocityOffset <offset> - specifies that the starting position should be
offset by a fraction of the velocity channel, f.e. -0.25.
Only valid for .geo, .bgeo and .bin files.

-mergeFiles - merges all input files into one .vrmesh file.
Input files are specified using wildcard.
Output file (with .vrmesh extension) must be specified.

Alembic subdivision specific:
-subdivideAllMeshes - subdivide all alembic polygonal meshes,
not only subdivision objects.

-subdivisionLevel - alembic subdivision level.

-subdivideUVs <value> - specifies the subdivision of the mapping channels.
Value 0 to skip map channel subdivision and 1 to apply it.

-preserveGeomBorders - skip the subdivision for all geometry borders.

-preserveMapBordersMode <mode> - preserve map borders mode.
Mode “none” to subdivide all map borders.
Mode “internal” to preserve internal borders.
Mode “all” to preserve all map borders.

*.vrscene specific:

-vrsceneList - Show a list of available Nodes in the .vrscene file.

-vrsceneNodeName <name> - Node name inside the .vrscene file.
Must be specified!

-vrsceneApplyTm - Apply Node transform matrix to the mesh.

-vrsceneVelocity - Generate velocity channel (used for motion blur).

-vrsceneFrames start-end - Export animation range.

Generic:

-info - show information about the specified .vrmesh file

-frame <frameIndex> - exports particular frame from the specified file.
Combined with -info option it shows information about the
specified frame from the .vrmesh file. Indices are 0-based.

If this option is not specified, information is printed for each frame in the file.

-oneFramePerFile - exports each frame in separate file.

-padding <padding> - frame padding number between 1 and 10. Default is 4.

C:\Program Files\Chaos Group\V-Ray\3dsmax 2014 for x64 ools>

Hi Dave,

I registered on the Chaos Group website but could not download the SDK; it just did not show up when selected (I am on Mac btw). I think I will have to wait until I get back to my Windows machine.

From watching the ‘Mudbox to vray’ video you linked I am guessing you would like similar options for the VRMesh export as those shown in the video? Because there are a lot of options in the command line tool :lol:

Performing the simplest export of multiple subtools into a single .vrmesh file should definitely be possible. Being able to include polypaint might be tricky. ZBrush does export vertex colors into the .obj file format, but they are outside the Wavefront .obj specification and thus up to the interpreter to add support for.

Does the PLY format keep the vertex color channel information

It is supported, yes. The PLY format plugin Marcus wrote includes vertex coloring.

How did Marcus write the PLY exporter? Surely everything he did there he could also do for the VRMesh format if he had the specification?

What DCC app do you have? Maya? You should be able to have a VRay demo on that. The SDK isn’t a separate download it’s included in the main installation.

email support@chaosgroup.com and ask them about it, if you’re saving Vlado the hassle of writing his own I’m sure they’ll sort something out.

What DCC app do you have? Maya? You should be able to have a VRay demo on that. The SDK isn’t a separate download it’s included in the main installation.

I use Modo, but although the Modo demo is listed as a download, no link appears. I also tried the V-Ray standalone demo on my Windows machine and though it does create a shortcut to the ply2vrmesh command line tool, it does not exist. I searched high and low but it is not there. Maybe it is not included in the demo?

It does not really matter anyway. After looking at the command line options you posted, they should be enough for me to write something simple that Vlado can expand upon.

However, the plugin would be based on .obj export from ZBrush. In order to support polypaint the ply2vrmesh command line tool would need to add support for the vertex coloring that ZBrush adds to the exported .obj (the ‘documentation’ is included in each .obj file with vertex colors).

How did Marcus write the PLY exporter? Surely everything he did there he could also do for the VRMesh format if he had the specification?

I am pretty sure he exported as .obj first and parsed the file with a plugin he wrote (.dll/.lib). Yes, Marcus would most definitely be able to do the same thing that I was thinking of with the .ply format and much better. But he would end up supporting two .ply exporters instead of one. In any case that would be more of a Chaos Group - Pixologic discussion as Marcus works for Pixologic.

Another video showing how the vertex colour channel works.

//youtu.be/kLwRlyxMquw

@TVeyes - Email support@Chaosgroup.com and tell them what you want to do and ask them for the exe.

thanx for sharing the video

Hi Dave,

I am afraid I have some some bad news. My trusty 8 core Xeon PC died before I could even begin writing the VRMesh Export ZScript. It is either the motherboard or both CPUs that have met an untimely end (well, I bought it in 2006-2007). Rest in peace you big black noisy box :frowning:

But I also have some good news.

The VRMesh Export ZScript is nearly finished … hurray! :slight_smile: I have primarily been working on the ZScript for OS X, but this evening I installed Windows and ZBrush on a VirtualBox and now also have a working .vrmesh export for Windows. There is still a fair amount of ZScript to add, more testing to do and much polish to apply. All depending on how much spare time I get in the next couple of days, I should have a first version of the ZScript ready for testing during the weekend.

I have uploaded the first ZBrush to VRMesh file >>here<<. It is simply the DemoSoldier model included with ZBrush and exported with the ply2vrmesh -flipYZ parameter. Hopefully it looks as it does in ZBrush as I cannot test it right now (I only have Modo and that is not on the demo download list on Chaos Group’s website). I hope it works.

Going forward it would be interesting to know which programs can load a .vrmesh file from the command line. Could you, for example, do a ‘maya.exe myZBrushExport.vrmesh’ or something similar?

In case you are wondering how I got the ply2vrmesh executable; I did not contact Chaos Group but tried a final demo download. The V-Ray for Maya demo includes the ply2vrmesh executable but all the other demos I tried did not.

Take care,

Does anyone have any experience with the ply2vrmesh command line tool?

I’ve run into a problem on OS X where I cannot export multiple .OBJs to a single .vrmesh. On Windows you can use a wildcard to merge the .OBJs into a single .vrmesh, like so:

ply2mesh *.obj MyExported.vrmesh

But on OS X it fails due to unrecognised arguments. If there are 3 or more .obj files the unrecognised argument is the third .obj. If there are 2 .obj files the unrecognised argument is the output file, MyExported.vrmesh. If there is only 1 .obj file it works !

It seems like a bug in the ply2vrmesh tool on OS X or perhaps there is another way to format the command? The -mergeFiles option has no effect. Any ideas?

HI Mark,

Great effort to get Zbrush possibility to do VRmesh , NOW! i can finally get renderer out my fractales:-)

Godt arbejde!

VH
daniel

Hi,

Sorry about the delay. Thought I would have had time to finish the ZScript before or during the weekend.

In any case, here is the first version of the VRMesh Export ZScript with which you can export the visible polymesh subtools into a single or multiple .vrmesh files (on OS X only multiple .vrmesh files is supported). I think I have picked the ply2vrmesh options that are relevant to ZBrush but if I have missed anything then of course let me know.

As it is a first version there is room for improvement:


  1. The ‘Export Highest SubDiv’ switch has no effect right now. It will be implemented shortly.
  2. The range of the ‘Preview Faces’, ‘Faces Per Voxel’ and ‘Point Size’ sliders might not be sufficient. Let me know what values are typically expected.
  3. On OS X you can export to multiple .vrmesh files, but not multiple subtools into a single .vrmesh file. I don’t think I can do anything about that as it seems to be a bug in the ply2vrmesh executable.
  4. Perhaps more inline documentation? The Geometry, Normals, Preview and Misc. button dividers could be enabled and provide extended information about the settings. But that information would have to come from you guys. I don’t have the means to test optimal settings for multiple DCCs.
  5. Right now the .OBJs and .MTLs are deleted after the conversion. They should of course be deleted before and after the conversion.
  6. I forgot to delete .BMPs. Will be fixed shortly.

But enough of me babbling, here is the ZPlugin:

Edit:

A new version has been posted further down this thread.

Hope it works for you guys, I have only been able to test that ‘something’ is being output. I could not find the .vrmesh preview app for OS X and on Windows, running through VirtualBox, the OpenGL version is not supported. So yeah, I am kind of excited to see what this ZPlugin actually produces :smiley: Let me know how it works.

the plugin exports only OBJ format, cant see any VRMESH

Hi chooj,

I am afraid I need a bit more information in order to help.

Which OS are you using? Did you remember to copy the ply2vrmesh executable into the ExportedFiles folder? Are you using 32 or 64 bit ZBrush? Depending on which version you use you should copy the files to the ZStartup/ZPlugs/ or ZStartup/ZPlugs64/ folder.

Are you seeing the .obj files briefly or are they still there after the Zscript has run? Because the .obj files are supposed to be deleted regardless of the .vrmesh file generation. It might help if you could PM me the generated .bat (Windows) or .shl (OS X) file.

Thanks,

-Which OS are you using?
-Windows 7 64 bit
-Did you remember to copy the ply2vrmesh executable into the ExportedFiles folder?
-Yes, I did.
-Are you using 32 or 64 bit ZBrush? Depending on which version you use you should copy the files to the ZStartup/ZPlugs/ or ZStartup/ZPlugs64/ folder.
- I’m using an 64 bit version, and yes, I copied files into Zplugs64
-Are you seeing the .obj files briefly or are they still there after the Zscript has run? Because the .obj files are supposed to be deleted regardless of the .vrmesh file generation.
-There is .obj and .bat files after the script has run.