Dynamic Paint (Like 3dsMax/Blender/C4D)


#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.


#28

For multiple colors you would need to enable the color grid on the fluid and have multiple particles systems… one for each color you want to emit.

If you really needed to have a variable color per particle then you could could get the collision uv inside a particle expression then use setFluidAttr to set the color of the fluid texture at that uv value. You can get the index of the 2d fluid to use in the setFluidAttr call by multiplying the u * xResolution and v * yResolution.


#29

For my situation I would be fine with a different emitter for each color… but when I’m saying color, what I really mean is texture/material. I’m just using a solid color in my test.

I at least can’t see why yet I would need to have a variable color per each particle.

As always Duncan, thanks a ton. I’ll give this a try in a few days and report back.


#30

Re-reading your post I’m a bit confused actually. I’m not trying to color the particles themselves (Which it seems like what you instructed in your post)

I’m trying to make the separate particles emitters color an objects texture differently based on what ones particles makes contact with the object (Or to be more accurate dynamically paint a texture/materiel ontop of another).

I want them be able to “color” the object based on the particle that hits it, because as of now they just write an alpha map. The problem with this is that it can only dynamically create one color (Or texture, Which would be whatever one I have under the alpha in my layered texture)

I posted this before, but here’s what I’d like to achieve.
https://www.youtube.com/watch?v=czYugUWVbEQ
(Notice how the colors overlap each other at the end)


#31

By variable color per particle I just mean that each particle might represent a different paint color, though as I mentioned it is harder if you want the particles to simply represent any color( for example basing the color on particle speed ). If you only need a few colors then you can use a different emitter for each color( each using a different particle system ). If all you wanted was color then simply using the color settings on the emitter and mapping the fluids out color should work.(that would work for the animation example in your last post)

However it sounds like you want to have the different particles paint shaders or textures, not simply color. You could do this by again having multiple fluid emitters, each with its own particle system. Based on the fluids out color you could then blend between the particular shaders or textures with a shading network. One could instead use a different fluid node for each color and use the fluid out alphas for blending. The exact shading network method though would really depend on the desired result. Note that if you want to blend shaders one can take the out colors of shaders and blend them then plug the result into a surface shader.(just as if they were textures).

If you wanted different textures where there were different colors in the fluid you could use an HSV remap node and then map indices on the remap node with the different textures that would correspond to a particular hue value. (ramp indices can be textured, which is an easy way to blend between different textures)


#32

Ah I see, thanks for breaking that down for me. I see what you’re saying. Going to be trying this out soon!


#33

Okay, so hopefully this is a pretty simple problem, but I am once again a bit lost. I hope everything I’m about to say makes sense.

My emitter is just a particle emitter, not a fluidemitter since it wasn’t created by the fluid2dtexture container.

Because of that I have no “Fluid Attributes” section on my emitter, so I have no way to adding color output to my particles. Am I missing something simple here? I can post the scene if it would help.

Everything your saying makes a lot of sense, but I’m not sure how to go about doing it in my situation since I’m not using fluid emitters, just a particle emitter that emits density because of the expression I have within it (right?).
Thanks!


#34

Sorry… I was thinking you were directly emitting into the fluid from the particles using a fluid emitter(it is sometime hard to keep track in these long threads). However I assume you are using a runtime particle expression that does setFluidAttr. In that case you can simply set the fluid color per particle… no need for multiple emitters. You need to have some way of tagging the color you want to emit on the particles.

If you want you could use multiple particle emitters then on the particle emitter enable inheritColor and set the emitter color. With nParticles make sure the colorInput is constant and create an rgbPP channel for the color by hand, if you don’t already have one. It should then get the emitter color values. You can then use the rgbPP in your expression to set the fluid color attribute using setFluidAttr.


#35

Okay cool, so I was able to enable to rgbPP attribute and set the particle color to red an enable inherit color, which is reflected in the viewport propertly.

When it comes to creating a script I’m not sure how to do that, would you mind giving me a bit a guidance? Here’s what I have so far. It’s all based off your scripts (Or more like are exactly your scripts)


//Creating alpha map
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;
}

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

I know that I need to create “color” also in the setFluidAttr, but I seem to be having issues. Mostly because I really don’t know how.

Also when you say to check and see if colorInput is constant, I’m not sure what you mean by that. I’ve never created color like this before so thanks for being so patient with me.