View Full Version : Mental Ray materials missing when I render from Command Line?
01-25-2008, 10:26 AM
Hi, I have a simple scene that Ive set up the render globals to use Mental Ray and final gather etc. if i do a single test render in the render view in maya it renders fine.
But I want to render from the command line so i use
"render website07\3D\scenes\ANIMS\home.mb". it all renders but when i look at my files i have noticed its missed out any mental ray settings. My MR and SSS materials are missing?.. geometry with these on just dont render at all.
If i put a normal lambert on these objects it renders fine?.
Then i tried a completely new scene form a completely different project and the same is hapening. MR materials dont render and my Mib volume fog missing with command line?, bassically anything "mental ray" is missing. (see attached image "commandline_problems.jpg")
Im new to rendering from command line but read that i could use a command to ensure it uses mental ray , so i now try
"render -r mr website07\3D\scenes\ANIMS\home.mb"
you can see it starts to work and loads MR and my computer slows down a bit so i know its thinking about something, but 30 mins go by and i still get this (see attached image "mr_commandline.gif")
I thought if you set your render globals in your scene you didnt have to set anything in the command line..
any ideas what im doing wrong ?
THANKS very much
Ok I dont have a definite answer - just some questions really.
I notice you have some custom shaders mixed in with your standard mentalray shaders. In the old days people would edit maya.rayrc to declare these extra shaders. So the question is did you change maya.rayrc? Because you shouldnt. Just leave it as it was installed.
I would try removing the custom shaders from that folder. Try the render without them in there. I have come across custom shaders that stopped maya recognising anything else.
If that is not the problem, consider creating a seperate folder for you custom shaders anyway. It makes things neater and easier to manage. You then need to tell maya where to find them by editing Maya.env
So if you create d:\mentalray\lib and d:\mentalray\include you need to add this line to Maya.env
MI_CUSTOM_SHADER_PATH = d:\mentalray\lib;d:\mentalray\include;
Are you using TIF images for texture maps? Mentalray doesnt like TIFs most of the time.
Have you tried rendering to a different format? I think you said you were doing TGA - try IFF.
In my cmd line renders I always specify the project path using the -proj flag (and I have always put an absolute path) so your line might look like this
render -r mr -proj X:\website07\3D scenes\ANIMS\home.mb I am suspicious that without the project path defined, maya may be assuming the project folder is the above the one the .mb is in, and since you are using a sub-folder, maybe it is doing something wierd.
Sorry I cant think of much else, other than to start with a basic scene and add one thing at a time, rendering each time, to see when it breaks.
01-25-2008, 04:57 PM
Hi, thanks again for your dedicated help. I found out a few things today.
Ive only started using command line recently so my knowledge wasnt great, but....
firstly, the times i have used it i thought it was so much faster than rendering from a normal batch render in maya, but after realising no mental ray items were not being included and it being so fast, ive realised that all this time it was doing it with the software renderer!.
as soon as i included -r mr and your -proj tags i thought it was crashing as it sat there for ages doing nothing , but after looking in the images folder some were created and when checked in photoshop they are fine!..mental ray textures the lot!:rolleyes: it was just taking ages and ages
I had 4 images created, whats weird is in the command prompt with software renderer it shows info on every frame it does, but the MR doesent?
QUESTION: I thought if you set your render globals to MR etc that in the command line you didnt need to set MR? is this true?
I hadnt messed with any maya.rayrc file.. cos im not that advanced and would not know what im doing with it,:rolleyes:
also I dont think ive used any custom shaders, just SSS_fast skin shader, and the DGS_mental ray material which i coloured.
The real worrying thing is the whole reason im doing it from command line is that I cannot render from my really high end alienware machine, and i dont know why, i thought with command line even though i was only getting 20 frames rendered in one go it was better than nothing, but all this time i was using software rennderer which although crashes aswell, i get loads more frames completed. So now im real worried i wont be able to get more than one frame at a time done!
I tried some scenes on a 4 year old low spec pc with only 256mb of ram, and although it takes ages .. it still renders it!.. so its definitally something with my set up, but ive checked everything.
It sounds like as frustrating as it must be, that you have probably learned from this experience. I hope you figure it all out eventually.
What I meant with the custom shaders was that I could see from the cmd-line output text that you had a few in the default lib/include folders. I always try to keep the standard installation clean. Anything I add I put somewhere else and use maya's Maya.env file to tell maya where to look. Those extra shaders may not be used in your scene file, and they may be fine, but usually if I am having problems I try to eliminate all the extras from the picture just to be sure.
Rendering 1 frame at a time is not such a bad way to go. Thats how I do 90% of my rendering. I am using a render manager, so I dont have to contend with launching each frame render by hand though. I have found that there are many issues that go away when you render this way. The only disadvantage is the extra overhead of the scene file being loaded once per frame, but in most cases its a small price to pay timewise.
Im not 100% sure, but I think the answer to your question about globals and renderer is that it defaults to software (and your results seem to support that theory). If you want it to use the globals setting you can use something like this to render frame 7
render -r file -proj x:\maya\project -s 7 -e 7 scenes\xxx.mb
which is good for when you have different renderers specified for different render layers.
Here's a tip though. If you know that all your rendering needs mentalray, then specify "-r mr" and you will notice an increase in speed which can be quite significant in some cases - not for everything, but sometimes I have had a 20 to 30% reduction in render time.
01-29-2008, 11:54 AM
Thanks again djx,
I have to face it my expensive high end laptop will just not render mental ray. If i use batch render it crashes almost straight away, if i use command line it crashes even though i have forced it to use mental ray with render -r mr. and if i render on a really old pc at work...it renders fine with the same maya setup?
Ive now had to borrow another pc of a friend which again is low spec but at least it will render if even if it does it slowly. Im so angry ive spent £3200 on a high end machine and it wont render:twisted:
can i ask, you mention a render manager ? where can i get one of these?, is it a peice of software? If i had to render one frame at a time it would take me ages. Also alot of the time i cannot even get one frame done without it crashing:sad:
Ive just remebered i have installed the Mix20Layer shader that is used by many people. I followed their install instructions. but i got crashing before i installed this
also can i ask what the -file command does when used in the command line renderer?
Thanks again for trying to help, i really appreciate it.
render managers: I've used "smedge" for several years now and am pretty happy with it. If you want to try a free one, I think RenderPAL still has a free single user version (or you could try a trial of smedge). The idea is that the render manager software is like a front-end interface for batch rendering. If you have several (or many) computers you can easily render on all of them and manage it via the render manager.
-mr file: This tells mayabatch to use whatever renderer is specified in the scene file's render settings (used to be called render globals). With render-layers you can specify (via layer overrides) a different renderer for one or more layers. If you did that then you would have to use "-mr file".
mix20layers: I havent used it for a while, but be aware that many of the older custom shaders were written before maya 8.5, so the installation instructions may tell you to edit maya.rayrc. But since maya8.5 we nolonger have to do that, and it is best to leave it alone. My suggestion, to keep custom shaders seperate from the standard shaders, was so they are easier to keep track of and to trouble shoot.
01-30-2008, 12:44 PM
Thanks again, you have a lot of patience with me:rolleyes:
Looking at my maya.rayrc file i did have to put a line in it when installing mix20. my apologies
it was .. #This is for the mix20 layer shader
I think as a last try im going to do what you suggest, ill reinstall maya to get a clean install, then put my custom shaders elsewhere. Can i check how i do this please?
DO I, 1) create a new folder called custom shaders E:custom_shaders, and in this create 2 folders, 1 called lib and 1 called include.
2) open my Maya.env file, which is blank when i open it and type
"MI_CUSTOM_SHADER_PATH = E:\custom_shaders\lib;E:\custom_shaders\include;
3) put the necessary files in these folders and launch maya
Is this correct ?:rolleyes:
I dont know if this will get it working as I have the same set up with my maya.rayrc edited at work on my old rubbish pc and all renders fine... but anything is worth a go.
Im borrowing a friends basic low spec laptop for 6 weeks tonight so i can start to render at least.
One last question.. you know the brilliant environment you did for me to render in... is there a way i can turn down or off the amount of reflectivity on the ground plane?
Thanks for all your help.. it makes a forum really worth while, hope i can repay the favour one day. Even if i dont get my pc to ever render i have still learnt from you. cheers:)
01-30-2008, 01:37 PM
hmm. well u can put these shaders in with all the other MR ones as I have done and they work fine.
and the only time you mess with the rayrc file nowadays is to access the beta production shaders, which is a whole other can of worms ;)
anyway. it sounds like a path jobby.
have you tried something really simple?
I mean open your scene location on the desktop and copy its path and drag that into the cmd line, then type your commands in. least that way you know for sure it's looking in the right place.
mattock: Your proposed custom shader setup is correct, but take out the " before MI_CUSTOM..... (you probably didnt mean to put it in anyway).
lightcache: yes, mixing the shaders works fine, but I still like to have them seperated for clarity. Personal preference I guess.
mattock: You can turn down the reflection (or turn it off completely) by changing values in the mip_matteshadow node. There are several reflection related parameters in there.
Catch Reflections: on or off
Refl Color: controls the strength of the reflection and can tint it too
Refl Subtractive: if 0, the reflection is added to the bgnd color, if 1 the bgnd color is subtracted before the reflection is added.
Refl Samples: Increase the samples to smooth if Refl Glossiness < 1
Refl Glossiness: Blurred reflections
01-30-2008, 11:06 PM
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.