pshipkov
Maya can do that without SOuP help.

Go to hypershade and create new fluidTexture2D. Connect it to the color channel of the shader assigned to your object, then add an emiter to the fluidContainer and set the color method to speed.
You will see your object's color reacting to what is happening in the fluid.
Reply 0 0
Frogspasm

I need to access the velocity vectors. Speed just gives me the magnitude of the velocity.
I'm going to be doing some manipulation of the data coming from the fluid container and need to turn it back into an image after all the math is done.
Can this be done with SOuP? It looks like the fluidAttributeToArray node isn't playing nice with the fluidTexture2DShape node.

I would like to eventually do this with the regular fluid containers too. 

Reply 0 0
pshipkov
yes.
fluidContainer.outMesh -> fluidAttributeToArray.outPositionPP -> computeVelocity.inGeometry
computeVelocity.outVelocityPP will contain the velocity vectors of the voxels
Reply 0 0
Frogspasm
Thanks! I'll give that a try.
Reply 0 0
Zeedorf
I tried this method and I have couple of problems. I'm using SOuP version Aug 23 2014

FluidAttributeToArray has outPositionPV (not PP) and it can't be connected computeVelocity.inGeometry attr.
But I could connect fluidShape.outMesh -> computeVelocity.inGeometry.

I connected computeVelocity.outVelocityPP -> arrayTo2DTexture.inDataPP to use as a texture. But the result is not that it should look like.

Selecting arrayTo2DTexture node produces error in the script editor:

// Error: line 3397: No object matches name: arrayToTexture2D2.inWeightPP //

What should I do?



Maya_FluidVelToTexture.jpg
Reply 0 0
plarson
Quote:
FluidAttributeToArray has outPositionPV (not PP) and it can't be connected computeVelocity.inGeometry attr.

The fluidAttributeToArray's outPositionPV will be the positions of the voxels, but I think you want the velocity from the fluid's velocity grid, right? (Btw, to go from a position array like that to something that will work with computeVelocity.inGeometry, you can use a pointCloudToCurve/Mesh).

fluidAttributeToArray will output the fluidShape's velocity grid per-voxel. To connect that to an arrayToTexture2d directly, the mesh's point count would would need to be the same as the voxel count. Here's a scene with that (ma 2dFluid_arrayToTexture2D_1.0.ma     )  Additionally, you could use a pointsOnMeshInfo to get the closest UV on mesh from each voxel position, then use that as the arrayToTexture2d.inMapPP to allow for differing point/voxel counts.

Peter mentions another possibility in this thread. One can use the pointCloudFluidEmitter to emit a fluid's velocity as color into another. I've found it works with a Maya fluidTexture2D. However I noticed that the pointCloudFluidEmitter can't be connected to a fluidTexture2D in the Dynamic Relationship Editor, but when connected manually it seems to work.

Reply 0 0
Zeedorf
Thanks plars!

As a matter of fact I have a special geometry to map with the velocity texture. I tried what you described, but it didn't work for me. I have no clue how to use pointsOnMeshInfo node properly. This is my test scene: mb fluid_velocity_to_texture.0001.mb    

Could you help on that?

The background story:

My intention is to drive particles based on a painted (static) fluid velocity grid. If I had an RGB map based on that it would be easy to drive the particles via expressions. As I tried to copy your (scene 2dFluid_arrayToTexture2D_1.0.ma) I found it could be very slow at 40x40 resolution. I guess I will have to use much larger grids like 1000x1000 for eg.

I'm thinking about that might be a soultion to drive particles based on the fluid velocity data directly. Of course I could use as a force field but I try to avoid that solution.
Or it might be a way to write an exr image file from fluid velocity data.
Reply 0 0
pshipkov
There is no reason to go throw fluid-to-texture-to-particle-forces to achieve what you described.

Just use the foxel grid as force field directly, or attribute transfer it to mesh grid (or your object) and then use that as pointCloudParticleField to precisely control where particles go.

Check the pointCloudParticleField example scenes.
Reply 0 0
Zeedorf
As I mentioned I tried to avoid using force fields because I want to drive the particles with expressions.
It seems necessary because the particles have goal surface so they aren't affected by fields. That surface which I tried to map fluid velocity onto.

There is an ancient tutorial where it described how to drive particles with painted geometries where the RGB values transfered to vector values and it can be added in runtime expression to the goalU and goalV per-particle attrs. So that is what I try to reproduce.
For me would be more user-friendly way to paint fluid velocities than colors to represent which directions the particles should go. It would be kind of an artist driven particles (have the ability to extend it with particle expressions).

So that is the whole story. Sorry for not being clear enough before.
Reply 0 0
pshipkov
Ah, got it.
Here is how you do it.
It is very fast too.
Reply 0 0
Reply