Home » Download, Featured, XSI

SaveRenderMesh

15 February 2009 38,540 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...

59 Comments »

  • 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=""> <s> <strike> <strong>

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

Security Code: