Home » Download, Featured, XSI

SaveRenderMesh

15 February 2009 34,421 views 59 Comments

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.

1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading ... Loading ...

59 Comments »

  • JoeW said:

    This plugin rocks – so very, very useful! Thanks, Andy! :)

  • Reuben Finch said:

    Andy, any chance someone has compiled this for 3ds max? Not that I have the skill but would love this functionality.

    Regards,

    Reuben

  • AndyN (author) said:

    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

  • Kenzie said:

    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

  • AndyN (author) said:

    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

  • Kenzie said:

    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

  • Kenzie said:

    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

  • AndyN (author) said:

    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

  • RoN43 said:

    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

  • AndyN (author) said:

    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

  • Christian said:

    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.

  • AndyN (author) said:

    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

  • Denis-Jose Francois said:

    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.

  • Christian said:

    Hi Andy,

    Thanks for your explanation. Too bad, it would make a nice combination, though.

    Cheers

    Christian

  • AndyN (author) said:

    Hi Denis,
    Have you read my replies to Kenzie above? He was having the same problem.

    Andy

  • Denis-Jose Francois said:

    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

  • Aoi Sora said:

    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?

  • AndyN (author) said:

    Nope, I can’t find it either. Thanks for the heads up, I’ll follow it up with Autodesk and get back to you.

  • AndyN (author) said:

    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

  • Aoi Sora said:

    Many thank you for the quick reply, I will try this. Yes, how strange that they put it under the user tools:)

  • okto said:

    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.

  • AndyN (author) said:

    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

  • Aoi Sora said:

    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.

  • Oscar said:

    Hey Andy,

    I was just having the same problem trying to make your pluggin work on my xp32 bit machine. So I looked at the dll with dependency walker and noticed that it couldn’t find MSVCR70.dll.

    I downloaded the missing dll from here:

    http://www.dll-files.com/pop.php?dll=msvcr70

    And copied it to my windows/system32 folder.

    Right after doing that, your pluggin was working perfectly, and I didn’t even had to restart the system or xsi.

    I hope this helps.

    Thanks for this wicked tool!!

    Oscar

  • AndyN (author) said:

    Hi Oscar,
    Thanks for that. Glad you got it working.

    BTW, did you try installing the Microsoft runtime libraries that I link to on the last page? Doing that should install the same dll that you mentioned.

    I’ve just realised that most people probably don’t notice that bit because (for some strange reason) I put it in the acknowledgements. I’ll update the page to make it more noticeable.

    Thanks,
    Andy

  • Oscar said:

    Hey Andy,

    I did follow all your steps and installed the runtime libraries and also executed the runonce script, but still no luck.
    Then I updated my XP-SP2 to SP3 thinking that that could be the cause but it still wasn’t working…

    It was only after adding that dll to the system32 folder that started working.

    Cheers,
    Oscar

  • AndyN (author) said:

    Okay, thanks a lot for the info Oscar. I’ll look into it.

    Cheers!
    Andy

  • Silla said:

    Well, this plugin is very cool. I use it to generate grass landscape that i can import into source engine.

    I use a separated grass object with the texture, than i choice my land and place a hair on it. After some tweaks i plug the RenderMesh to the material and volià i have my grass as an obj. Now import to XSI and export to SMD … great stuff

    I try it with trees too, but these are too much triangles. Dunno how many because anything crash, but i think some trillions :-) haha

    So … wonderful plugin – help me a lot …

  • AndyN (author) said:

    Thanks Silla!

  • Carlos said:

    Genius!!! Thks a lot!

  • Mounty2010 said:

    Plugin is working fine under Softimage 2010 SP1, so thanks for that !
    The missing “msvcr70.dll” is NOT INCLUDED in Microsofts Visual C++
    so you have to get it “from net”. In my case, it was included in the
    Adobe After Effects CS4 “Support” Folder and after copying this file
    to Windows/System32 your plugin was running fine.

  • Gideon Klindt said:

    Is there way to get this to work with an ICE simulation that uses instanced geometry shapes?

  • Gideon Klindt said:

    Found I needed the shader on geo being instanced, not the point cloud. Thanks again Andy!

  • AndyN (author) said:

    Cool :-)

    Yeah, I’ve had occasional issues with getting it to work on pointclouds. It might be that I had the material on the pointcloud as well as the instanced geometry that screwed it up. I don’t know.

    Anyway, glad you figured it out.

  • okto said:

    hey there andy,
    i had to export some ice instances for a job recently, and found a couple of really strange things. fist of all, i managed to get it working, finally, so big thanx for that.
    i noticed that for some reason, it doesn’t need a lightmap connected into it to work. don’t know if that is normal behaviour, but it never threw any errors.
    now the problem i kept having, was with groups of instanced geo, which were randomized on the pointcloud and rotated based on the emission normal. It seems that for some reason, everytime i would use a group to fetch my geo from, and i would randomize the shape index, i would have trouble importing the saved obj file into other applications.
    both maya and h would throw “index out of range for face creation” errors. curiously, feeding the cloud one object at a time, would always work. which is rather strange, since the tool kicks in at render time, and i would think it has nothing to do with the way geometry sits on a pointcloud. anyways, i never managed to figure it out, so i just recreated the thing in h and spit my geo from there.
    would have loved this to work though.
    i also noticed it only works with the instance shape node, not the instance geometry node. is that normal?
    anyway, thanks again for this tool dude.
    it’s cool.

  • AndyN (author) said:

    Hi, yes, I’ve had issues with baking out ICE geometry, so I’m not too surprised at your findings. It’s a bit of a mystery as to why this is happening, I’m just saving out the triangles that mental ray is giving me.

    If I find out what the problem is, I’ll post back here to let you know.

    Cheers,
    Andy

  • okto said:

    just wanted to let you know, i had some time
    to look at that scene again, and managed to get
    the whole thing exported by using your shader
    one instanced object at a time.
    when using it on all the instances at once, the objs are corrupt.
    but eventually, this way, its easier to manage them
    in an external package.

    cheers,
    octav

  • AndyN (author) said:

    Thanks for the info Oktav!

  • olivier said:

    Hello Andy,

    on XP 64 with an XSI 2011.5 I’m still unable to generate instanciated objects on classic xsi hair.
    I’ve tried applying your shader either on the hair itself or on the instance Master object, but there is still no geometry rendered.

    I’ve executed the vcredist_x86, but I can’t find the msvcr70.dll in /system32.
    I’ve tried to copy it manually from another directory but for some reason I don’t see it. If I copy it twice, it says it’s already there but I can’t see it.
    Weird behavior. I’m not a dll expert, and wonder how I’m supposed to install it correctly.

    Can you help me ?

    thank you

    Olivier

  • olivier said:

    Eeer, ok the dll finally copied. I had a really weird behavior on that one…
    Unfortunatly I\’m now having a ERROR : PHEN 0.4 error 051011: \"Shader FXNut_SaveRenderMesh\" Not found

  • olivier said:

    Dependency walker says that 3 dll are missing :
    DEVMGR.dll
    IESHIMS.dll
    WER.DLL

  • AndyN (author) said:

    Hi Olivier,
    I suspect the 64 bit SaveRenderMesh dll was compiled on a different OS than XP (Ben Rogall compiled it for me). Check out this link here, it seems relevant:

    http://social.technet.microsoft.com/Forums/en-US/w7itproinstall/thread/8a751f65-ade9-4b8b-a3d3-c720ccbd3d2c/

    There’s some links in the post 3rd from the bottom where you can download the dlls. You’ll need to copy them to your system32 and probably use regsvr32 to register them.

    Or you can try installing IE8 which is where I think they’re from?

    Cheers,
    Andy

  • Bin said:

    Hi Andy, I\’m new to Softimage but really want to give this a try. it\’s 2011 version on windows 7.

    after hooking up the shader for a torus just like the example, and rendering current frame, the folder I selected is still empty, no obj file was written.

    what is the input channel when connecting Fractal to Phong in the image?
    does uv matter for this output?
    anything need to do with the light map?
    or is there other render setting I need to change?

    thanks

  • AndyN (author) said:

    Hi,

    > what is the input channel when connecting Fractal to Phong in the image?

    It’s just going into the diffuse colour input. It’s not important.

    > does uv matter for this output?

    Nope. It’s irrelevant

    > anything need to do with the light map?

    No, the lightmap is just the mechanism to pipe the geometry through to the SaveRenderMesh shader. As long as you’ve got one connected, it should work fine.

    > or is there other render setting I need to change?

    Nope, the render settings don’t make a difference (although I think there’s a setting to disable lightmaps, but it’s on by default).

    So sorry, but it’s hard to know what to suggest. Feel free to send me the scene via email. I’ll take a look when I can.

    Cheers,
    Andy

  • Christopher said:

    Hello! Thank you for sharing your addon. It seems to work great for me when I set particle shape to sphere, box, cone, etc. But when using instanced geo I do not get an OBJ output. I have tried Set Instance Geo and Instance Shape. Dependency walker indicated error opening msvcr80.dll. I installed vcredist_x64 (2008 I believe) but that did not resolve the issue. I downloaded msvcr80 and placed in system32 dir. I no longer receive the error with Dependency Walker, but again am unable to output instanced geo. I see you have noticed problems with ICE geo previously. I would just like to add my voice to the discussion in hopes of finding a resolution.

    Funny thing is, I am able to output instanced geo in combination with Instance Shape node and the Strand Tree addon (http://www.si-community.com/community/viewtopic.php?f=4&t=580) when saving custom leaves. But, do not find anything special in the strand tree setup that would be adding any functionality to setting ICE instanced geo.

    I have also tried forcing ICE Self.Shape to cache with your get data set data technique to no avail. Thanks for any input on the matter.
    XSI 2012 SP1 Win 7 x64

  • AndyN (author) said:

    Hi Christopher,
    Hmm.. The behaviour you mention regarding the dll’s doesn’t seem quite right. If you’re missing a dll, the plugin won’t work. It doesn’t just disable a particular feature.

    With regards to the ICE instancing, I’m afraid I don’t know why it doesn’t work. It works fine in some cases, e.g. hair instancing, so it’s hard to know what I could change. The plugin just gets fed by mental ray a stream of triangles and it writes them out to the OBJ file. There’s nothing particularly clever going on. The fact that it works in certain combinations of ICE compounds, and not with others would suggest that this is caused by factors beyond my control. If I get some time, I’ll run some tests and look into it further.

    Something that might be of interest… At work I wrote a script that reads the attributes of the pointcloud and creates the geometry directly in the scene. It also plots the animation. This works really well, and it’s a simple script to write.

    Cheers,
    Andy

  • Christopher said:

    I would be interested in learning more about your script. It sounds very useful. Can it read UV information as well? This is the reason I was using SaveRenderMesh. I am continuing to diagnose the failure with ICE and SRM. ICE looking like the culprit in this situation. Thanks for your time!

  • AndyN (author) said:

    Yep, the shader gives the option of spitting out UVs too. All this was written way before ICE came along (which seems like ages ago now), so don’t get your hopes up ;-)

  • Christopher said:

    I wanted to let you know I got the shader to work. I accidentally had the shader on two different objects, and the shader/MR tried to merge the objects when exporting. Which resulted in a jumbled mess or nothing at all. My fault. You shader works great. Thank you again.

  • Christian said:

    Hi,
    I am trying to save ICE strands with your shader, but i dont get it to work right, like mentioned above it works with the strand tree generator strands, but not with the default “growign strands” preset of ICE.. am i doing something wrong or can anybody confirm that?
    greets and thanx in advance,
    chris

  • AndyN (author) said:

    Hi Christian,
    Apologies, I don’t have time right now to test this right now for you, I’m flat out on a project. But I’ll try and look at it when I get some time.

    Cheers,
    Andy

  • Thomas said:

    Unfortunately nothing works for me. I applied the shader as described to the geometry which will be instanced by an ice emitter. I press “render current frame”, but no file gets written to the HDD.

    What needs to be done in order to get this to work? A special render menu from which to start the rendering?

  • AndyN (author) said:

    Hi Thomas,
    No, you don’t need any special menu to get it to work, in fact, it’ll work just in the render region, and you don’t even need to render the whole frame. All the work is done in the preprocessing part of the render.

    I suggest that you might want to try it on a simple object first before trying it with ICE instances. Just to make sure you understand the process. Trying to use it with ICE is generally a bit flaky for some reason, so don’t be surprised if it doesn’t work.

    Cheers,
    Andy

  • JevgenyS said:

    Doesn’t work in Softimage 2013 :(

  • AndyN (author) said:

    Okay. Will look into it.

  • JevgenyS said:

    Thank you very much for your hard work Andy!
    I love your tutorials

  • JevgenyS said:

    Saw a video tutorial. But forgot where it was. Maybe you know it

  • JevgenyS said:

    Cant get the OBJ created in SI2013

  • JevgenyS said:

    Si2013 doesnt provide the node lightmap_color

Leave your response!

Add your comment below, or trackback from your own site. You can also subscribe to these comments via RSS.

You can use these tags:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

This is a Gravatar-enabled weblog. To get your own globally-recognized-avatar, please register at Gravatar.

Security Code: