PDA

View Full Version : Previewing Mental Ray Shaders in Hypershade?


Jaidek
03-30-2007, 03:20 AM
Hi All,

Is it possible to enable the swatch preview (sphere) on certain Mental Ray shaders in Maya 7? I am working with many T2S_Illumination and mia_materials and would like to be able to visually distinguish them from one another.

Thanks!

lephino
03-30-2007, 03:16 PM
Only thing I could recommend is changing your icon files for the materials... In maya 8.5 most of the materials now show a preview for the materials.

Puppet|
03-30-2007, 03:27 PM
Yes, you just need edit your mentalrayCustomNodeClass.mel file.
For example add your shaders to list, like this:

if ($nodeType == "mib_illum_lambert" ||
$nodeType == "mib_illum_phong" ||
$nodeType == "mib_illum_blinn" ||
$nodeType == "mib_illum_cooktorr" ||
$nodeType == "mib_illum_ward" ||
$nodeType == "mib_illum_ward_deriv" ||
$nodeType == "mib_illum_hair" ||
$nodeType == "dgs_material" ||
$nodeType == "dielectric_material" ||
$nodeType == "path_material" ||
$nodeType == "mi_car_paint_phen" ||
$nodeType == "mi_metallic_paint" ||
$nodeType == "misss_call_shader" ||
$nodeType == "misss_fast_shader" ||
$nodeType == "misss_fast_simple_maya" ||
$nodeType == "misss_fast_skin_maya" ||
$nodeType == "misss_physical" ||
$nodeType == "misss_skin_specular" ||
$nodeType == "p_constant" ||
$nodeType == "p_MegaTK" ||
$nodeType == "p_z" ||
$nodeType == "transmat" )

return "rendernode/mentalray/material:shader/surface:swatch/mentalRaySwatchGen";
...

Jaidek
03-30-2007, 05:59 PM
Puppet|,

Thanks for the help! I just gave that a try and I am still not having any luck. All of my mental ray shaders are highlighted red, and still with the generic shader icons. Any idea what might cause this?

victor
03-30-2007, 06:19 PM
Is there any way to control what gets rendered for the swatch? Is that scene described somewhere? Can it be modified, and even used for Maya shaders?

bgawboy
03-31-2007, 03:05 PM
The method Puppet showed should work. I think I tried it as far back as Maya 7.

To be clear, you added it into the same clause he indicated, you restarted Maya and saw no errors (from potential typos), and the declarations on your shaders have 'apply material'?

And I would try first just one shader at a time, using a step-by-step approach to get where I want to go.

bgawboy
03-31-2007, 03:08 PM
Hmm. It is also possible that those shaders come packaged with contradicting mel files. I have not looked at them.

Jaidek
04-01-2007, 03:44 AM
Hey All,

I double checked everything and it is exactly as Puppet had described. I just noticed that it does this for all of mental ray's shaders. I know it hasn't always been like this. I am starting to think it may be my new video card (went from GeForce 4 4600ti to GeForce 7600GS). Anyways, here is a screen shot of what I am seeing. I have killed my prefs, updated video drivers and even tried working from one display...but still no luck.:sad: Any ideas or things I might have missed would be greatly appreciated.

http://img177.imageshack.us/img177/8601/hypershadeum3.jpg

Thanks!

Gabba
04-01-2007, 08:54 AM
Umhz... If the materials are highlighted in red, it think it means that MR is not the render engine that will render. For the problem of the preview, check if the materials are loaded under Windows/Rendering editor/Mental Ray/Shader Manager. No other ideas, sorry :shrug:
Gabba

bgawboy
04-01-2007, 08:44 PM
Ahh, those are file swatches, not interactive rendered swatches.
In the Help doc, see "Swatch rendering in mental ray for Maya" for more details.
I'm looking in Maya 8.5, but I think it was there in Maya 7.

Check to see the mel script was read in correctly, by using getClassification <nodeType>, eg.,

getClassification mib_illum_lambert;
// Result: rendernode/mentalray/material:shader/surface:swatch/mentalRaySwatchGen //

Your custom shaders, if entered correctly in the mel file, should return the same.


Indeed, the red indicates that the Maya Software or Hardware is currently selected instead of mental ray, but I assume that mental ray was chosen at one time, since they wouldn't even exist if it hadn't been loaded in at some time.

I'm not sure this has anything to do with video cards, because interactive swatch rendering is a software thing.

Jaidek
04-02-2007, 02:57 AM
bgawboy,

You nailed it, Maya is loading a File swatch instead of generating an interactive preview. Here is what I get:getClassification mib_illum_lambert;
// Result: rendernode/mentalray/material:shader/surface:swatch/File //

Here is what is entered in the shader section of my mentalrayCustomNodeClass.mel:
if ($nodeType == "mib_illum_lambert" ||
$nodeType == "mib_illum_phong" ||
$nodeType == "mib_illum_blinn" ||
$nodeType == "mib_illum_cooktorr" ||
$nodeType == "mib_illum_ward" ||
$nodeType == "mib_illum_ward_deriv" ||
$nodeType == "mib_illum_hair" ||
$nodeType == "dgs_material" ||
$nodeType == "dielectric_material" ||
$nodeType == "path_material" ||
$nodeType == "mi_car_paint_phen" ||
$nodeType == "mi_metallic_paint" ||
$nodeType == "misss_call_shader" ||
$nodeType == "misss_fast_shader" ||
$nodeType == "misss_fast_simple_maya" ||
$nodeType == "misss_fast_skin_maya" ||
$nodeType == "misss_physical" ||
$nodeType == "misss_skin_specular" ||
$nodeType == "transmat" ||
$nodeType == "T2S_Illumination" ||
$nodeType == "mia_material_roundc"
)

return "rendernode/mentalray/material:shader/surface:swatch/mentalRaySwatchGen";

Once again, any help on this would be greatly appreciated.

Thanks,

Jaidek
04-02-2007, 07:59 PM
Hey All,

I got it figured out. Somewhere along the line a shader package included an extra "mentalrayCustomNodeClass.mel" in the local scripts folder. So the two were conflicting and causing MR to default to File swatches.

I want to thank everyone for all of their help on this, I greatly appreciate it. :thumbsup:

MaNdRaK18
04-24-2007, 10:12 PM
Hey All,

I got it figured out. Somewhere along the line a shader package included an extra "mentalrayCustomNodeClass.mel" in the local scripts folder. So the two were conflicting and causing MR to default to File swatches. :thumbsup:

What shader package and where?
I have the same problem, and can't seem to find other script that clashes.

Jaidek
04-24-2007, 11:51 PM
Hey MaNdRaK18,

The script that was conflicting on my system was an additional "mentalrayCustomNodeClass.mel" in my local script folder (My Documents/user). I would suggest doing a search on your machine for mentalrayCustomNodeClass.mel. If you find more than one, delete the one that is not in your Maya installation folder. I hope this helps! :thumbsup:

CGTalk Moderation
04-24-2007, 11:51 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.