Mental Ray Basics


#1

So there are enough guides and movies out for Mental ray Caustics and GI, FG and HDRI but not much on the building of shaders and the use of all those fun nodes in the Hypershader. So here goes. This is Maya specific but might be of use to other programs, I dont use em so I duno.

First to install “most” mental ray shaders. They are made of 2 files usually with the same name ending with .mi and .dll extention.
These go in …program files/alias/maya6.0/mentalray/ the .dll goes into the “lib” folder and the .mi goes into “include”
The .dll being a link or translation for the .mi into Maya.
Then open the “maya.rayrc” file and you need to add a location for the shader you just pasted.
So in the “link” set add (link “{MAYABASE}/lib/Zimburger.{DSO}”)
and in the “mi” set add (mi “{MAYABASE}/include/Zimburgler.mi”)

Replacing “Zimburgler” with the name of the files you pasted into the folders above. Make sure you add these lines bellow the Mayabase line.
Then save and when you load mental ray into Maya in the plugin manager it will load all the correctly installed plugins. If a shader is more complicated than this is will have it’s own documentation, like the SSS-Skin shader has you install icons and scripts as well.

 Now I'll touch on some of the basics that I've found. 
 [img]http://n8zim.com/cg-tutorials/atribute-editor.jpg[/img]

You can apply both Mental Ray and Maya Software at the same time to an object. If you are just using only Mental Ray shaders your object will appear as if it is untextured in the hardware render (green shaded) or with the default Lambert. And depending on which renderer your using it will use the Maya nodes or the MR nodes.

 [img]http://n8zim.com/cg-tutorials/mr-vs-maya.jpg[/img]
 The Image shows a network for a sphere to render in both Maya and Mental ray render engines.
 The maya Blinn shader has the 3 checker nodes plugged into Color, transparency, and reflection.
 The Mental Ray shader has a checker plugged into the diffuse of the mib_illum_blinn.

Then the blinn is plugged into the mib_transparency (out value-input). The second checker node is plugged into the “transp” of this node.
Then the transparency is plugged into the mib_reflect (out value-input). The third checker node is plugged into the “reflect” of this node.

 [img]http://n8zim.com/cg-tutorials/ball-render.jpg[/img]

For the render I changed the diffuse/color to a Red color from the checker so we can see what’s going on. And as I’m still learning too I dont know what’s up with the shadows if anyone has any ideas. hint And finally make sure you turn up the raytrace a bit for the mental ray render or the faces visible through the front of the ball will appear black.

So while Everything is contained in one Node for the most part in Maya Software in Mental Ray each component needs it’s own node and they are then piggybacked together and plugged into the mental ray material shader of the objects shading engine.

Next Friday I’ll add the bump network information that I’ve found. But if anyone else wants to add info about other nodes I’d love for this to turn into a all inclusive guide. And it would be great if we could keep questions and comments focused so we dont have to search 20 pages to find the info we need thanks.


#2

Edited: Oh, it seems one only need to apply a “mib_shadow_transparency” (mode=1), to say L_glass shader and not a light shader in addition. My other shadows disappeared when using a light shader on the light and I havent figured out why.


#3

How can I use bump map on mental ray lambert shader PLS help me:sad:

.

.
.


#4

look for the “bumpcombiner” shader - it´s the only real solution


#5

Hey Undseth i messed around for a while but i cant figure out where the connect in the shadow and lights?


#6

Okay I dont know how to tweek this to much but i’ll post it and tell you what i know. My buddy Marc set up this Bump “cheat” for Mental Ray.

“mib_texture_vector” connected to “mib_texture_remap” (out value to input)
Then connect the outvalue of the remap into the coord of a “mib_passthrough_bump_map”
Plug a “mib_bump_basis” u and v into the u and v of the “mib_passthrough_bump_map” And plug you bump map into the “tex” of it as well.
The outvalue of the “mib_passthrough_bump_map” goes into the color_Base of a “mib_color_mix” and put your color map into the color_0.

Set the color mix
Number to 1
Mode_0 to 1
and everything else default (far as i know).
Only things to tweak are the Factor (depth) and the step (offset)


Grab the Maya file here.
Hope this helps some people,you can run it into the diffuse on any of the mib_illum material shaders.


#7

Really great tutorial…i love your teachings…

I hope you can go on.

A lot of beguinners need that!

REALLY THANK YOU


#8

Thanks for the great tutorial :thumbsup:


#9

I was going to post some stuff about layered shaders but the “Colormix” i used in the Bump map isn’t a great layered shader. I ussually use the Bump mix combiner and Mix8layer from highend3d. And there’s already some posts about them so i figured i wouldn’t double up. What else do you guys wanna know?


#10

hi this is great thanks
i was trying this dirtmap plugged into camera trick sometime ago but couldnt make work
can you check it out and make some tutor for that
thanks


#11

to get the transparent shadow in the MR shading group…add a shadow transparency node to the SG slot…and then map your checker texture to the transparency in the shadow node.


#12

no there isnt, all there are post praising the author of the shaders, then everyone pretend they know how to fully use them and ber cool.
i need to use the mix8 layer for my current project, its the only good layered shader for MR i hear of. but i can nver get it to work…
i have not yet used the bump combiner, but i would like to see it in action.
plz if u could make a tut for the mix8 by this week :wink: that would be great :slight_smile: im sort of pulling my hair out using the miss skin shaders as it is.

thank you for you efforts. i hope more contribute to this thread and hopefully it will be big enough to be stikied.
i also hope next time some shading guru decides to create a super cool shader, at least have the modicum of commun sense to explain how it works, and not just little bits of ambiguous replies to confusing threads.


#13

i use the mix20 by Pixero which is essentially the same as the mix8. It the mental ray version of layered Shader…and you have tons of different compositing methods.

What is so hard about using it? you simply middle mouse drag the shader from Hypershade into the slot you want(in attribute editor) on the Mix20 or mix8. Make sure it is enabled…

For more difficult connections you will have to use the connection editor.

for testing try using JUST textures…and layer those to get an understanding of how to use the shader.


#14

Hey Oodle, I duno what the “camera trick” is but the dirtmap/occlution shader has it’s own documentation and is very versitile. One way to use it is similar to the reflect or transparency I explained above. Connect the outvalue of your Shader into the base color on your dirtmap. Then plug the dirtmap into the SG material Shader. In this example i had to use two dirt map nodes one for the plane and the other for the torus. Put textures into the base color on them and the bright pink into the dirt color so you can see it.


#15

Here’s an example of some of the problems I have with the Bump Combiner and color mix plugings. Why are there three inputs in the place where you map the Bump map file? I assume it’s something to do with Normal mapping but i dont want to use a normal map. And when i map a file node into the bump on the Bump combiner i get a “type conflict: “m_bump_0” is type vector, “maya_file” returns type color” error. So what’s the node that translates a color input into a vector input?
Edit: Ahh i need to plug in a maya bump node, between the file and the bump combiner. Woo i’m cool.

Edit: Been Crazy busy with work. I’ll post some info about the BumpCombiner soon. Mix8 is so similar i’m not gonna bother to add info about.


#16

mi alpha
I can’t find anywhere how to control the alpha channel with mental ray shaders! How do you make an object appear white in the alpha channel? The mental ray networks make black holes, except where there are photons.
Thanks!


#17

Hehe Bitterpea, you’re roaming around with that question, eh? :wink:
Here are two solutions to your problem:

  1. Goto your ‘Renderglobals> Custom Entities> Pass Custom Alpha Channel’ and set it to ON

or

  1. Pass your mr shader through a standard maya surface shader by simply plugging it into the surface shader’s ‘Out Color’ slot.

I hope that helped. :thumbsup:

PS: This is like the No.1 question people ask… But I dont mind. :slight_smile:


#18

Thanks for posting that Floze. This is the perfect place for those simple but hard to find problems.

Now on to Bump Combiner : (i know it’s been forever but i’ve been busy)
So If you install the bump combiner correctly you should get a window like this:

And I’ve explained all the basic stuff right there. The inportant things to rember with the Bump combiner AND the mix8layer are:
When it sez “shader” it means put in a Mental Ray or Maya Software shader. If you plug an image or color into this you will get an image with no shading, spec, or bump. Kinda like NPRS with no ramp.
When it sez “factor” it means transparency of this shader, layer, bump and how much of the one bellow will be visible through.

You have to check the box to turn the bump map on, default it’s off so do this right when you create it or you might forget and spend 5 minutes trying to figure out why your bump doesn’t work. I know from experience.

Also make sure that the number of layers matches the number of bump or shader layers your using.

Now why is this thing so cool? Well first both the mix8layer and the bump combiner allow you to “translate” you maya shaders into MR so you can use the light linking and so forth with out having to build a crazy MR shader. Mix8layer works a little faster in this.

Second you dont have to use the bump hack mentioned on page one. You can just use the Maya shader bump depth node, or you can use normal maps.

And third you can easily layer shaders together (2 in the bump combiner) (8 in the mix8layer).

So have fun with that. It’s really changed the way I texture and my hypershader has stayed a lot cleaner thanks francesca and who ever made the mix8layer.


#19

hey cool thread here, keep it going!
Just again the link to the dirtmap/camera trick: http://www.cgtalk.com/showpost.php?p=1539723&postcount=19

cheers
felix


#20

yo Invader_Zim vbmenu_register(“postmenu_2116663”, true); got a question i loaded the dirtmap but i get a weird phenomenon error , i can see the shader but its dosent seem to work? any ideas? am i to complie something?