Wetmaps using particles

Become a member of the CGSociety

Connect, Share, and Learn with our Large Growing CG Art Community. It's Free!

Thread Tools Search this Thread Display Modes
  04 April 2012
Wetmaps using particles

Hi! I'm trying to generate wetmaps using particle collision.
Where particles collide i would like to paint a texture (not vertex map)
leaving some traces for example.

Since now i haven't found a solution.

I would like to obtain something like this:

Could anyone help me?

Thanks in advance.

What is the genius? It is fantasy, hunch, certitude and a rapid execution. Il Perozzi
  04 April 2012
You can use a fluid texture 2d, then emit into it from a particle expression.

First create a fluidTexture2d assigned to shader of the collision object. Set the velocity grid to none and the density grid to static. Set the resolution of the fluid to the desired wet map resolution.

Next create collisionU and collisionV attributes on your particle system (add dynamic attributes: general)

Finally create the following runtime expression to emit into the fluid from where your particles collide:
float $u = nParticleShape1.collisionU;
float $v = nParticleShape1.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;

If desired you can do things like diffusion or even solve a simulation. I've gotten good dripping wax by using a fluid with low solver quality combined with high damp and some negative buoyancy. (this would also need a dynamic velocity grid)

The above expression just sets pixels, and thus might look pixelated. If you wanted smooth circular stamps based on the particle radius you could use a more complex setup with two particle systems. The second one would emit directly into the 2d fluid texture (fluid:emit from object), and the expression on the first system would generate the secondary particles where their xy position was the uv position of collision.(using the emit command in the above expression instead of setFluidAttr) The fluidTexture2d transform would be scaled such that it exactly fit 0-1 in the xy plane.

  04 April 2012
You can also use soup plug-in (it is free) but only for 2011-2012 version.
Take look on example pages located here (http://www.soup-dev.com/examples2_7.htm)
Especially arrayDataContainer node video 2
  04 April 2012
Thank you Duncan! Thank you Toho!

Duncan! It is exactly what i wanted to to.
I have tried using 3D Fluid Texture, but 2D is faster.

Do u know (an experiment) if it is possible
to dinamically write a file textures using collision?
Maybe it could be slow.

Thank you again.

What is the genius? It is fantasy, hunch, certitude and a rapid execution. Il Perozzi
  04 April 2012
The cached 2d fluid is pretty much like a file texture sequence, but it is is full floating point. If you need file textures, however, you could do "convert to file texture" on the fluid. "Render texture range" could be used to convert the sequence of the fluid to file textures, however it currently seems to have a problem with the selection of the 2d fluid texture. You could look at the mel script that render texture range invokes "composite.mel" and perhaps fix the selection problem or clone it to create your own script.
  02 February 2013
Hello guys, I'm trying to do achieve the same effect, but when I run the expression (from the Mel command line source) it gives me this error "Error: Line 6.45: Invalid use of Maya object "fluidTexture2DShape1.resolutionH""
do you know why it happens?
Thanks in advance,

  02 February 2013
You need to set it up as a particle expression. If instead you run some of this from the command line you need to use get and set attr. Inside an expression one can use a syntax like this:
float $x = mySphere1.tx;
This is pre-parsed in the expression to create a physical input connection from mySphere.tx. Normally when getting the value of an attribute outside an expression you need:
float $x = `getAttr mySphere.tx`;
  02 February 2013
Thread automatically closed

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.
CGTalk Policy/Legalities
Note that as CGTalk Members, you agree to the terms and conditions of using this website.
Thread Closed share thread

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Society of Digital Artists

Powered by vBulletin
Copyright 2000 - 2006,
Jelsoft Enterprises Ltd.
Minimize Ads
Forum Jump

All times are GMT. The time now is 04:44 AM.

Powered by vBulletin
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.