Mental Ray, Physical Sky, Visibility Distance Problem


#1

Hey Guys,

I’ve been experimenting with mental ray a lot lately (using Maya) and I am going to be creating a rather large city scene for my end of year project. I want to emulate atmospheric perspective. I have been researching for the last two hours about this, as I was first trying an environment fog but not really getting the results I wanted. Eventually I read about visibility distance.

So, I know changing the visibility without applying it to the lens won’t produce a difference. On a website I found the following MEL Script: connectAttr mia_physicalsky1.message cameraShape.miLensShaderList[0]; - That connected the camera with the physicalsky… so when I render it now it just shows the sky basically. Even if I set the visibility to 0.001 all the way to 10, it shows no objects, nothing, just sky. If I set it to 0, I see everything normally.

I was wondering if it was just the scene itself, so I tried it with simple objects with the same results. I don’t know if it was the size of the objects, so I may them very large, again with no difference.

Super frustrating! But the Lighting community on CG Society has been super helpful, so perhaps someone will be able to lend some advice.

Thanks,
Rob


#2

There is a VERY simple fix for this.
open your camera’s attributes in the attribute editor. Under the ‘mentalray’ rollout drag and drop your physical sky node into the volume input. Now the view distance paremeter under the physical sky node controlls the view distance in maya scene units, blending your scene with the sky :). Pretty decent, and cheap to render atmospheric perspective.

A side note, the whole physical sky system, any lighting in mentalray works best in linear light/color space. If you want to find out more about linear workflow just do a search on these forums , tons of info about it.


#3

Thanks, Linchpin!

I’ve been trying to apply your advice and it doesn’t seem to work. I did as you instructed but it doesn’t seem to be blending with the sky. I started a test file with some simple objects and it still isn’t working.

I wonder if I am doing something wrong, but I don’t think that I am.


#4

Oooh, I think I got it now, actually. I had it too high… the settings, that is. It seems when I lowered it, it started to work.


#5

Cool,
I use this quite often, so I know it works. If you want to increase the strength of the atmospheric try upping your haze value under the physical sky. You may also be getting odd results if you aren’t using linear workflow.

The reason why I’m stressing linear workflow is because you are using physical sun & sky which uses by default very high intensities. So the view distance color effects might be incorrectly blended in a non-linear scene.

   The math of lighting is all messed up if you aren't working linearly, textures etc can appear washed out in high intensity/physical lighting for example, 1+1 wont equal 2, it will eqaul 5. You dont notice the errors as much when working in low dynamic ranges, so if you had all your lights at intensities of around 1 or 2 etc. you wont notice the error so much. But for physically correct lighting with really high intensities you notice the error much more.
   
  The problem arises because all monitors have a gamma of 2.2 and 8 bit image formats have a baked in gamma of 2.2 to display correctly on monitors. 
 But most 32bit renderers work in a gamma space of 1 , so if any input data is brought into the scene at the incorrect gamma, say 2.2 , the renderer will yield weird results because the renderer is doing all of it's calculations as if that data was at a gamma of 1. 
 So linear workflow is basically the process of correcting this issue.
   
   Check out this quick 2 step guide to linear workflow by djx [http://www.djx.com.au/blog/2010/03/07/maya-linear-workflow-in-two-steps/](http://www.djx.com.au/blog/2010/03/07/maya-linear-workflow-in-two-steps/)

#6

Hmm…

Something is definitely going wrong when I try to do this (from what I read). First, when I connect the gamma correct node, the texture looks all weird in the real time viewer. It’s okay when it’s rendered though (which causes me to wonder if I did it properly). When I change the settings in mia simple exposure… it goes super washed out and saturated. i am doing something wrong but I have no idea what that may be.


#7

The darker color you are seeing in the viewport is fine. The maya viewport and preview swatches aren’t in linear colorspace, they are in SRGB, so stuff gamma correct for linear colorspace will appear darker.

I suggest reading the documentation about the mia_exposure simple. I tend to use the mia_exposure_photographic beause the settings in that lens shader are similar to a realworld camera.

Edit
Go here http://docs.autodesk.com/MENTALRAY/2012/ENU/mental%20ray%203.9%20Help/
and type ‘tone mapping’ in the search box, click on ‘camera exposure and effects’ in the search results, it will give you all the info you need.


#8

Thanks again!

In addition to your post I did some more research and found some helpful information. Now I have a better understanding of the pedestal/gain/knee etc and was able to fix the overblowness (word?) of the image by changing the gain to .2. It looks a lot better now. Also, earlier, I was connecting the nodes in hypershade incorrectly. The gammacorrect node wasn’t going into the correct channel but I believe I have it working now.


#9

Great.
Well I’m glad you’re starting to use linear workflow, it will also help tons if ever you want to get into compositing seperate passes of your renders. Without LWF your passes wouldnt add together correctly.

For compositing seperate passes using Linear workflow , you have to render to 32 bit uncompressed without your lens shader(you do tonemapping in post, as it isnt applied to seperate passes), combine your passes, and THEN apply your gamma correction/tone mapping in post.


#10

That sounds interesting, if not a bit intimidating. Sadly, the course I am in isn’t that great. I am learning almost everything on the side. It doesn’t really touch mental ray or compositing, but I am extremely interested in getting my images to look as amazing as possible.

I do plan to research compositing but it seems really confusing right now.


#11

I had the same experience.
I was also quite dissatisfied with my college only barely scraping the basics of 3D. We were told not to render things with mental ray or bother with it because it takes ‘years’ to master.
Most of the stuff that I know, which got me a job in the first place, was things I self-taught/researched.
Trust me its the best way to go. If you want to do online courses that are REALLY worth the money, try CG Societies CG workshops, or FXPHD.

They really go in depth and it isn’t crazy expensive like animation mentor etc.


#12

I’ve considered trying courses like that, but I am not sure if I can get canadian student loans for them, which is why I decided to take this one. At the very least, I am learning a little bit in class, then I just use the time and resources to improve myself.

Also, it helps that the lighting/modeling community on cgsociety is very, very helpful. I feel kinda bad nagging people for help though, but I am very determined to improve my art/3d.


#13

The CG Workshops are generally 8 week courses that are normally about 500 dollars.
I did a mentalray one in 2009.
You get weekly video lectures along with a private forum to discuss things with class mates and the lecturer. As well as the lecturer doing weekly crits on your weekly assignments. Theyre quite intense , but so worth it.

Atleast you have the right attitude and thats all that matters dude. Yeah it does seem like quite a mountain to climb from the begining but keep at it and you will get there. I mean I'm still forever learning new things, its the nature of the work, have to keep up with the times and trends etc.

Edit
Check out the Maya > Rendering forums, they’re quite active with people troubleshooting problems and exploring new rendering features and techniques. If you post your stuff in there related to lighting/rendering questions etc, you will get fast feedback :slight_smile: and really good responses. Tons of rendering gurus hang around those parts


#14

Thanks Linchpin! You’ve given me a lot to consider, and I will go bookmark the forums now.


#15

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.