PDA

View Full Version : Maya 2009 (overriding pass attributes)


wabash
10-29-2008, 03:59 PM
Hi there,

I'm wondering how I can override individual settings for Maya 2009 passes. For example I want to change the "Max Distance" & spread for the ambient occlusion pass. Where does maya come up with it's settings for the passes? Does this need to be done in the shader?

Thanks :)

Hamburger
10-29-2008, 10:29 PM
You can still do it the old way. Maya's render layer overrides seems to be much more stable in this regard and can override per face shader assignments without breaking (well at least in my scene tests they are much more stable).

However I'd love to know the answer to your question with the new render layer method.

djx
10-29-2008, 10:59 PM
The best workaround I have found so far, if you do want to use passes, is this:
Create a customColor pass and a writeToColorBuffer node. Connect the output of a mib_amb_occlusion to the writeToColorBuffer. But to get that to actually render into the customColor pass it needs to be somehow connected to each objects shadingGroup. So my hack is to also connect the mib_amb_occlusion output to a multiplyDivide node and multiply by zero. I then connect the output of the multiplyDivide to something on all my materials where it will not do any harm. For mia_material_x that "something" is conveniently the "Additional Color".

If you are using mia_material_x for all your materials, and you are already using the materials inbuilt amb occl, then you can get the AO pass quicker by taking it directly from the mia_material_x.ao_raw to the writeToColorBuffer. But then you need a writeToColorBuffer for every material.

I'm posting this here in the hope that someone will laugh at it and tell us a better solution :)

-- David

wabash
10-30-2008, 02:54 PM
Hi David,

Thanks for the response, I'm giving it a shot! There are several custom shaders that I would like to use in replacement of the default setup that 2009 specifies. Hopefully I can figure out a few of my favorites.

Thanks,

Bill...

p.s. I think your blog is great, an excellent resource.

wabash
10-30-2008, 07:36 PM
HI DJX,
I did your trick and it worked.
I left out the mult/divide node because it was causing the object to render black. Why did you add that?

Are there any extra places (or go to non-used slots) on the mia_material_x where you can plugin shaders that won't affect anything?

Thanks again.

BIll...

djx
10-31-2008, 01:33 AM
I probably didnt explain it very well.
Essentially what I wanted to do was write an ambient occlusion pass into the same exr as everything else. So my mia_materials are set up for beauty etc and now I want to use mib_amb_occlude just for an occlusion pass, but not to affect the bauty pass.

So my mib_amb_occl connected directly (no multiplyDivide) to the writeToColorBuffer which connected to a custom color pass, but it just got ignored at render time. So to force it to be calculated I needed to have a connection between mib_amb_occl and the main mia shadingGroup - but not to affect it. This meant multiplying the occlusion so it would be black and adding that to the mia additional color slot. (The writeToColorBuffer still gets a direct connection from the amb occl though.)

I hope this makes more sense.

I'm still hoping that there is a way to expose some extra attributes on the default amb occl pass so that we can control max-distance. Seems wierd that they left that out in the render settings window.

Robbert
10-31-2008, 04:56 PM
If i use a writeToColorBuffer node then my render freezes at 30 %? Does anybody also has this problem?

djx
11-01-2008, 02:09 PM
That method I explained in my last post can be improved slightly.

Connect the mib_amb_occlusion to the writeToColorBuffer.color but dont mess around with the silly connections to the mia_material_x.aditional_color. Instead connect the mia_material_x.result to the writeToColorBuffer.evaluationPassThrough. Much more sensible I think.

However, I might also mention another discovery, for anyone exploring this new frontier. mia_material_x doesnt support the incidence and normal passes, but you can make them work by hooking up a black lambert to (you guessed it) the mia_material_x.aditional_color
(and no writeToColorBuffer required for this one)

-- David

MasonDoran
11-01-2008, 05:33 PM
to get the Maya 2008 style render passes with presets....just take a look in the script editor of 2008.



here is the .mel to get ambient occlusion pass:

renderLayerBuiltinPreset occlusion renderLayer Name;


You can then edit the AO texture that is created in the hypershade.

Also, this will work for all of the other presets from 2008.

what the script really does, is assign everything in that renderlayer a surface shader with an AO texture node attached. You can then of course view the render within the renderViewer itself just like you could in 2008.

MasonDoran
11-01-2008, 05:38 PM
here are all of the others:


diffuse pass:

renderLayerBuiltinPreset diffuse RenderLayer Name;

specular pass:

renderLayerBuiltinPreset specular RenderLayer Name;

shadow pass:

renderLayerBuiltinPreset shadow RenderLayer Name;

depth pass:
renderLayerBuiltinPreset linearDepth RenderLayer Name;

normal pass:

renderLayerBuiltinPreset normal RenderLayer Name;

matte passe:
renderLayerBuiltinPreset matte RenderLayer Name;

djx
11-02-2008, 01:55 AM
Thanks Mason, this is useful info, but speaking for myself, its not really what I am trying to achieve. The attraction of the new render passes (as opposed to the old style) is that they are split out of the main master beauty calculations so that no extra render time is wasted.
Of course the amb-occl method I wrote about actually does involve extra calculations, so it is a bit of a hack, but it does take advantage of the new ability to write it to the same exr. You can still view these passes in the renderview window by selecting them from the list in the rmb dropdown menu.

-- David

Robbert
11-03-2008, 09:57 AM
djx: Connect the mib_amb_occlusion to the writeToColorBuffer.color but dont mess around with the silly connections to the mia_material_x.aditional_color. Instead connect the mia_material_x.result to the writeToColorBuffer.evaluationPassThrough. Much more sensible I think.
Oke I tested this and it's working... I'm just using Blue as input color for the writeToColorBuffer instead of ambient occlusion (just for testing purpose).
It works if I use a scene with 1 mia_material_x_passes but it still makes the render twice as slow (it should not be so slow). If I use a scene with more materials then my render almost freezes again. Is this because i am using mia_material_x_passes instead of mia_material_x?

Ash-Man
11-03-2008, 02:48 PM
Just as a note, when using render layers
The render engine has to calculate all the layer elements > translate to MR (if used) > then render
Move to the second layer and do the entire process again .
As you see this will coast you some render time, Render passes is a better solution that render layers (unless you really have to)

strange_quark
11-26-2008, 11:16 PM
The attraction of the new render passes (as opposed to the old style) is that they are split out of the main master beauty calculations so that no extra render time is wasted.

i am attacking this issue today as well. i am have no experience writing a phen shader but i'm thinking that this might be the time to learn...

we need some extra slots added to the mia_mat_x_passes material so it will eval the extra stuff we need without playing silly tricks on it...

i'll let u know if i get anywhere..

p.s. nice blog.

Robbert
11-28-2008, 09:25 AM
Hey guys... i have been testing the custom color pass and writeToColorBuffer. I found out the reason that it goes so slow in my scene is because of Raytracing -> Max Trace Depth.
It makes it quadratically slower if you higher the Max Trace Depth number. But if you remove the custom color pass than the render goes fast.

strange_quark
12-01-2008, 08:24 PM
@ robert : oy ve... no ideas on that one.

@ djx : so i got a phen started, it has a miaxpasses that pipes thru two writeToColorBuffer. After some investigation, the way autodesk setup the writeToColorBuffer is both simple and incredibly complicated. In the write to color buffer there is an attribute called bufferOffset. this number actually controls which frambuffer will get filled. In the AE for the writeToColorBuffer you can simply choose the buffer name you want. But there is no way to tell which framebuffer number (bufferOffset) is being chosen. So far i have found no simple way to query which renderpass in the render gobals is which framebuffer. The only thing i can tell is, if you clear out all your passes from, and then add them back one by one, the first one you add is buffer 1, and the 2nd is buffer 2 and so on. This is why they coded this crazy complicated dropdown that somehow can figure out the buffer being used...

so long story short, the idea of creating a phen shader that has extra buffers already in it and prepared is looking pretty tough right now. it would just be esier to use the ctrl.studio buffers to do it i think. or maybe puppets. the autodesk implementation is easy to use, but ther is no way to get under the hood for custom buffers...

I'll do more research...

Robbert
12-12-2008, 10:02 AM
Does someone know how to get a customColor Buffer working with transparencies?
Need to make mattes with transparancies. There is an alpha attribute on the writeToColorBuffer node. But that does not seem to do the trick.

itos
09-26-2009, 05:02 PM
thanks MasonDoran for that info on the mel commands, i really liked how the passes were done in maya 2008 and then in 2009 everything changes and I was confused. Why instead of making it more difficult autodesk does not make it with an easier interface so we can spend more time in the creative process instead of the technical stuff? weird. Thanks for that info again.

itos
09-26-2009, 05:05 PM
with that method i can edit my ambient occlusion shader and see it in the render window, why canīt i do this in maya 2009 preset passes? or how can i do it? thanks!