Previously a production blog for my final year project ( you can still find the old posts of WIP images) YOu have stumbled across a collection of knick knacks and tutorials for 3D CG...

Friday, January 29, 2010

physical sun sky

Using Sun and Sky in Mental Ray with Maya



Application Used: Autodesk Maya

Author: Bogdan Amidzic

Contact:the@cavz.com

Author Website:http://www.cavz.com/



Using Sun and Sky in mental ray



With Maya 8.5 mental ray's got some new fancy options and modes. One of them is the Sun and Sky system. I'm going to guide you through some of new features.





Create a simple terrain and some object on it. I've created a high-tech tower, but you can make whatever you want -- just add some small details because I'm going to show you how to make them more obvious.








For starters, you'll need to load mental ray. To do that, go to window/settings preferences/plug in manager. Enable Mayatomr.mll





In render globals, choose mental ray. In mental ray globals, you can see the environment tab. Hit Create Physical Sun and Sky.





In the attribute editor, mia_physicalsky1 will appear. There are menu options, I'm going to show you only the few most important ones.





Also there's directional light in the scene. This light controls the direction of the sun and also the time.





If you render, you'll get something like this.





In quality presets, choose previewFinalGather. This will set sampling slightly higher than draft.





On sunDirectionShape, in custom shaders tab, you'll see that light has a light shader, and photon emitter connected.





Mia_physicalsun defines the sun itself. Samples define the number of rays used for shadows. Increase this number if there's noise in shadows.





In the hypershade, you can see all of the shaders used in the Sun and Sky system. There's mia_exposure_simple1 applied as lens shader on camera. This node remaps colors to the way human eye sees. In mental ray all intensities are in linear space. Human brain sees color in a different way. Basically it's a logarithmic function. That's why gamma is 2.2. That's the way we see, same thing for all photographs. So if you apply texture to objects you will get something like this:











It's washed. Why? Because texture has gamma 2.2. The way we see it. So mental ray uses texture with gamma 2.2 in linear calculations of light intensity and then it converts it to gamma 2.2 so we can see it right. So gamma 2.2 is applied twice. That's why the texture is washed. How are we gonna fix it? Simple -- use the gammaCorrect node. Apply gamma 0.454 to image. In that way it gets linear. Then renderer applies gamma 2.2, and it looks good.








In new mental ray, there's also a new shader called mia_material. It's a shader with lots of options, like glossy reflections, built in ambient occlusion, interpolation optimizations鈥?


Apply that material to the tower.





Apply texture with gamma correction.





Also set reflectivity to 0. We are not going to use it in this tutorial.





Also one more important thing about new mental ray. Final Gather has new options -- now it works pretty well with low accuracy settings (same as rays in earlier versions), point density defines how big the Final Gather radius will be. With 50, 0.1 results can be pretty nice and fast.








The thing I wanted to show regarding the mia_material is built-in ambient occlusion. So now final gather is used to get overall ambient lighting and ambient occlusion will darken corners, so details will appear. Ambient occlusion has a few options. Rays define accuracy; raise it if you have noise. Distance defines how far mental ray will try to find occluding geometry.





So without ambient occlusion..





And with ambient occlusion.





Also in mia_physicalsky, there's a haze attribute. Raise it to get foggy diffused lighting.





Red/Blue shift attribute controls the balance between blues and reds. Negative values mean more blue and positive more red.





1 comment: