How can i create one particle sprite to each center (pivot) of an object ? I would like to create several particle sprite to every center of pivot of several Poly object...

And for more complexity I would like to put on every particle the color of material that the object as. :)

If know how to do that send me an exemple of mel script....

I have to use particle to animate Cube that that I have created ( 600 simple cube in my scene ), and apply field of gravity to those particle sprite and made collision with the ground.

--------------------------------------------------

Simply imagine that you have 3 box located at different positions and with different material.

Material who just have an information of color in Color and Ambiant.

I would like to create a script who can help me to create 1 particle Sprite at each center of the 3 different boxe, and that they can take the color of the different box where they are created.

nobody can help me on that question ???? :shrug:

I know that I can return the center pivot of one object by this command:

getAttr pCube1.scalePivot;
// Result: 0.5 0.5 0.5 //

But I would like to first make a melscript to return the position of the different object that I selected in the world.

smoluck

12 December 2004, 03:41 PM

Ok I found yet the command for the creation of particle, was :

particle -p X Y Z

so I have to found the system to connect the different pCube.scalePivot (X Y Z) to particle -p X Y Z.... thats for the more difficult....:scream:

smoluck

12 December 2004, 04:27 PM

:thumbsup: S. J. Tubbrit:thumbsup: have already done a script that help you to create a locator at the center of an object, so i modified it to create a particle to the center of that object. But now the problem is that it can't create one particle at each center of multiple selection object. so how I can correct that ?

But my objective is to learn how to create my melScript, so do you know what book was good for me to learn the basics....?
I can't select by Material a multiselection and apply the script...what's the problem ?
My work consist to select by material , apply the script, and finally apply that material to Sprite particle. So How can I take simple RGB color info of my lambert and send it to particle sprite ?
I already have done a script to get in TXT file, the position in the world of my created particle to export in third party app :) .
Cheers

Marcel

12 December 2004, 08:47 AM

- I can't select by Material a multiselection and apply the script...what's the problem

Does the 'select by material' return face-components? If you have faces selected I can imagine it doesn't work, because faces have no pivot to query. You would have to convert from the face selection to object selection first.

If you want to get the RGB value of the lambert you have to do a couple of things:
(-go from face selection to object selection)
- go from the object to it's Shape
( http://www.ewertb.com/maya/mel/mel.php?howto=08 )
- get the 'Shading Group' from Shape
(http://www.ewertb.com/maya/mel/mel.php?howto=43)
- get the 'Material' from the Shading Group
(http://www.ewertb.com/maya/mel/mel.php?howto=92)
- get the color out of the Materials 'Color'

As you can see it's quite a lot of work, but with the examples on Brian Ewerts site I'm sure
you can make it work.

Here is another example on how to find the material on an object:
http://www.cgtalk.com/showthread.php?t=186641

thematt

12 December 2004, 11:07 AM

Marcel is right, go throught bryan site and you'll find some really usefull piece of information.
You also can buy mel for animator, Istarted with it, it's very informative.

But to get the shader related to an object i usually do it with listHistory, as in the exemple under that.

Then is just a matter of adding your particles to your object like above and assigning the correcponding shader to that particles..am I right? is it what you intend to do.

here the exemple to get the shader from the object..quick and durty..

cheers

string $sel[] = `ls -l -sl -tr`;

int $size =`size $sel`;

int $inc;

for ($inc=0;$inc<$size;$inc++)

{

// fist search shader realted to the object

string $shader[] = `listHistory -f 1 $sel[$inc]`;

string $history[] = `listHistory $shader`;

string $files[] = `ls -type "lambert" $history`;

print $files ;

}

smoluck

12 December 2004, 11:16 AM

Thanks Marcel I understand what you explain to me , but its more difficult for me. realize that melscript make me crazy..... :scream: First off all I've tried to regroup and organize my mel script in my brain and test that, that doesn't work.

I notice that I just work with pCube object, so I already done some copy of cubeShape to create an environement. All of these Cube as different types of lambert with different colors.
I would Like to create 1 Particle Shape ( with n Sprite ) at every position of my n Cube and take our material to patticle that are placed at that position.

I 'm under beta test with this type of workflow. It's just a test for a special project :thumbsup: . I't could be not more easy to create the low poly object with 90 ° face modeling, and recreate that highpoly with new pCube. I've prepared a mel script to create a particle sprite at each center pivot of that high poly object for third party export XYZ coord information. So I have to do a High poly ( many cube ) for particle export and a low poly object with internal face deleted to reduce polycount.

How can i analyse the highpoly object :
:lightbulb Remove Face who are superposed to another face.
:lightbulb Merge all the vertex who are at the same position.

:wip: Can I do a melScript to do that ? If Yes, How ? Or do I can select just the faces that are at the outside of the object shape by backface culling selection ?

CGTalk Moderation

01 January 2006, 06: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.

Follow Us On:

The CGSociety

The CGSociety is the most respected and accessible global organization for creative digital artists. The CGS supports artists at every level by offering a range of services to connect, inform, educate and promote digital artists worldwide. More about us on TheArtSociety.com