View Full Version : 2D texture fluid vs. 2d Fluid node
10-11-2006, 04:44 AM
I haven't had that much experience with Fluid but have been playing around with 2D fluid containers... and then I tried out the 2D fluid texture.
Can someone tell me the difference between 2D fluid and the 2D fluid texture? I am not understanding why they would be two different nodes, it seems like all the attributes are the same? If one simply has UV type inputs in order to map to the surface why not just stick in an intermediary node?
10-11-2006, 07:29 PM
As far as I have found, the main difference is that the 2dFluidTexture doesnt render the actual container.
10-11-2006, 07:34 PM
The normal fluid node is a volume shader, which means it computes the effect of illumination on a volumetric span, or segment( the 2d fluid renders with thickness.. the density is extruded into a volume ). The 2d fluid texture does not apply illumination and computes for a 2d point, not a volumetric span. It has a uv input, instead of an input volume span and lighting. Also the texture version has an extra output: outUV. If one makes the coordinate method = grid, then this allows one to use the distorted uv grid to smear other textures( by connecting the outUV to their uvCoord).
Also the fluid shader node is both a shader an a shape( a volume cube ). If you just create it as a shader it is not yet assigned to any volume, while if you create it off of the fluids menu it gets assigned to its self. The textures are not renderable shapes... they must be used in a shading network.
One other point... the 2D and 3D fluid shader nodes are actually the same node, just with different settings of the hidden attribute "is2d". (this attribute was hidden because there are some situations where changing it can cause confusions, although it is generally safe to use)
However the 2d and 3d fluid textures are different nodes because they require different inputs(pointCamera vs uvCoord).
I think this is difficult to explain by words. Just check this out and you will understand what it means.
Click play and watch the video tutorial about using fluid container as a texture.
10-11-2006, 09:55 PM
Damn Duncan... Cheers for an uber in depth explaination...! I always wondered if there was more too it than just simply hiding it from the renderer.
10-12-2006, 03:33 AM
Thanks Duncan, that was a great explanation... my high level thought was to maybe use a 2D fluid and plug it into a 2D texture... so that later it would be possible to use a single node to drive both a fluid shape and a shaded surface... know what I mean?
One of the things that frustrates me about using fluids is that the ramps are difficult to query... I have yet to find a way to script the duplication of an Incandescence ramp for example... since it is a multi attribute I can't seem to get the index number of what is in use... an it seems that querying the ramp itself creates new color entries.
10-13-2006, 04:55 PM
Currently you can't use the same node as a volume fluid shader and a non-illuminated texture. However you can copy values from one to the other by using the attribute preset mechanism. Save the preset of the the fluid shader node(preset->save in the attribute editor) then go into your prefs folder under presets for the fluid (this is where the preset would have been saved) and copy it to a fluidTexture2D folder(each nodetype has a folder, created the first time you save a preset for that nodeType). You can then load that preset into a fluidTexture2D. It should work, as the preset attributes are mostly the same for those two nodetypes. If it complains you could delete the problem attributes from the preset file(it is a simple ascii file).
For copying ramp attributes it is a bit tricky, but basically you can do getAttribute -size to find out the number of elements in a multi then loop through them doing get and setAttribute calls to copy. On the destination one could first use removeMultiInstance to remove existing elements before creating the duplicate entries. Just beware that multi attributes can be sparce... one may have entries with indices of 1 and 3 with no zero or 2( if the user had deleted indices ).
The attribute preset code is 100% mel, so you can examine it to see what it is doing(scripts are in the maya source scripts location). You can see what routines get called by turning on "echo all commands" in the script editor. If you hunt down the attribute preset code it may help you figure out copying of ramp attributes.
Also you can't directly query the interpolated ramp attribute values currently( if that's what you wanted). What you can get is the value(or color), position and interpolationMethod of each entry.
10-14-2006, 11:47 PM
Damn... thanks so much for that insight, that totally works, just had to hack the file a little bit... but damn I can script the editing of the file... this TOTALLY helps
and here the goods:
// Result: Mel procedure found in: /Applications/Alias/maya7.0/Maya.app/Contents/scripts/others/saveAttrPresetWin.mel //
applyPresetToNode "|fluidTexture2D1|fluidTexture2DShape1" "" "" "fluidTexture2D" 1;
// Result: Mel procedure found in: /Applications/Alias/maya7.0/Maya.app/Contents/scripts/others/presetMenuForDir.mel //
10-14-2006, 11:47 PM
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.
vBulletin v3.0.5, Copyright ©2000-2013, Jelsoft Enterprises Ltd.