SaveRenderMesh
Description
The SaveRenderMesh shader allows you to capture the actual tesselated geometry that mental ray uses to produce the final render. This means that you can obtain geometry from the following sources:
- Sub-division surface geometry
- Displacement mapped geometry
- Particle instantiated geometry
- Hair instantiated geomety
- Geometry shader produced geometry
SaveRenderMesh is implemented as a lightmap shader that captures this geometry and saves it to a file of your choice in the standard Wavefront OBJ file format.
The output of the shader has these capabilities:
- Save render normals.
- Save render UV coordinates (interpolated if necessary).
- Save meshes out on each frame to different files.
- Save multiple objects to:
- a single mesh contained in a single file.
- individual meshes contained in a single file.
- individual meshes contained in multiple files.
Simple Example
Here, we have a simple torus with a fractal displacement map applied.

This is its render tree:

This produces a render that looks like this:

By adding the SaveRenderMesh lightmap shader into the rendertree (as shown in the diagram below), the next time we render, it will save the geometry into an OBJ file on disk. The “Lightmap_Color” node is provided automatically by XSI and you cannot delete it. You can safely ignore it however, since the lightmap shader does not write to this file.

Once we’ve rendered the torus, we can load the tesselated OBJ file back into XSI.
Note, there is actually no need to render the torus itself, since mental ray tesselates the geometry before the render itself takes place. This means that you can just drag a very small render region away from the torus, and you will still obtain the OBJ file.

Above you can see the original torus on the left with the loaded OBJ file containing the displaced geometry shown on the right. As you’d expect, there is no noticeable difference between the render geometry and the geometry we’ve just loaded in.
We are now able to edit the displaced geometry using the standard modelling tools.
Generally, it’s more efficient to let mental ray tesselate geometry at render time, however there are circumstances where it is extremely useful to have access to the tesselated render mesh. For example, if you have a displaced surface representing a terrain and you want to place rocks and vegetation onto it. In this situation, it’s very helpful to be able to see exactly where the surface is so that you can place your objects accurately.
On the next page, I’ll explain the various options available to you.










This plugin rocks – so very, very useful! Thanks, Andy!
Andy, any chance someone has compiled this for 3ds max? Not that I have the skill but would love this functionality.
Regards,
Reuben
Hi Reuben,
I’ve not looked at how mental ray works with 3DS Max, I haven’t used it for years. I’d imagine that it wouldn’t be necessary to recompile, but that you’d need to supply some sort of file to let Max know about the shader structure and definition.
XSI has SPDLs, and Maya has the .mi shader description files. Do you happen to know what Max uses? I had a quick Google for the documentation on it, but I couldn’t find anything. If you know where the relevant docs are, I might be able to sort something out for you.
Cheers
Andy
I am trying to get this add-on to work in Softimage 2010 but it doesn’t work. I followed all the steps. I get as far as attaching the FXNut_SaveRenderMesh node to the lightmap and this error pops up “PHEN 0.4 error 051011:shader”FXNut_SaveRenderMesh” not found”. When installing the add on I noticed that the first 4 of the destination directories of the filenames were blank. Only the last 5 had destination directories. I don’t know how to set the correct destination directory especially since it doesn’t seem to allow you to past anything in those areas. I really want to use this very useful add on but i only have Softimage 2010. Thanks,
Kenzie
Hi Kensie,
Can you tell me which platform you’re running XSI on? Is it on Windows? Did you read the Acknowledgements section on page 3 of the documentation where it talks about the “shader not found” problem?
Cheers,
Andy
Hi Andy,
I actually hadn’t read the acknowledgments section on page 3 but I don’t see how that could help as I am running Windows XP 32 bit edition. That computer is my work computer so I don’t have access to it at the moment. At home I have XSI 7 and am running Windows XP 64 bit. I tried the add on and it works for regular geometry but doesn’t work for hair. The main reason I wanted this plugin was to render out hair so I could export the hair into Zbrush when working on scupts. I can do this in Maya but I really don’t like Maya and especially don’t like Maya’s hair. Is there a special setup to get your add on to render out hair? Have you tested it with hair? Thanks for the quick response.
Kenzie
Hi again,
I figured out at home on XSI 7 how to get the hair to render an obj. I was assigning the saverendermesh node to the hair not the instanced geometry. Once I added the node to the instanced geometry it worked great. I love this add on and thank you so much for making it and giving it away as well as helping people use it.
I am still unable to make it work on Softimage 2010 at work on Windows XP 32. Any ideas? Should it work fine in 2010? Have you tested it? Thanks again.
Kenzie
I’ve not tried it on 2010 yet, but I’d be surprised if it doesn’t work.
First thing to do is to download and install this version of the Visual C Runtime Redistribution for 32 bit:
vcredist_x86.exe
If that doesn’t work, see if you can find the batch file called “runonce.bat” in the application/bin directory of the XSI installation and run it. It might not exist anymore in the 2010 version, but it’s worth a look.
Failing that, download Dependency Walker and use it to open the SaveRendermesh dll. That’ll show you any dlls that it can’t find. Some will be part of the XSI installation which you don’t need to worry about, but there might be others.
Let me know how you get on.
Cheers,
Andy
softimage 2010, 7.5 not work with hair, i connect shader to hair geometry but it not create obj file. with simpe primitives it work!!!
please help
Hi RoN43,
(Feel free to let me know your real name, I like to know who I’m talking to!)
Yep, SaveRenderMesh doesn’t work directly with hair. You need to instantiate geometry on to it (e.g. cylinders) and apply the material to the instantiated mesh instead.
Cheers,
Andy
I’m trying to use this great add-on together with another great add-on, booltrace, but I don’t get the effect of the booltrace in my obj files, only in the render. Are you familiar with booltrace, and have you had these two playing together? I’m on 7.01, win XP 32.
Hi Christian,
No, unfortunately that won’t work. To understand why, you need to know that there are different stages that occur during a Mental Ray render. One of the first stages is where displacements, subdivisions, and procedural geometry is created. This is where SaveRenderMesh is executed, and it directly processes any geometry that it has been assigned to and saves it out as an obj.
Later, Mental Ray does the ray tracing on the generated geometry for effects such as reflection, refraction, occlusion, etc. This is where Booltrace operates. Booltrace works by examining the history of each ray and figures out the boolean operations to return a position and a normal at the intersection.
So no, Booltrace has nothing to do with boolean mesh operations on geometry, it’s purely a rendering construct. It happens at a very different stage of the rendering pipeline, so it can’t talk to SaveRenderMesh, and even if it could, it wouldn’t help.
Sorry!
Cheers,
Andy
Hi Andy
I’m having difficulty getting this to work with version 6.5 or 7.01 of XSI… which is strange because I’ve had it working before (*ages* back, different workstation!).
I get the message
“‘ ERROR : PHEN 0.3 error 051011: shader “FXNut_SaveRenderMesh” not found”
I’ve tried installing it locally and in a workgroup. Neither seems to work.
Version of XSI is 7.01/6.5 on winXP 32.
Hi Andy,
Thanks for your explanation. Too bad, it would make a nice combination, though.
Cheers
Christian
Hi Denis,
Have you read my replies to Kenzie above? He was having the same problem.
Andy
Hi andy
I had those runtime libs installed, but to make sure… I uninstalled them and installed the ones you link to (the 32bit one). I also re-installed the addon.
Still doesn\’t work
I\’ll give it a go in 64bit mode…
Cheers denis-jose
I couldn’t find lightmap color shader in softimage 2011. There is only color sampler shader in lightmap tab. Please anyone tell me where can I find this shader?
Nope, I can’t find it either. Thanks for the heads up, I’ll follow it up with Autodesk and get back to you.
Hi Aoi,
You can create a Writable Image Clip by going to the Render Tree menu. User Tools -> Create SSS Lightmap. (Thanks to Ahmidou Lyazidi for pointing that one out)
It’s a bizarre place to put this huh? Anyway, I’ve submitted a request to Autodesk that this location be changed as it’s really not an appropriate place to put it.
Cheers,
Andy
Many thank you for the quick reply, I will try this. Yes, how strange that they put it under the user tools:)
hey andy,
great tool, i presume
i get the same “ERROR : PHEN 0.4 error 051011: shader “FXNut_SaveRenderMesh” not found”.
im on 2011 32 bit. followed every possible advice, installed vcredit,
ran runonce, used the dependency walker, added the sss lightmap from user tools, everything looks functional, yet i still get that error,
and no geometry outputted whatsoever.
i’ve also noticed that in 2011, in the render tree under nodes / textures, there’s no “more…” option. is this a new thing for 2011?
i mean, how in the world do we add custom shaders.
anyway, i have no idea what is going on here.
if someone could shed some light, i’d be really grateful.
Hi Okto,
In 2011, custom shaders are added like the others via drag and drop from the list on the left. You should be able to find it there.
As far as the “shader not found” error goes, that’s odd. There must be something wrong there with your set up. AFAIK, everyone I’ve dealt with has managed to get it working.
All the problems people have had are either because a) the dll is in the wrong folder, or b) it’s a dependency issue. I’ve not heard of any others (although if anyone else is reading this and knows better, I’m all ears)
If you do figure it out, be sure to let me know what the problem was. That way I can advise other people who have similar problems.
Thanks
Andy
Hi AndyAndy
Sadly it gave me the same “shader not found” error. The shader is in my rendertree list so I assume I didn’t copy it to wrong folder right?
I try runonce.bat but no luck. I didn’t try dependency maybe it solves my problem. I give it a try when I find time.
Leave your response!
Subscribe
Subscribe to the RSS Feed Join me on Twitter
Flickr Feed
Categories
Archives
TD Blogs
Photography
Science Blogs
VFX
Twitter Feed
Tags
Recent Comments
Most Commented
Most Viewed