MEL + Shading Group Error

Hi Folks,

Am a beginner in MEL. Recently I came across a video tutorial which am referring to learn MEL. Here’s the code –>

Code:

//- some code goes before this..

// create shading nodes
shadingNode -asShader lambert -n "petalColor";
shadingNode -asTexture ramp -n "petalRamp";

// shading group is connected via Sets
sets -renderable true -noSurfaceShader false
        -empty -n petalColorSG;

// Connect to color attribute
connectAttr -f petalColor.outColor petalColorSG.sufaceShader;
connectAttr petalRamp.outColor petalColor.color;

//- some code goes after this..


this is the error am getting after running the script :

// Error: The destination attribute ‘petalColorSG.sufaceShader’ cannot be found.

I have petalColor created in Material Editor & petalColorSG created in Shading group editor.

What could be the problem guys? :confused:

Thanks in advance.

Milk Shader

Hey,

I wanna develop a simple shader that looks like milk – not a very complex one but I noticed milk has a kind of translucency or subsurface scattering effect to it. My question now is, how do I combine a SSS-Shader with something like a Blinn or Phong to get control over the Specularity and Reflection as well?

I tried a Layered Shader but it doesn’t work with mi_sss 😮

Does anyone know how to set up this kind of shader?

cheers,

yaku

MEL: for loop commands and storing previous selections

The problem I have is that some commands in Maya work differently when multiple objects are selected. An example (which I’m not using) would be a planar projection. When multiple objects are selected the planar projection will project over both at once, even though you may want to do one at a time to fill up the UV quadrant. Because of this the standard for loop won’t work with ls -sl.

So I guess I would need to fetch the current $selectedObjects[] and feed them into a new array such as $previouslySelectedList[] that will not change when the objects are deselected.

Then in the for loop I would add each object from $previouslySelectedList[] one at a time to the active selection list, run my commands, and then select -d the objects or select -clear them and remove them from the $previouslySelectedList[] and then the loop would continue until it reaches the end of the $selectionList[].

Any info will be appreciated on how to achieve this.

Thanks

Rotate/Pan problem?!!

I have 2-button mouse and and had to set the PAN option to another key combination rather than the middle mouse button click.. I can easily doly and rotate if I am working at the origin. If I am working off the origin and when I want to rotate it seems like I am rotating with respect to the origin and no with respect to what I have on the screen. Is this dull or I am?! Please help!!

Need Help — Installaton Of Maya in MAC

Hi All

THis is pawan and Maya User, i used maya in Windows still bt now i move to MAC leopard but i dont kno installation..i downloaded Maya for MAC version and try to install but i failed i read lot of forum but dey dint help. mean i dont good knowladge of Maya Software.

so please tell me how can i install maya in MAC

and one more thing

please write in detail…..cuz i dont kno anything otherwise ill spend lot of time for searching one option hahah lolz

………
windows installation very easy

jus chand HOST ID to MY ETher ID and

Drag it to awkeygen

which on flex lm

but may is totally different OS…and nice OS..

thanks

Regards

Pawan

killing particles on specific object collision

I’d like some assistance on an expression or some MEL that will make particles die when they collide with a specific object. the particle collision event editor only lets you specify a collision number, not a collision object, and there is no constant here I can go by as the particles are colliding with many objects, multiple times.

I assume a runtime expression would work here. The words to describe it would be:

If any of the particles in particleA collide with ObjectA, set particle lifespan to 0

MEL: specifying shader paths & files with numbers

Thanks for the help so far. It’s nice to see a forum where people respond 🙂

This script is shader specific, so not ideal, but is going to save heaps of time right now because I have to make so many of them. I basically want to set the attributes of my shaders automatically, as well as set the file paths to texture files with specific naming conventions that are numbered. The numbers of the files should coincide with the number appended to the shader.

Since I didn’t know how to do that (query and modify the numbers), I was going to base it on a counter, so as the counter updates during a for loop in an if statement, it would use that number and append it to the name of the file after fixing the padding.

Now the counter is probably not ideal, especially the way I set it up. Ideally I would want to query the number at the end of the shader, add padding if necessary and use that to append to the file name, i.e. shader is named Rman_1, the file name would be appended with 001

So far the actual file paths work fine, it’s just the number that’s crap.

Here’s my code, I will split it up into pieces to hopefully make it easier to follow.

Texture Files (these are all residing in a global proc)
The variable declarations:

Code:

string $shader;
    string $selectedShaders[] = `ls -sl`;
    string $rmanTexPath = "renderman/textures/job/";
    string $texFilePrefix = "DOS_desertPiece";
    string $texFileSeparator = "_";
    $counterD = 0;
    $counterS = 0;
    $counterF = 0;
    string $texFileSuffixD = $counterD;
    string $texFileSuffixS = $counterS;
    string $texFileSuffixF = $counterF;
    string $shaderChannelA = "diffuse";
    string $shaderChannelB = "spec";
    string $shaderChannelC = "fresnel";
    string $fileExtension = ".tex";


The Diffuse Texture File:

Code:

//Set Diffuse Texture
    for($shader in $selectedShaders)
    {
        if($counterD <=45) ++$counterD;
        setAttr -type "string" ($shader + ".diffuseTexture")
        (
        $rmanTexPath +
        $texFilePrefix +
        $texFileSeparator +
        $texFileSuffixD +
//      $texFileSeparator +
//      $shaderChannelA +
        $fileExtension
        );
    }


The Specular Texture File:

Code:

//Set Specular Texture
    for($shader in $selectedShaders)
    {
        if($counterS <=45) ++$counterS;
        setAttr -type "string" ($shader + ".specularTexture")
        (
        $rmanTexPath +
        $texFilePrefix +
        $texFileSeparator +
        $texFileSuffixS +
        $texFileSeparator +
        $shaderChannelB +
        $fileExtension
        );
    }


The Fresnel Texture File:

Code:

//Set Fresnel Texture
    for($shader in $selectedShaders)
    {
        if($counterF <=45) ++$counterF;
        setAttr -type "string" ($shader + ".fresnelTexture")
        (
        $rmanTexPath +
        $texFilePrefix +
        $texFileSeparator +
        $texFileSuffixF +
        $texFileSeparator +
        $shaderChannelC +
        $fileExtension
        );
    }


Now for the other procedure, I thought I set it up correctly, but I think the way I’m trying to set the attributes is incorrect. I get an error that there was an error while parsing the arguments and my guess it comes to the vector stuff. I’m just trying to set the RGB color, it’s a color slider in the shader.

Code:

//Set DOS hapke shader attributes
global proc setDosAtt(){

    string $shader;
    string $selectedShaders[] = `ls -sl`;
    string $attribute1 = ".diffuseMultiplier";
    string $attribute2 = ".diffuseColor";
    string $attribute3 = ".applySRGB";
    string $attribute4 = ".forwardScattering";
    string $attribute6 = ".occlSamples";
    string $attribute7 = ".specRoughness";
    string $attribute8 = ".specularColor";
    string $attribute9 = ".fresnelIntensity";
    string $attribute10 = ".fresnelCoeff";
    string $attribute11 = ".fresnelBias";
    string $attribute12 = "._computesOpacity";
    vector $setting1 = <<1, 1, 1>>;
    vector $setting2 = <<1, 1, 1>>;
    float $setting3 = 1.0;
    float $setting4 = 0.1;
    float $setting5 = 0.6;
    float $setting6 = 16.0;
    float $setting7 = 0.5;
    vector $setting8 = <<1, 1, 1>>;
    float $setting9 = 0.2;
    float $setting10 = 0.05;
    float $setting11 = 0.5;
    float $setting12 = 1.0;
   
    if(`size $selectedShaders` == 0)
    {
    error "Nothing is selected. Please select your Renderman Shaders before initiating.";
    }
   
    for($shader in $selectedShaders)
    {
        setAttr ($shader + $attribute1) $setting1;
        setAttr ($shader + $attribute2) $setting2;
        setAttr ($shader + $attribute3) $setting3;
        setAttr ($shader + $attribute4) $setting4;
        setAttr ($shader + $attribute6) $setting6;
        setAttr ($shader + $attribute7) $setting7;
        setAttr ($shader + $attribute8) $setting8;
        setAttr ($shader + $attribute9) $setting9;
        setAttr ($shader + $attribute10) $setting10;
        setAttr ($shader + $attribute11) $setting11;
        setAttr ($shader + $attribute12) $setting12;
    }

}


MEL: system and exec commands on Mac OS X

We’re trying to get a batch script going here to convert our texture files into .tex for renderman. So far everything works (the syntax is correct and the file names are properly queried) but the actual conversion won’t work. It works on the windows machines, not the Mac, so from what I gathered in the docs it was the syntax for sending the command to the shell on OS X that needs to be different.

Would highly appreciate help on this as we have a ton of things to convert and doing them by hand could take hours.

Here are the 2 commands that work on PC:

Code:

exec (("txmake \""+$files[$i]+"\" \""+$files[$i]+".tex\""));
system(("txmake "+$filename+$files[$i]+" "+$filename+$files[$i]+".tex"));


Thanks

LD

MEL: Adding Commas to Numbers in print messages

I wanted to know if there was a way using MEL to add commas to long numbers in print messages. Sometimes I’m getting attributes for things that are long, like particle counts, and it would be much faster and easier to read if there were commas.

Example…

MEL prints: 938475689
I want it to print: 938,475,689

Any info will be appreciated.

Thanks

Playblast= no frame updates on image place?!

So I’ve made a track in Matchmover, exported it out to maya, worked great. But the problem here now is that when i render a playblast, then i will see the camera (3d maya camera) move and ofcourse the 3d house i placed there movest along with it. But the problem here is that the tracked image sequence will stay still on fram 1 and won’t update itself. Anybody knows how to fix this?