Dynamic Paint (Like 3dsMax/Blender/C4D)


#8

Okay, I know very little about scripting (actually nothing at all)

but when I add those two lines in front of the script I already have there it returns with

// Error: Attribute not found or variable missing '$':  particleShape1.collisionGeometryIndex // 
// Error: } // 
// Error: Line 12.1: Syntax error // 

in the Maya command history bar.

Here’s the full script now:

if (particleShape1.collisionGeometryIndex != -1){
lifespanPP = -1;
float $u = particleShape1.collisionU;
float $v = particleShape1.collisionV;
float $emitRate = 0.5;
if( $u != -1.0 && $v != -1.0 ){
float $rx = fluidTexture2DShape1.resolutionW;
float $ry = fluidTexture2DShape1.resolutionH;
int $xi = $u * ($rx-1);
int $yi = $v * ($ry-1);
setFluidAttr -at "density" -ad -fv $emitRate -xi $xi -yi $yi fluidTexture2DShape1;
}

How am I goofing this one up? The script work until I add those two lines.

Thanks!


#9

Did you create the attribute collisionGeometryIndex? (in the add attribute window under particle) Although you could probably also just check the collisionU !=-1 instead.


#10

That resolved the issue of me saving the script… but sadly I’m still having the same issues with the particles not going away and them not creating a streak.

https://www.youtube.com/watch?v=f74uEisEPBU&feature=youtu.be

As far as the lack of trail goes, is there any way I can force the particles to attract to the surface? It seems like the lack of streaking is because they are bouncing off once they hit the collision and sort of hover above it even though conserve is set to 0. Gravity would work here, but it wouldn’t be a solution for my project because that wouldn’t work on a wall on its side or up above.


#11

You need to first set the lifespan to lifespanMode to lifespanPP, then in the create expression you can set lifespanPP to something short, like:
lifespanPP = 0.2;


#12

Cool, everything seems to be working really well. Thanks for all the help!


#13

cool thread and useful info thanks!


#14

Here’s an example of the result I was able to create.

https://www.youtube.com/watch?t=2&v=P8OAu4JTzfc

If anyone has any suggestions to get things a little more accurate I’m all ears. I’ll be tweaking this as I go along and hopefully be able to make it work much better moving forward.


#15

looks good! To get rid of that jumpy emission use the fill option for your emitter to use the entire volume of the sphere to emit and turn off jitter. After seeing this ill think ill make one of these myself very useful workflow.


#16

Yes, on the particle emitter use surface emission, not omni. Then for a smooth emission increase the particles emitted from the sphere, and lower the density emitRate in your expression.


#17

So I’ve been using this method a little more, but now I’m running into an error that is causing the Fluid Texture 2D to not show anything as the particles collide. When I apply a Fluid Texture 2D to a character model I have, I get the error returned once I begin to simulate the scene

“Error: Y Index out of range”

Anyone know what may be causing this?

Here’s a video of it:
https://www.youtube.com/watch?v=3h3UwO-x4lo&feature=youtu.be

Here’s the scene file:
http://www.megafileupload.com/5lso/Jin_Part_Test.zip


#18

Is your mesh unwrapped in Zero to One UV space?


#19

I actually don’t know to much about UV and textures in general, this was just a model I had on my PC to run a quick test. Is there something specific I should make sure of on the UV settings in order to make sure things are accurate?

If there’s a resource out there that you’d recommend I’d be happy to check it out if it something hard to explain or requires a bit more research.


#20

open window-> Uv Texture Editor with your mesh highlighted.
If your uvs are unique (all have their own uv coordinate) and are all contained within the upper right hand box your good to go. Im at work so I cant open your scene but if your still having issues i could check later.


#21

Doing a little research on UV mapping and what you spoke of, I don’t think this one is set up correctly, which is what may be causing the issues. Would there be a quick way of fixing this or am I going to need to do some serious research?

Let me know! Thanks for all the help.

Edit: Hey! that was actually easier then I thought. All I had to do was press up on my keyboard after selecting the UV. It works now! AWESOME!!


#22

cool im glad you figured it out…in most cases dynamics engines only understand 0 to 1 uv space.
Have fun


#23

Bringing this thread back from the dead here. I have a pretty good system in place now, but my last hurdle is that how can I get this to work with multiple colors?

Since the particles paint alpha maps, and I’m using a layered texture that will show solid color underneath the texture layer it only allows for one color to be painted.

For example, say I wanted to have another emitter on the right side of this model that painted red and not blue, how would I go about doing this?


#24

Is there some reason you cant use a fileTexture instead of a solid color?

David


#25

I could, but my problem would still be the same.

Since I’m looking to create a dynamic solution that paints the object based on the color of particles that hit the object think I would need something that would say… enable “texture blue” if the particles meet that flag or “texture red” if the particles meet that flag, or something like that at least.

Here’s an example of what I can’t do with my current system, because I’m just using a single color in a layered texture that is based off a simple alpha map.

https://www.youtube.com/watch?v=czYugUWVbEQ


#26

Yes, I suspected that was what you were looking for, but just wanted to be sure. Have you looked at the way the SOuP attribute transfer methods? There are some examples on the website that show transferring color and other attributes from particles to mesh colors.

David


#27

Yeh, SOuP doesn’t really fit the bill here although at first it seems like it world.

I’ve worked with some people that have a pretty deep understanding on this roadblock and it becomes super complicated. I haven’t been able to find a solution with it yet.

Another issue is that SOuP is very complex and simply doesn’t have enough documentation for someone who is newish to Maya like myself.