However it has been made a bit easy to generate framebuffers in maya 20008
(also see previous notes to generate frame buffers using simple shader if you want quick results)
before we move ahead i would like to thank Maximilian Tarpini (ctrl.studio) for this wonderful shader...
Now how to generate framebuffers using ctrl buffers ??
First of all download and install ctrl buffers from http://www.box.net/shared/i6hd2271qk
Then we need to define the frame buffers in maya 2008
first step
First you have to create the frambuffers statements for the mr options. This can be done in the mentalray globals. Open the framebuffer section and click on the “Open Editor” button in the “User Framebuffer section”. This opens the attributeEditor for the miDefaultOptions node. Here under “Frame Buffers” you can add an framebuffer with the “Create” button (see right side).
In the appearing node, you can set the data type. For 8bit images the default is okay. The “interpolate samples” will add filtering to the samples, this means the little + sign mentioned above.
Okay very fine, you now have defined an framebuffer. If you open again the editor, you will see an new entry in the framebuffer list.
Great, the first step is done. Now we need a possibility to output the buffer to an image file. This has to be done in the camera. Select the camera an open its attribute editor. Go to the mentalray section, open it an do the same with primary output passes. Automatically the secondary output passes appears. Use the “Create” button to create a new ouptut element. Here you can turn on “Use user buffer”. In the popup menu below the checkbox, you should be able to select your previous created framebuffer. Do it. Then turn on “File mode”. Below you can enter an extension to your default file name. The file will be named like all other images, but with your new extension. e.g. sceneName_extension.001.sgi
Cool! Isnt it? So now you can render framebuffers. Of course you will only see black images. Why of course? Well, you have defined the buffers, but you didnt fill them yet. How can that be done?While you create it always remember that the first buffer is reserved by maya for its glow shader..
so for example
you have to define 4 frame buffers say diffuse,shadow, occlusion,specular..
so while defining framebuffers in mi options and in the camera define 5 buffers so the first one automatically goes to the glow shader...
also remember to make them non renderable in the output pass option in the camera..
Now to set up ur buffer write and buffer store ... for this there is a very good example on cgtalk i'll just copy paste it here to save time ....
second step
In this eample whatever is bold is something that is added in the new shader...
again thanks kmrsic for this wonderful tutorial...
To view the images right click and click on view to see the whole image..
First off you crate your geometry and a light. In my case poly plane, poly sphere and spotlight with depth map shadow with 720 for resolution and some softnes.
real nice : )
Now, after you installd your Buffer store mental shader you can find it under Mental Ray nodes (shaders) > Material Tab and select that nice colord buffer_store icon and drag it to your work area. This is like a combiner for your passes that will be output in render time.
You can see how it looks so far in the hypershade and atribute editor. Now for this thing to actualy work or better say output anything when you press render you need anoher node connected and its name is buffer_write. You need to drag and drop hem in you render camera mental ray tab Output shader. Heres an image.
There you can see all the "free" passes you can get without using bufer store as Alpha, Normal, Depth,....so its renderd as is.
Here you need to set to important things: where to store your frame buffers and what file format to use AND how many buffers to render. So, make sure that number matches the number of your frameBuffer passes. I set it to tif in my case and buffer range to 1 as Im only using one pass.
In the latest version the buffer range is for min to max if you are generating 4 buffers set the min to 1 and max to 4...
One more thing in the latest version of ctrlbuffer is .names...
you can name ur individual frame buffers here ..
if userfb.1 is named to shadow then the rendered image will be named as ***.shadow.###.iff
In this example its shadowpass.
Now on to setting up the whats the render pass. In this scenario Im only going to do shadow pass as this one seems to confuse many. The idea can be done in to simple steps.
First you create Use Background Shader and set it up to only catch shadow by pullin all the sliders to 0. heres an image
So, this one catches all the shadows and now I connect its OutMatteOpacity to OutColor of the new Surface shader that you need to create. This way you get Shadow that is stored as alpha to transfer to rgb image (in composite its luminance is your alpha).
And drag and drop that Surface shader node to your Buffer_store buffer1 texture tab and be sure to enable store.
In the image above you can see I got to shader chains so to explain the upper one its basicly dirt shader connected to surface shader Out Color and Im using it as a shader in the primary buffer (the one thats render on the screen). You can use it or not but someone mentiond that its a good idea to put something so you can set your sampling buy it need number. Basicaly when you press render in your render view thats the image its going to be renderd on screen and used for sampling. Now with shadow maps its actualy better to put them in primary buffer but then again its up to you to do some testing and see if its fine.
Assign your Buffer store shader to all the objects wanted in that pass.
Set your render globals. Use at leas 1 as min samples for shadow pass as it wont look good below one. And thats the number 1 drawback for using shdowpass in your framebuffer and not in you primary render buffer. Sampling! Takes to much. But Then again you need it for all the rest of the passes you make. So its render and figure type of situation.
PRESS RENDER ! ; )))
And go in to the folder you set your framebuffer write.
So There it is. I hope it helps little bit and I was not to confusiong. Forgive me for all typos and spelling mistakes as Im doing this on the fly while my boss is not looking : )))
Happy rendering.
more on ctrl buffers visit
http://forums.cgsociety.org/showthread.php?f=87&t=209991&page=9&pp=15