PDA

View Full Version : Fluid color sampling


ruchitinfushion
11-25-2010, 12:48 PM
I m trying this code to get color value of fluid voxel but every time result is 0 0 0.

float $v[] = `getFluidAttr -at "color" -xi 10 -yi 12 -zi 13`;
print $v[0];
print $v[1];
print $v[2];

And how to use this bakeFluidShading.mel (C:\Program Files\Autodesk\Maya2011\scripts\others).Reply solution ASAP.Thank you

ruchitinfushion
11-26-2010, 01:25 PM
Any more solution?? i want to capture final color of voxel.Reply ASAP

Pyrokinesis
11-27-2010, 07:40 AM
Make sure your fluid containers color method is set to dynamic :)

ruchitinfushion
11-27-2010, 07:51 AM
yeah sometimes it works sometimes Error: X index out of range.Anyway do you have any idea about bakeFluidShading.mel ???

Pyrokinesis
11-27-2010, 08:04 AM
index out of range means your script is querying invalid indices. Try making sure they exist before querying them...

example:
for my default fluid container, this works.

import maya.cmds as mc
fluidColor = mc.getFluidAttr('fluidShape1', attribute='color', xi=1, yi=0, zi=0)
print fluidColor

but this returns your error:

import maya.cmds as mc
fluidColor = mc.getFluidAttr('fluidShape1', attribute='color', xi=10, yi=0, zi=0)
print fluidColor

Open up bakeFluidShading.mel in a text editor, it has an example and explanation of how to use it. select the fluid you want to bake > bakeFluidShading 4.0;

The number represents the resolution you want to bake your shading...

ruchitinfushion
11-27-2010, 11:37 AM
Ok got it,Thanx much for help

CGTalk Moderation
11-27-2010, 11:37 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.