2d DOF solution in mental ray

Become a member of the CGSociety

Connect, Share, and Learn with our Large Growing CG Art Community. It's Free!

Thread Tools Search this Thread Display Modes
Old 10 October 2012   #1
2d DOF solution in mental ray

You know how slow 3d depth of field is? So the solution is a zdepth pass and a filter in After Effects, Nuke or whatever compositing package anyone uses. Why isn't there a 2d solution from within mental ray to do just that? I'm not capable enough with MEL script to automate a ZDepth render that blurs a beauty or diffuse pass with the click of a button, but it would seem like a possible solution.

Just a brainstorm.
Old 10 October 2012   #2
Depends on what are you doing If depth of field is the hero, then 3d is the way (I use 3delight and sometimes can be slow too) otherwise, it is better to keep it as a post process.. for those cases I love bokeh for nuke.

But also the new zblur in the nuke beta looks really good. I think dof will be handled by deep compositing.
Old 10 October 2012   #3
Quote: Why isn't there a 2d solution from within mental ray to do just that?

Because a 2d solution would be exactly what you're doing in Nuke or AE, except without all the controls. . . .
My opinions are always my own...and maybe a friend's, but never my employer's.
Old 12 December 2012   #4
Post Production Plugin for Maya Mental Ray

Hi and greetings to all member of this forum !


I also wanted to have that 2D Dof feature in maya mental ray.

Thats why i decided to write my master thesis about this topic.

Here http://www.youtube.com/watch?v=zhaZsgGWVtM
you can watch my results.

I implemented a post production plugin for maya - mental ray.

Beside the DOF effect you get two other basic color correction filter like color balance and hue&saturation.

The interesting part of my plugin: Every filter is adjustable in some sort of "realtime" through the render view. My development ist like a mini Version of After Effects inside Maya.

My youtube demonstration video is in german. Sorry for that.

Just have a look from minute 5 on. The interesing part begins there.

I am looking forward for your and the others opinion.

Peter Salziger from Germany
Old 12 December 2012   #5
Awesome. That's what I was talking about. Why wait for a post program? I don't use Blender, but the thing I like about it is that compositing can happen without leaving the 3D program. I think Cinema 4d has something similar. I wouldn't be surprised if the merger of Luxology and The Foundry resulted in a compositor within Modo.

mental ray can read a grayscale image
mental ray can do a gaussian blur

Why can't mental ray blur an image based on another image in something close to realtime, like the mia exposure preview.

@winniban I wish I spoke German.
Old 01 January 2013   #6
Youtube engl subtitles.

Hi, thanks for your reply

The last two hours, i wrote english subtitles for youtube

You can activate them on the bottom right side.

I hope that all non-german guys can understand it a little bit better now


Old 01 January 2013   #7
Sehr schön Herr Salziger.

Ich würde es gerne auspobieren, hab aber nur M 2013. Eine kleine Frage:
Werden die Einstellungen im Batch Rendering übernommen?
Old 01 January 2013   #8
Danke SGIFreak,

exakt, die Einstellungen sind in den Batch Render Prozess integriert.

Das Ergebnis sieht genauso aus, wie bei der Bearbeitung.

Werde die Tage versuchen, das ganze auf Maya 2013 64 Bit (Windows) zu kompilieren.

Melde mich dann wieder und würde mich freuen, wenn Sie das ganze dann auch einmal testen könnten.

for the english speakers: yes, my plugin is batch render capable. release for Maya 2013 will come soon.


Edit: this is a bokeh renderin example generated from my plugin.

The scene is just a flat box with a 2d picture mapped on it.
Old 01 January 2013   #9
Hi winniban,

I just watched the video of your plugin and I think this is a great idea
I'm using After Effects to generate DOF and motion blur, so having a way to predict my outcome or maybe even implementing them inside Maya in some scenarios could be awesome.
I have two suggestions:
1. Because the effects are added as a post process, when batch rendering, I think this could be great if your plugin will a. save a version of the file as the raw image that come out from mental ray, b. then add the post effects from your plugin and c. save another file with the embedded effect. that way one will have, for each frame, the source and the post processed versions. I'm talking about using the same render, and not rendering it twice like with render passes. I hope this is something that can be done.
2. Motion blur - you can use motion vectors pass to have MB as a post process as well, I think MB and DOF together as a preview is a great combo.

Thanks for sharing your plugin, and continue with your great work!
Old 01 January 2013   #10
Thank you very much, oracio !

I am thinking of saving the actual raw rendering as well since a long time.

It is really a must have as you already said it and implementing that feature shouldnt be that much work.

I will add another option like "save raw mental ray rendering" including a custom prefix in the next version.

Motion Blur is also a great idea. You can already add the mib_motionblur node manually to my special shaders. It will be rendered through batch rendering. But currently, you cant get any preview from it in render view :( In order to get that render view preview, i had to restructure the outputshaders. it was a littbe bit tricky to get immediate access to the render view.

As far as i know, i have to write my own blur filter in order to get its preview in the render view. if i could find the original mib_motionblur sourcecode, it would be great and maybe 10 minutes of work to implement it into my "framework".

"so having a way to predict my outcome or maybe"

I am quite happy that you support my actual intention of previewing. Its also a big topic in my thesis.

Old 01 January 2013   #11

Hi There,

i recently updated my plugin.

1. edge repeat - no more black edges near the borders (dof)

2. autofocus - the camera aim will be the focus plane

2 min demo

Old 01 January 2013   #12
Nice work, thanks
Old 01 January 2013   #13
Hi Peter,

The auto focus is a great idea
I'm thinking of trying your plugin with a real scenario - in a project that I'm currently working on, where I want to show the people that I work with the DOF that I plan to do later on, in an easy and quick way - like your plugin enables to.

I have 2 questions:
1. Do I need to use special shaders for your plugin to work or can I use the mia_x / Maya default shaders?
2. Does your 2D DOF map that your plugin creates in the background supports semi transparent shaders, and the most important - shaders with cutout opacity textures?
this is the culprit with the built-in 2D DOF map in MR, it has issues with cutout opacity, so I need to use workarounds that takes time to be implemented, and if I want to show someone the DOF that I'm going to use in the middle of my work, your plugin becomes a big time saver.

Old 01 January 2013   #14
Hi oracio,

first of all, you can use any maya shaders you want.

My 2D processing begins right after 3d rendering has finished.

I dont use an own generated z-map. I use the one which mental ray gives me during render process.

Thats the point, as far as i know, i havent testet it for myself, the MR z-map doenst support semi transparency and cutoff opacity :( Another problem are raytraced mirrors which are also not processed into the z-map by mental ray. Nparticles, which are not convertet to poly planes are not visible in the z-map.

I am still trying to figure out how to generate my own "realistic z-map", it is still in process.

But feel free to have a try on artization.de

Old 01 January 2013   #15
Thread automatically closed

This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.
CGTalk Policy/Legalities
Note that as CGTalk Members, you agree to the terms and conditions of using this website.
Thread Closed share thread

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Society of Digital Artists

Powered by vBulletin
Copyright ©2000 - 2006,
Jelsoft Enterprises Ltd.
Minimize Ads
Forum Jump

All times are GMT. The time now is 07:20 PM.

Powered by vBulletin
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.