Mental ray flicker free FG


#18

I did another term at fxphd in January, primarily to do MasterZap’s Mental Ray class - WOWZA was it fantastic, and the main area I wanted to learn about was using FG with animations.
I learnt about that and SOO much more than I thought I would, really amazing stuff indeed :thumbsup:
The hardest part has been getting used to Maya, and using bizarre convoluted workflows to get things working in Maya as quickly as he showed in Max :banghead:

Awesome little render jeb :applause:


#19

Thanks a lot Jeb for sharing knowledge. I just tried rendering it, and it’s pretty fast as for a flicker-free GI. Of course it won’t be as fast as setup fake lights, but it’s pretty decent in quality. I got 1 SD frame for 3 mins, without GI it renders 20 seconds, but… the quality is pretty good. I’m not sure, why do you call it “AO”? Isn’t it just a brute-force? Or mental ray switches its mode to AO?
Adding some reflectivity to the shot added time without GI 1:05, and with - 12:27. So keep that in mind: once you add reflections, it won’t just “add” time, it will calculate them too for GI, not just like AO shader.


#20

-thanks Voidreamer looking up to see how it worked for you in maya. maya can be a pain in the neck when using mental ray some times, but also is cool because it exposes a lot of shaders max cant use easily like geometry shaders and such.

-RagingBull thanks too. hey do you know if those course will be available for download purchase or something. i really wanted to see them but didnt get the chance. most of the stuff i know about mray come from zap or jeff patton, so every tutorial they do about mental ray its bible for me.

mister3d to clarify why i mention the term AO a lot.
the actual ambien occlusion shader is a brute force method by itself in a way that it requires samples to clean the solution.SO Think about Final gather in its brute force method as an ambien occlusion solution but that also calculates light bounce, incandescence in materials, color bleed, etc… So basically YES i guess we could say it switches to AO mode when in brute force.

Also if you have used AO a lot you know that if you dont limit its distance search it can take a hell of a lot of time too. Thats exactly what Final gather in brute force is doing, calculating all that complex illumination to infinity with all objects in your scene thus taking a lot of time to render. Thats why interpolation exists. so one can use less calculations and then clean up that low quality solution by blurring and merging samples together and thats why we get flicker when using interpolated methods.

So as in AO shader the more you limit the ray distance search the faster it gets and the less samples you can get away with. The same happens with final gather in brute force. as explained in my previous post.

Sure its slower than just an ao shader or a faked lights setup because its calculating more than just occlusion shadows and also materials like arch & design use final gather to calculate some specular shading, but its pretty certain you dont get flicker and for me thats something i can count on in production. :thumbsup:

Of course, faked solutions can be pretty cool, in fact thats what i mostly use, but i like having the option to use final gather in a kind of quick way and without having to worry about artifacts and flicker. Specially troubles i have found while rendering in network. dunno if its my network having problems or what but sometimes other computers render the saved FG map solution a little different and produce small detail errors sometimes. i have to check up on that in the future. :shrug: :banghead:

I uploaded a simple scene to demonstrate, im also posting an image of the setup for quick review.

Test Scene

The scene has the final gather method active, you can switch it to AO method by turning off fg and turning on the omni light in the scene. Try not usint the fg preset slider otherwise the settings are lost. no need to turn off the skylight because without fg enabled mental ray doesnt use it.

I used mr exposure to give it nice contrast.

Also used a gradient ramp to have environmental color faking an hdr in a way, tho the ramp renders a LOT faster than adding an actual environment image.

Lit only with AO or FG no point lights used.

I would like to repeat that this isn’t the best solution, or the quickest or the most accurate but it does give interesting effects with predictable results.

If someone is looking to do image based lighting with hdrs maybe try staying away of this method because it will be slow if the hdrs are not treated properly and if not enough samples are used. But not saying it cant be done, just that it will increase render times.


#21

jeb, sorry I’m late to this thread, but how in the world did you get such a clean render with only 40 samples? If I render something with 40 samples, it’s very very grainy using the brute force method. Any info you could share would be welcome.


#22

Pixelmagic actually its 24 samples in that particular example. please download the max file i linked in the previous post. The trick is limiting the samples distance like one does with ambient occlusion. you can use a lot less samples and get really quick renders.


#23

Here’s a little quick and dirty guide for Softimage, but I think you can do this in Max and Maya as well :slight_smile:

http://www.i3dtutorials.com/tutorial/53_rendering-for-animation-with-final-gathering


#24

thats the way to do it alright, but for non animated objects. havent seen someone talk indepth about the interpolated frames along camera path method for fg maps. has anyone used it succesfully?


#25

Jeb: I checked out that link Jeb you posted about faking GI with diffuse convolution. I think its the same technique as the video below:

hxxp://immerg.com/index.php?option=com_content&task=view&id=346&Itemid=44

I’m still learning about mental ray, and I can’t seem to replicate the technique in maya. I plug in the ambient occlusion node and an environment sphere lookup nodes to the camera. However when I change the AO mode to 1 (sample environment) render time is slowed AND i get a black image.

I’m not sure what i’m doing wrong; has anybody tried it in maya successfully?

-Raimy


#26

In Maya you need to do a bit more stuff to get it to work. I’m no Maya expert but with a friend we managed to do the same as max. I will ask him what he connected exactly and then post it here.

But I remember the main problem was making the ambient light just do the occlusion and not diffuse coloring


#27

I’m still learning about mental ray, and I can’t seem to replicate the technique in maya. I plug in the ambient occlusion node and an environment sphere lookup nodes to the camera. However when I change the AO mode to 1 (sample environment) render time is slowed AND i get a black image.

Just create an area light. Check “use light shape”. Change high samples to 1.
Then under custom shaders rollout, add the AO shader to the light shader slot.
Then tweek the AO shader, and change the mode to 1.

Regards,
Mike


#28

Yeah its kinda like that… actually a bit different but also doable just like that in max too.

tho the settings are just a bit different.

you set one occlusion shader to be the diffuse conv by settings samples to 1, spread to 0 or 0,001 and distance to minimum too.

and actually just any blured map can do… not just spherical harmonics… just try it to be tileable

than in the video it shows in xsi to put the conv shader inside another AO shader inside the bright channel

but that in max doesn’t work that fine… it make a strange halo near contact areas of geometry.

so there is a nice workaround… grab the diffuse conv shader and put it into a composite map. then add another layer and put a regular AO shader you would use for pass for example… and set it as multiply.

you get the combined result nicely and clean… cool thing about it is that you can reuse the AO shader in another layer and multiply it again to get darker AO or some effects like that.

then you can plug the composite map into an omni light set as ambient inside the projector slot… and placed in (0,0,0) position

then you get the illumination from the shaders and maps and if used correctly is just as the result from final gather sans bounces.

I use it all the time and its faster than waiting for FG calculations and wont flicker


#29

Hey Jeb, thanks for your valuable tips! I tried making the FG and the diffuse convolution stuff. The FG worked like a charm, but the diff conv (omni in 0,0,0 with ambient only and occlusion map in the Projector Map) came out pretty bad. Can you help me nail the problem? Here’s some renders:
FG

Diff Conv


#30

Sure Glad to help,

Those artifacts come for sure from the Occlusion shader.

Here I uPloaded 2 files:
Sample Scenes

Both shown in the attached image to compare the difference.

One is called
Diffuse Convolution Single AO Environment method.max That one uses the raw AO environment approach using a hdr i provided there too. This method can take a bit more time to render because its sampling the hdr environment over all objects surfaces to give them HDR coloring.

Be sure to check out the parameters on the AO shaders because those are key. specially the SPREAD, TYPE and max distance

thats why i developed other method i find works nice, thats the other file

Diffuse Convolution Fast method.max its basically the same as the other but the ambient occlusion map is different.

it uses a composite map to mix 2 AO shaders that do different things.

the base “shading” AO just gives the surfaces coloring form the hdr. it makes the actual diffuse convolution process. the other AO shader is multiplied over the base one, and that one just produces the contact shadows. the differece is that the Base Ao shader Takes nothing to render, and the multiplied one is really fast too because its the common AO shader used in black and white to just produce contact shading.

Now this is really important and the actual cause of your artifacts. You need to filter your HDR files in order for this to work ok.

Probably you have seen all over that people use a smaller blurred hdr map for final gather to have less artifacts and thats the same principle here. Thing is that final gather internally makes a process to the hdrs called spherical harmonics. what it means is that makes an importance sampling blur to the map thus making the map less contrasted and easier to throw FG rays at the scene from them. so when you put an regular hdr to do FG on the scene mental ray its actually blurring it for you but if the map is too big the blur isnt enough and you get artifacts because FG needs more samples to reproduce that detail.

For better explanation please read here http://www.harrybardak.co.uk/diff_conv.htm i posted this link before.

So knowing this you just need to filter your hdrs to get better AO environment sampling just as in FG, but its important to note that Spherical harmonics isnt the same as just bluring. 1st blurring kills the seamless nature of the map and that probably why you have a black seam stripe on your geometry. and 2nd it will check for the most important parts of the image and give you nice diffusion and less contrast o the hdr image.

If you have the latest HDR shop application i believe it has a plugin for doing Spherical Harmonics filtering. But i always like freebies so here is an app that can do that too by using the same HDR shop plugin

http://www.hdrlabs.com/picturenaut/plugins.html look for diffuse SH

there you can get the picturenaut app and the plugins.

you can even download a load of hdr file there.

Well i think that covers it , let me know if something doesnt work.


#31

Hey jeb! Thanks for the scenes but unfortunately I can’t open them. I’m in max 2010 here and I guess you’re using max 2011. I’ll see if I can get these files open in max 2011 somehow, and in the mean time I’ll try to reproduce your results.

Thanks a bunch man! And if you ever decide to write a tut about it know that I’ll support you 100%!


#32

Oh man sorry, here

2k10 versions

3ds max 2010 versions


#33

Jeb! You nucking futs! Thanks a lot man!!


#34

Hey jeb, a quick question - when you load your HDR’s do you adjust their black and white points? And do you load them as Gamma 1.0, Gamma 2.2 or “Use image own Gamma”?


#35

I use image own gamma most of the times. only if i see results i dont like i change it. but hdrs usually have correct gamma (not always tho)

Also i use the default exposure. if i need to adjust contrast i use the curve on the bitmap node. or a color correction node.

those files i believe are set to output gamma 1.0 so if you are not doing 32bit exrs then maybe change that to 2.2 output


#36

Much thanks “jeb” for your explanation.


#37

No prob MF3dream

one thing to note for max 2011 (dont know if 2012 doesnt have this)…

when you open an hdr in max by factory default it is set to import it as 16 bit… but then one changes that to be 32bit and default exposure to use the image right… NOW that is a preference of the application. those image load settings don’t transfer on the file for example. so if you render on network when the other machine opens the hdr it might use the default 16bits setting if it hasn’t been changed on that machine. that means that the frames rendered by that machine will be clamped and it’ll be noticeable on the reflections.

it just happened to me this past weekend on a really important project. i forgot to set up those settings on my other network machines… funny that only my machine had that setting set since i was working on that one and the others are mostly render slaves that had a fresh max install. so only my machine had different(but correct) frames. i had to re render those only and went with the clamped reflections because i didn’t have time to redo the rendering.

Something similar happens when you save to exr with passes embedded into the file. when you press the include render elements check box on your machine for example, it will include the elements in the file. but if you render on the network and you haven’t set that check box up on the other machines you’ll end up with render elements files outside the original beauty pass aswell.

Just some words of caution.

glad to help