Mental Ray - Shaders


#1

Note from moderator
Hey guys, I moved this to the resources forum to have a focussed discussion about the creation of mental ray shaders, please keep it that and that alone. if you are having errors and shaderunrelated questions about mental ray, please use the regular maxforum

Cheers, Equinoxx

9/26/2005 - Since lighting questions periodically find there way into this shader discussion, I thought it might be helpful to add links to some of the existing Mental Ray lighting threads here at CGtalk. Please be sure to use these if appropriate, or make a new thread instead of posting lighting questions in this thread:
http://forums.cgsociety.org/showthread.php?t=120241&highlight=Mental+lighting
http://forums.cgsociety.org/showthread.php?t=124999&highlight=Mental+lighting
http://forums.cgsociety.org/showthread.php?t=247329&highlight=Mental+lighting
http://forums.cgsociety.org/showthread.php?t=202955&highlight=Mental+lighting
http://forums.cgsociety.org/showthread.php?t=227499&highlight=Mental+lighting
http://forums.cgsociety.org/showthread.php?t=196698&highlight=Mental+lighting
http://forums.cgsociety.org/showthread.php?t=128347&highlight=Mental+lighting


[SIZE=2]Here’s a brief overview of this thread:

Table of Contents:

	      	       Post:	       Page:
HDRI:		 	17		 2
			474		32

Glow/Glare:	 	61		 5
			191-192		13
			217-220		15
			583-584		39
			1259		84
			1297-1299	87
			1308		88

Amber:			1580		106

Max7 SSS:		1631		109

Lightengine
 Subscatter:		112		8
			133		9

Carbon Fiber:		78		6
			1645		110
			1664		111

Metal(lume):		103-104		7
			626		42

Dirtmap:		117		8
			122		9
			129		9
			272-273		19
			458-459		31
			739		50
			885		59

TransVol SSS:		146		10

IES with Max6:		159		11

Unlock Shaders:		179-180		12

Car Paint:		376		26	
			518		35

Anisotropic:		1121-1122	75
			1861-1875	35

Glass:			419		28
			1012		68
			1128		76

Ice:			1802		121 (Max7)
			1188		80
			1260		84

Photon(basic):		697		47

AOCC/SSS tut:		718		48

DGS materials:		676		46

Diffusion:		1053-1061	71
			1070-1079	72

How do I install these .mi & .dll files?
	Max(6):		438-439		30
			232-236		16
			510		34

	Max(7):		1655-1660	111

Does Bucket size matter:201-204	        14

1/25/09 - Here’s some more current, useful mental ray related sites:
http://mrmaterials.com/
http://www.mymentalray.com/index.html
http://www.mentalboutmax.com/
http://mentalraytips.blogspot.com/
http://jeffpatton.cgsociety.org/blog/

‘library’
I will try and keep all posted maxfiles up to date in this initial post.

8/26/04 - Update: I’ve started compiling all this info onto a part of my website.
http://jeffpatton.net/Mental-ray.htm

Get the .MAT file here updated 4/27/2005

I’ve converted most of the architectural materials to DGS materials here:
DGS-architectural materials

“The .mat file gives me missing .dll errors on startup”…you need to make sure you have all the extra shaders that are discussed in this thread. I’ve posted my MR folders in .zip format to make this a bit easier (these are old and from Max6…so they may not be compatible with newer versions of 3dsmax).
Link removed because files were outdated.

Along those lines, David Baker from maxplugins.de has added a mental ray section onto maxplugins.de. You can find most of the shaders listed in this thread (and some that arent), at his website. And they are updated as new versions are made. So be sure to check his site here:
http://maxplugins.de/

If you have this question: “Ok, I have downloaded this .mat file…what do I do with it?”, I’ve made a quick video that illustrates how to open a .mat file in 3dsmax. You’ll need the techsmith codec to view the video…if you don’t know where to get the techsmith codec, search google for techsmith codec. Here’s the video:
jeffpatton.net/cg-post/matlib.avi

Get the HDRI Files here


Glass - 3s - by Folical9

Rubber - 3s - by Cabbage


[/color][/size]

Well, I think I have “issues”. I’ve been on a non-stop SSS/translucency journey since installing my copy of ver.6. I’ve finally made a glass w/SSS material that I’m pleased with.

It took a while to render (4 hours), but here’s my result. I have disabled caustics on my ground plane because I still have a couple of tweaks to make with them. But it does generate caustics. There is only one light used in this scene.


#2

that looks pretty damn funky! :applause: Is that the architectural glass material in action?

//edit: Is that light emitting photons? or are you using only the final gathering?


#3

Yes, photons, no final gathering. Not the Architectural glass either. It’s mainly caustics that are generating this effect. I’m using the “parti-volume” shader on a standard raytrace material.

Here’s a link to the document that helped explain the parti-volume shader to me:

http://www.uni-duesseldorf.de/URZ/hardware/parallel/local/softimage/Soft3D_html/mray/physics.pdf

Edit: I would also like to thank Martin Baadsgaard for his research on the Parti volume shader found here:
http://support.discreet.com/webboard/wbpx.dll/read?96515,198


#4

thanks for the link and the info! I’d love to see that ‘thingy’ animated. Slowly changing shape and pulsing…that would prolly look pretty kewl. I hope you can get the render time down a bit.
:thumbsup:


#5

Wow 4 hours to render.

I usually think that max has frozen up if a render has taken more than 15 mins.

Looks very funky btw.


#6

Really interesting research your doing there!

Too bad MR is really badly documented (in max) unless you really know what you are after and dig deep.

I tried to dublicate this scene with default scanline result was overally pleasing.

Rendertime with Fast Adaptive Antialiaser and AMD XP 2200+ was 24 min. 37 sec. I surfed while it rendered so comp wasn’t solely dedicated to rendering. It could have came out a little faster.

Only one light in scene. A blue omni inside that thingy. With raytrace AA turned off it comes much faster.


#7

ssalo: very nice indeed. You can do wonders with the scanline, for sure. Can you post any of your settings? Especially that translucent one from the other day.

I want to share the settings for the glass I made so others can experiment as well, so here goes.

Select to use Mental Ray for the renderer, then

(1) Create a Raytrace material. Set it up just as you would normally for glass. Two sided, and make the diffuse almost pure white. Thats it. I left the IOR @ 1.55

(2) In the Mental Ray Connection roll out add a Parti Volume (physics) shader to the Photon Volume slot and the Volume slot as well.

(3) Settings for the Parti Volume located in the Photon Volume rollout:

Mode is set to 2. I forget the name of this mode, but it’s listed in that .pdf file I linked to earlier. Scatter color is the default grey.

Extinction: You will have to adjust this based upon the shape & size of the item you are applying the texture to. I found mine to work best at 1.5

The only other points I adjusted were the minimum step length (2.0), and the maximum step length (8.0). Again, you will probably have to adjust these based on your specific model.

(4) Settings for the Parti volume shader located in the volume rollout:

Mode is set to 0

Scatter color: Make this the color you want to be scattered inside the object. I made mine dark blue.

Extinction: You will have to adjust to taste, but I set mine at 1.0

Minimum step length: 0.1
Maximum step length: 5.0

Thats it for the material itself!

Now apply this material to your object and make sure the object is set to generate caustics.

Next, you only need one light to shine on your model. I used a mental ray area spotlight, but a regular spotlight will work too.

I enabled raytrace shadows.

Under the mental ray indirect illumination rollout of the light:
UNCHECK the use global settings. The “on” box below will be enabled. I set the energy to 50000, decay at 2.0, caustic photons at 100000 (you will need to adjust to your scene). Global illumination photons are at 10000.

Once ALL of this is done, now your ready to render. Make sure you’ve enabled caustics in the indirect illumination rollout of the mental ray renderer. I set the samples to 64 on mine.

No Final gather.

Thats it, hit render and post your cool creations so I can see them!


#8

but 4 hours, can’t seem to use it in my skins shaders


#9

Caustics is a killer, isn’t it? I mean 4 hours…:surprised


#10

“but 4 hours, can’t seem to use it in my skins shaders”

Yes, thats a nasty render time, but my PC is not the fastest by any means (dual MP1600’s). Plus, I’m just learning how to use Mental Ray myself, so I’m no expert on what to increase / decrease to make a speedy render. Other than the basic samples, etc.

I really need a new PC. I may post my file if someone with a 3 ghz or higher Xeon system or newer Opteron would be willing to render it for comparison?


#11

I really need a new PC. I may post my file if someone with a 3 ghz or higher Xeon system or newer Opteron would be willing to render it for comparison? [/B]

Well I have a 3.06 Ghz P4 with a gig ram but I have Maya.

I do have something that might be able to import 3ds files, who knows. Or if you have an export to Maya thing, then maybe that too.


#12

Hehe, my machine would probably take days!:cry:


#13

Wow that looks dope. I am definitely going to try this out. Thanks for sharing the information Folical9! :buttrock:


#14

I have a 3.0 ghz pentium 4 with hyper threading and 1 gig ram.

I would like to render the file for comparison.


#15

I’ve made some adjustments and have the rendertimes down to somthing a bit more acceptable. The image below was rendered in 21 minutes and 42 seconds on my dual MP1600.

I should point out the white light at the base of the feet of the object. That’s not caustics. I have the ground plane set to not receive caustics. It’s actually the light being transferred from the object to the plane. It seems that if the glowing object touches something, it passes the light through to it. Odd behaviour none the less.

People have had problems creating the same effect, so I’m putting the above scene on my server. It includes the blue glass as well as this orange one. Also, if you dare, you can enable Final gather and turn the skylight on and render it. It’s setup for HDRI maps already. Render times will go WAY up though. But you will get nice transparant colored shadows.

Here’s the file:
Download SSS Glass


#16

Thanks for sharing m8! I tried to recreate the material with your instructions but I didn’t even come close to your results. The object would always get totally blown out (white) and I did not manage to tone that down… :shrug:


#17

No problem. If you guys get some neat renders, please post them so I can see!

Also, If you need the HDRI maps that I used in this scene, you can get them from this previous download:
HDRI scene


#18

Here’s what the HDRI render looks like if you enable the skylight on the scene (render time 42 minutes 12 seconds on dual MP1600)


#19

folical9, Just Thanks for info and files…

Why mentalray(in max) is very different from mental ray in other 3d packages(I’m talking about sss) ???


#20

This is what I get when I render. It’s at a slightly different angle, and I zoomed out to save render time. Looks almost identical to yours other than yours has a slight glow around it. Did you do any post-processing in your image?