View Full Version : Slim Appending Text?
11-24-2005, 03:12 AM
I have this situation where in I have a bunch of manifolds, and they are needed to be connected to one shader network.
So I say "SURE" there is definately a simple expression that will simply append an extra text to the surface shader space..... unfortunately its harder than I though
say one has an object ball1|ball1Shape, ball2|ball2|Shape ...
and say the manifold is named ball1Manifold|ball1ManifoldShape, ball2Manifold|ball2ManifoldShape
so in my shader space I use the following line
but $o would only give me ball1Shape
so somehow I need to come up with an expression that would split the text into ball1 and Shape then append the Manilfold.
Even if I name the manifold to be accomodating meaning naming them ball1ShapeManifold then all I would need to do is append "Shape" but the simple $o + "Shape" doesnt seem to cut it in slim.
So does anyone know how I can tackle this problem?
Thanks in advance.
here is something new I discovered [coordsys [$o%Shape]] but it is still not working
ok another edit
I finally got it working and if anyone is interested heres the line
[coordsys [format %s%s $o "Shape"]]
quite a simple line, but really powerfull in its job.
11-24-2005, 10:36 AM
If you want to make life easier for yourself you probably want to put this into a Tcl function so that you don't have to remember it each time. It also lets you do much longer Tcl expressions.
You will need to put them in a file called TOR.ini - this is loaded by MTOR and Slim so that both can find your proc. The easiest place to put this is with your slim.ini file in the directory corresponding to your RAT_SCRIPTS_PATH environment variable.
11-24-2005, 11:31 AM
Slim puts everything in external string parameters through a Tcl subst command before evaluating it, so any variables are exapnded in-place. This means you only need to do format when you're actually formatting the string, like for calculating a frame offset then 4-padding it for example. You can rewrite that format command like this:
11-24-2005, 05:53 PM
thanks a lot for the help. without you guys, I dont know how I would have learnt a thing or two about mtor....
I really need to get into tcl, its quite powerful, but the code is so weird. Coming from python I think it will take some extra effort.
I have another small question, say I have bunch of particles that I am rendering them as points. Now the problem I am facing is that I need to transfer the color that each particle to an instanced geometry. So if a particle color is red the geometry must be red.
Another issue is that the color that the particle is getting is derived from a slim shading network rather than using maya's shaders, so the possiblity of using rmanF or rmanC variables is out.
here is a render of simply the points
and here is what happens when I instance the cubes to the particles
as you can see, the noise pattern is smearing across the surface of the cube rather than giving it one indivisual color.
Any ideas on how to give it one constant color per cube?
oh btw I just wanted to ask, is there also a way to get a color from slim to a maya variable? Since we can do it from maya -> slim is there a way to do it from slim -> maya?
If that was possible I could have easily transferred the point color to a maya variable and used that varialbe to color my cubes.....
11-24-2005, 08:04 PM
Could you have a creation expression as:
rmanFparticleId = particleId;
which you can pick up with an attribute template - if you are using the latest version of RAT - primitive variables are added as user attributes when using instancing.
You can then use that as an index to pick up the colour - the easiest way would be to use it as the pattern in a colour spline.
11-25-2005, 04:21 PM
thanks for the reply rendermaniac,
but what I am trying to pursue is, a way in slim, to have a particle's shading network communicate with its instance. So far the only possible way I can do this is by passing data iby the usd of primitive variables rmanC,rmanF, etc. I havent seen a solution where the particle's shaders can pass information to its instance that its copied to in slim itself.
The reason I am saying this is becuase working with particles in maya is a pain, I would happily use the shading environment in slim rather than use hypershade and pass variables to slim.
11-26-2005, 12:59 AM
There isn't much that tells each instance apart, aprt from primitive variables. When dealing with RSL you only really have point data - not even for the whole object. The only way you could do this in pure RSL is to use the identifier attribute to switch on stuff. However that way lies madness ;) Primitive variables are there for a reason. It is one of the best implemented ways of getting custom data into RSL (along with user attributes). Take advantage of it!
11-26-2005, 12:59 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.
vBulletin v3.0.5, Copyright ©2000-2014, Jelsoft Enterprises Ltd.