PDA

View Full Version : can goal particles inherit colour from texture on orig goal mesh?


anthonymcgrath
04-28-2009, 06:56 PM
hi all
quick one this and i'm sure its easier than I'm making it lol!

I have a polygon plane, I make it a softbody (no duplicate ...just making the mesh a softbody). Now I want the particles that are created to inherit the texture off the original mesh.

I've done a search on here but cant seem to find out - most of it is using sampler info and the emitted particles but mine aren't emitting they're permanently there.

any suggestions most welcome :)

sergioduque
04-28-2009, 08:14 PM
maybe with the "colorAtPoint" command? never used it but from the discription it might be what you need.

Aikiman
04-28-2009, 09:30 PM
This works, the only thing is you have to goal your particles to a non-deforming object first then make it a soft body.



float $goalU = goalU;
float $goalV = goalV;
float $color[] = `colorAtPoint -o RGB -u $goalU -v $goalV ramp1`
rgbPP = <<$color[0], $color[1], $color[2]>>;

anthonymcgrath
04-28-2009, 10:38 PM
coool - didn't know about the colorAtPoint command - I'll have a swot up on it now - so I'll need a goalU and goalV in my particles PP attributes yes?


also I dont need it to be a goal or a softbody as such - I just used that as it was the fastest way I could think of to get the particles to stick with a surface in an ordered particle-per-vertex fashion lol! there will be no deformation on the particles or goal-like effects on it - dunno if that helps matters at all?

Aikiman
04-28-2009, 10:54 PM
If you are emitting from the surface itself but with no emitter speed you can use the emit texture option on the emitter and grab the rgb that way without using any code. But if your object is deforming you will still need to goal your particles at the parentU and parentV of your surface emitter.

anthonymcgrath
04-28-2009, 11:00 PM
hmm think I'm getting my wires crossed here - I dont want any particle emission at all - I'm selecting the mesh, making it a softbody which puts a particle on each vertex of the mesh then I switch those to cloud which renders in mental ray and then I'm applying a shader to them - at present they look like this:

http://www.anthonymcgrath.co.uk/WIP/daftpunk/daftpunk11.jpg
so one particle on each vertex on the mesh - this mesh wont deform - I just wanna use the clouds as light bulbs effectively and they're colour is controlled by an animated texture I make in afx :)

anthonymcgrath
04-29-2009, 09:33 AM
okay well the particle thing isn't really doing what I need it to at present mainly because all the particles head to the first vertex. I add a bit of randomisation to the goalU and goalV but they just end up being scattered on the surface.


I really dont understand how maya cant just texture the particles in the same way a polyplane might be textured or at least inherit the colour from the mesh they were created from!

I'm now resorting to using spheres that will be aligned with the mesh. I am then going to MANUALLY snap & rotate 400 of the darn things to each vertex of a flat polyplane then texture them all as one mesh (so each ball will get a certain portion of the texture). I dont need any deformation from them or anything, so once this very monotonous task is done I can then animate the texture as normal.

once again maya proves just how stupid and user unfriendly it is after more than a dozen iterations of upgrading the software! Unless you have a thorough understanding of mel, simple tasks like this are just made so bloody difficult. Sorry to be flaming the software once again but it just seems like I battle with it at nearly every turn to get a result I need.

hey ho... If you want something doing...

mahigitam
09-23-2009, 10:33 AM
hi,
colorAtPoint command seems to work with using goals(u,v)....

i want to the particles from emitter to be goaled to vertices of a plane[not all thru the surface] and yet at the same time able to use colorAtPoint command.
if i use goal concept here,all the particels are get attracted to one vertex i.e, u=0,v=0...

the problem here is,how to get the data of position of the particle at the vertex and pass on to colorAtPoint command...



[z there any way to convert the values of x,y,z of particles on a plane to u,v coordinates of particles on a plane?]

Aikiman
09-24-2009, 07:48 AM
hi,
colorAtPoint command seems to work with using goals(u,v)....

i want to the particles from emitter to be goaled to vertices of a plane[not all thru the surface] and yet at the same time able to use colorAtPoint command.
if i use goal concept here,all the particels are get attracted to one vertex i.e, u=0,v=0...

the problem here is,how to get the data of position of the particle at the vertex and pass on to colorAtPoint command...



[z there any way to convert the values of x,y,z of particles on a plane to u,v coordinates of particles on a plane?]

Untested but you could try using the closestPointOnMesh node to get the particle position on your mesh then use parameterU and parameterV as your input values on the colorAtPoint to transfer the color values over to your particle.



// Get and set particle position
float $pos[] = particleShape1.position;
setAttr closestPointOnMesh1.inPosition $pos[0] $pos[1] $pos[2];

// Grab the U and V position of each particle
float $u = `getAttr closestPointOnMesh1.parameterU`;
float $v = `getAttr closestPointOnMesh1.parameterV`;

// Stick those values in the colorAtPoint
float $rgb[] = `colorAtPoint -o RGB -u $u -v $v ramp1`;

// Prepare and apply RGB values to your particle
vector $color = <<$rgb[0], $rgb[1], $rgb[2] >>;
particleShape1.rgbPP = $color;



to get your particles back onto the vertices again you have to delete your goalU and V attributes.

bflat
12-09-2009, 11:21 AM
Hey everybody.

Just had to do that kind of thing too today.
The nearestPointOnMesh did only give 0 u and v values, so I did try with the closestPointOnMesh node, and it works great.
But it is a REALLY HEAVY calculation if it has to do this at each frame. Having 5600 non-moving particles (only my texture would change and modify the incandescence of my particles) I added a little if loop that only samples the uv position of my particles once (at frame 0 - as my animation begins later).
Just wanted to share this with you.
Thanks for your great website Jeremy, it's always a great resource for me.
:thumbsup:

CGTalk Moderation
12-09-2009, 11:21 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.