View Full Version : assign differetn textures to same node
05-17-2007, 02:59 PM
I want to ask whether it is possible to assign diferent textures to different parts of a node (mesh node). I mean for example for some part of the surface (for some vertices) fractal assignment and for some other part of the same surface I want to assign file texture for example.
And is this possible via using the api/mel commands??
Again me asking too many questions, just trying to understand the limits of maya and its api :(
05-18-2007, 06:47 AM
you can assign different shaders to one object,
actually shader is connected to some shading group which ultimately is an objectSet,
so let say for object1 , you have shader1 and shadingGrp1, and shader2 and shadingGrp2,
when you select some faces of object1 and assign shader1, those faces will be part of objectset shadingGrp1 and will inherit its properties,
remaining faces will be assigned shader2 so will be part of shadingGrp2,
so now you can assign any texture or map to each shaders and get the look you want,
below is code which will transfer all shaders assigned to one object to another identical object,
//select source shape first and then target shape
string $shapes=`ls -sl`;
string $srcConns=`listConnections -type "shadingEngine" $srcShp`;
$numFaces=`polyEvaluate -f $srcShp`;
$shd = $srcConns[$i];
if(`sets -im $shd ($srcShp+".f["+$j+"]")`)
sets -fe $shd ($destShp+".f["+$j+"]") ;
sets -e -fe $srcConns $destShp;
hope this helps,
05-18-2007, 08:46 AM
Thanks a lot for the reply and the sample :)
But I couldn't make it work, unfortunately :(, even ;(
An issue is that maya complained a lot about that srcShape and destShape are not defined to be arrays; since they seem to be declared as string, right. So I removed the array indexings for srcShape and destShape. But then;
I get and error telling that "no object matches name", I think that it comes from the reason that ;
listConnections -type "shadingEngine" $srcShp
doesnt return anything, does that mean ı couldnt managed to have shaders on my source object?
Thanks a lot;
05-18-2007, 10:00 AM
Hi again :)
I managed to make it work :D, the problem was that the ls command didnt selected the shapes node.
[ it is really important to give meaningfull names to the variables in scripts, thank you again for the good naming convention :) ].
So I make maya select the shapes intentionally ;)
And now one more question,
I couldnt understand what the expression inside the pranthesis does actually,
`sets -im $shd ($srcShp+".f["+$j+"]")` in the if block.
Thanks a lot,
05-18-2007, 12:01 PM
I am glad that you made it work,
`sets -im $shd ($srcShp+".f["+$j+"]")`
-im is -isMember,
this command will check that $j numbered face of $srcShp is member of $shd shader or not,
if it is then next command inside if block will assign $shd shader to $j numbered face or $destShp,
guess this explains your doubt,
05-18-2007, 02:38 PM
thanks a lot again for the explanation.
Actually I think I dont know which attribute of the shape node f refers to below.
Sorry for the unclear question,
And another question, what will/may/can happen when I assign different shading properties to different vertices of the same mesh. I mean, will/may/can/must/should the interpolation while passing from one vertex to the other vertex occur, like when it happens assigning colors?
If I am not clear, let me know :)
05-18-2007, 02:38 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.
vBulletin v3.0.5, Copyright ©2000-2015, Jelsoft Enterprises Ltd.