How to save render elements to single multichannel exr


[Shaders updated on 2009.05.18 - please download again- lots of improvements!]

Hello all

  [Slide]( have just released a new tool for public consumption. It's a mental ray shader - slideElements - which lets you easily save multiple 3dsmax render elements to a single OpenEXR file for use in your compositing package of choice.
  Download the SlideShaders package from [here]( Installation and usage instructions are somewhere in the zip. It's built for 3dsmax2009 in both 32 and 64-bit flavours. The package includes the mrGeomShaderObject 3dsmax plugin and the Microsoft Visual Studio 2008 redists, which you will probably need to install to get the shaders to work. It should also work fine in 3dsmax 2010 (although this is not fully tested yet).

Please post any problems or questions to this thread - I’ll do my best to get you up and running with it.

  Massive props to [Puppet]( for releasing the source to his shaders, without which slideElements would not exist. Thank you so much for helping the community like this. To follow suit, we have also released a version of the archive with full source and Visual Studio 2008 project, also at the link above.


Will this work with max 9 64bit?


Highly unlikely, I’d guess - different underlying version of mental ray - but if you have a go perhaps you could post back with your results?



i have a problem, i don’t find the “slideElement” in my shader list. I think the shader is not installed. I followed your text files, and i copied the 3dsmax2009_win32 in my root 3dsmax which is : c:/program files/autodesk/3ds max 2009/

thanks for your help and thanks for your shader if it will works :slight_smile:



Sorry if the instructions were not clear. You need to copy the contents of 3dsmax2009_win32, not the folder itself.

This will merge the new “plugin” and “mentalray” folders with the existing ones.

Does that work for you?


Hi again!

ok, but it’s not working again, i haven’t “slideElement” in my shader list when i click on the shader of the “mr Shader Element”


Do you mean “mr Shader Element” - which is a render element - or “mr Geometry Shader” which is a primitive object you create in the same way you’d create a sphere/teapot/cube?

You need to use the “mr Geometry Shader” object - like this :

If you are, perhaps you could check the following :

  1. Does the mental ray message window (Menu -> Rendering -> mental ray Message Window…) pop up with any errors when you first open max?

  2. Do you have a file called “slideShaders.mi” in c:/program files/autodesk/3ds max 2009/mentalray/shaders_autoload/include/ ?


Hi, thx for your help!

Now it’s work just fine! I didn’t understand a step!

thank you very much for this :slight_smile:

EDIT: i have just a little problem with the shadow pass, in 3DSmax, when you save the shadow with the rendre element, it’s just a black image with some alpha. In my exr file, i have StdShadow.r and .g and .b, but it’s all black and no alpha channel?

Thanks again


Thanks a lot guys, its fantastic news. Its so much better to comp single exr file with all stuff in it. I think i’ll check naming conventions of exr chanels outputed by your shader (btw, can one edit naming of channels in shader without having recompile?) and create fusion macro for such exr’s

Thanks for all your hard work! And of course thanks to Puppet !


Vince - ah yes, at the moment it just saves RGB from each pass, which as you say wouldn’t pick up the important alpha for the shadow pass. I haven’t tried tweaking the shader to save RGBA, so I’m not sure if mr correctly generates this (it probably does though).

Do you know which other standard passes need an alpha channel? If we can come up with a list, I can hard-code it to additionally save alpha for these ones (in the same way I’ve hard-coded it to save just R and G for the Velocity pass).

Also, Slide will get back to you soon regarding your email :slight_smile:

Yukon - sounds like a great idea! We use Nuke here, and I know there are some macros out there which do a similar thing. Would be great to hear how you get on.

Regarding the shader in general : I’m glad some people are finding it helpful. I think it’s very much a ‘version 1’ at the moment, it’s functional rather than versatile. You can’t edit the channel names without recompiling, you can’t chose which of RGBA you want to save for each pass, and more importantly you can only save one instance of each render element. The last point is a problem if you’re using multiple mrLabelledElements or whatever to generate clean, filtered masks. It’s also fairly fiddly to set up and use.

So, our plan for the next version is to have a simple maxscript interface which looks at your existing render elements and lets you customise what the shader will do with them. It’ll then munge these options into a string which is passed to the shader and tells it what to do. Shouldn’t take too long to get it working (famous last words)…


For shadows you should probably be using something like ShadowPass instead.



Yes, i know about those nuke macros, its my inspiration source. But those macrose have a problems with a few last versions of nuke (5.0 V1+). Also i’ll try to help with list of elements that needs a alpha channel, and what we can do with shadows. I am going to play with your shader and if i’ll see any issues then i’ll inform you guys.


Shadow pass for max 7 and 8 good lord does it work on anything newer?


WaltherGropius, I want to ask if you can compile mrGeometryShader for max 2010 please, when you have some time. EXR output shader should work OK in new mr if i understand it correctly (its loads ok, just changed max mr version in .mi file)


As usual, Dave from the wonderful comes to the rescue!

That has both 32 and 64-bit versions in the zip.

We haven’t upgraded to 2010 yet - letting the dust settle a bit! - so I can’t test the shader. If you try it, please could you post back here with whether or not it still works?



I installed max 2010 (but only x32 version, 2010 trials where removed from AD website before i downloaded x64 version), so going to do some testing on both 2009 (x32 and x64) and 2010 x32. Of course i’ll post all my results ASAP, plus maybe i’ll record short video tutorial about SlideShaders pipeline.

WaltherGropius, if you need some specific tests or anything else i can do, please email me:
izaslavs at gmail dot com


Cool - thank you! I don’t have any specific testing requests right now but that’s a great offer.

The video tutorials would be cool - we were planning on doing a couple ourselves, probably when the next version is finished. There are some interesting subtleties to tackle, such as how to treat the StdVelocity element for different comping packages.

Actually, might as well explain that one right here. This pass consists of values centred around 0.5. Nuke expects values centred around 0, and also uses a reversed x axis to the 3dsmax one. So, in Nuke, you need to treat the StdVelocity pass with an expression node like this :

Also note the conditional, which translates to :

if(StdVelocity.x == 0)
StdVelocity.x = 0
StdVelocity.x = -1 * (StdVelocity.x - 0.5)

This avoids hugely blurring transparent pixels which come out black (R=0, G=0) in the original velocity pass rather than stationary (R=0.5, G=0.5).

I’m sure Fusion/AE need something similar…


I have followed your instructions and have nearily got it fully working, normals,object id work, all the pass names get merged into the file ok but are all black in fusion. when i do a render in Max the mental ray panel pops up with an error message.which reads " cannot map frame buffer:invalid fb index (23)" the numbers vary depending on the pass? has anyone else gotten this warning before?
please help.


Hi blue12 - have you actually added the render elements to the scene (in the render setup dialog), not just to the shader?


yeah I added the render elements and specified a dummy path as suggested. there must be some little step i have missed but im nearly sure i have followed everything word for word. if i dont render any elements it works fine and gives me no errors.its only when i start to add the elements i.e 1 for alpha,2 for atmosphere etc. i will have another look tomorrow and maybe do put up a screen grab?