View Full Version : Mental Ray Error: Called on an unexpected ray

09 September 2004, 01:46 PM
I pretty often get the error message from Mental ray:
PHEN warn: Called on an unexpected ray.

I have no idea what he's talking about and couldn't find anything on the net about that. The error gets displayed while emitting photons from lights. I have standard global illum settings, standard final gather, standard photon emission from light and just maya shaders and lights.

There's also a box around the whole scene.

Can anyone help please?

12 December 2004, 12:28 AM
Hopefully this isn't too late of a reply for ya. It's only been three months. ;)

I hit this problem myself last night and found your post through google. Even if you've fixed the problem already, hopefully this will help someone else in the future who might run into it.

Anyway, the problem is simple: one or more objects in your scene is assigned to a shading group which has no shader attached, and you're using global illumination (I'm guessing caustics might also make it happen). To fix the problem, you have to find which shading groups have no shaders attached, and make sure they do! Also, running an optimise scene would help. This happens when you delete a material, but not its corresponding shading group, or forget to assign a new shader to whatever objects have these shading groups assigned.

Here is a bit of MEL code which will seek out and select shading groups with no materials. Just copy and paste into the script editor, and hit ctrl-enter (or select the script menu, then execute). Then you can do a graph input connections on them in the hyper shade, which will give you a list of connected objects, as well as allow you to go through and attach shaders if you need to. This is really hack and really quick and only searches for shading groups missing standard surface or volume shaders, or a mental ray material shader.

string $sgs[] = `listSets -t 1`, $badSGs[], $obj;
int $connected, $i = 0;

for ( $obj in $sgs ) {
$connected = (
`connectionInfo -id ($obj + ".surfaceShader")`
|| `connectionInfo -id ($obj + ".volumeShader")`
|| `connectionInfo -id ($obj + ".miMaterialShader")`
if (!$connected) $badSGs[$i++] = $obj;
if ( size($badSGs) ) select -r -ne $badSGs;

CGTalk Moderation
01 January 2006, 04:00 AM
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.