Saturday 3 September 2016

Bifrost PRT conversion

Set PATH=%PATH%;C:\Program Files\Autodesk\Maya2016\plug-ins\bifrost\devkit\bif2prt\bin

There you are saving the path of the bif2prt file, so you can execute it later.

Then you have to go (in the cmd) to the path where the files you want to convert are. Once you are placed in the folder you type:

FOR %i IN (*foam*) DO bif2prt.bat -f %i

Tuesday 30 August 2016

split mesh based on per face shader assignments

SPLIT meshes based on per face shader assignments.

/* This file downloaded from Highend3d.com
''
''  Highend3d.com File Information:
''
''    Script Name: tt_splitGeoFromMultiShaderAssignments
''    Author: Tylney
''    Last Updated: Feb 02, 2007
''    Update/Change this file at:
''    http://Highend3d.com/maya/downloads/mel_scripts/modeling/poly_tools/1071.html
''
''  Please do not alter any information above this line
''  it is generated dynamically by Highend3d.com and will
''  be changed automatically on any updates.
*/
////////////////////////////////////////////////////////////////////////////////////////////////////
//
// written by Tylney Taylor, copyright 2005-2007 bold vfx pty ltd
//
// use: 1) to select splittable geo globally in scene,
// use command: tt_selectObjectsWithMultiShaderAssignments
//
// 2) then execute tt_splitGeoFromMultiShaderAssignments
//
// probably best do a shelf button or two :)
//
// This software is shareware and I'd appreciate any comments and/or feedback
// from use with this software.  I would also appreciate information on projects
// this siftware was used in
//
// Many thanks Tylney Taylor, tylney@bold-vfx.com
//
// version history:
//
// 1.0 - worked pretty much straight from the bat, and havent had to change it
// since extended use in production yet.
//
////////////////////////////////////////////////////////////////////////////////////////////////////

global proc tt_splitGeoFromMultiShaderAssignments()
{
string $selection[] = `ls -sl`;
string $shadingEngineNodes[0];
string $shadingEngineNode;
string $node;
select -clear;

print $selection;

if (size($selection)){
// get associated shaders then associated/connected fileNodes
//


for ($node in $selection){
// find the related Shape Nodes
//
string $shapeNodes[] = `listRelatives -s -path $node`;
string $shape;
select -r $node;


for ($shape in $shapeNodes){

// find connections
//
string $connections[] = `listConnections $shape`;
string $connection;

for ($connection in $connections){
if (`objectType $connection` == "shadingEngine"){
string $sourceConnections[] = `listConnections -d 0 $connection`; // find connections to upstream Nodes
string $connection;

for ($connection in $sourceConnections){
if ((`objectType $connection` != "mesh") && (`objectType $connection` != "transform")&& (`objectType $connection` != "groupId")){
$shadingEngineNodes[size($shadingEngineNodes)] = $connection;
}
}
}
}

$shadingEngineNodes = `stringArrayRemoveDuplicates($shadingEngineNodes)`;
$shadingEngineNodes = `sort $shadingEngineNodes`;
//print $shadingEngineNodes;
}

// ok, now extract the faces for each shading group
//
// so first find only the faces that are assigned to the shader on the current object
// we have to assume that the shader is also assigned to other geometry, so we will filter
// for only the current object
string $shadingEngineNode;

if (size($shadingEngineNodes) <= 1) break;

for ($shadingEngineNode in $shadingEngineNodes){
string $assignedObjects[];
string $assignedObject;
string $faces[];
clear $faces;

hyperShade -objects $shadingEngineNode;
$assignedObjects = `ls -sl`;

//print ($node + " ");

for ($assignedObject in $assignedObjects){
if ((`gmatch $assignedObject ($node + ".f*")`) && (`objExists $assignedObject`)){
//print ($assignedObject + " ");
$faces[size($faces)] = $assignedObject;
}
}
//print "\n";

// select faces and polyChipOff (extract keepFacesToghether)
//polyChipOff -ch 1 -kft 1 -dup 0 -pvx 0.4755284797 -pvy -0.07101976871 -pvz -0.6240176838 -tx 0 -ty 0 -tz 0 -rx 0 -ry 0 -rz 0 -sx 1 -sy 1 -sz 1 -ran 0 -off 0 -ltz 0 -ws 0 -ltx 0 -lty 0 -lrx 0 -lry 0 -lrz 0 -lsx 1 -lsy 1 -lsz 1 -ldx 1 -ldy 0 -ldz 0 -w 0 -gx 0 -gy -1 -gz 0 -att 0 -mx 0 -my 0 -mz 0 pSphere6.f[20:23] pSphere6.f[40:42] pSphere6.f[59:62] pSphere6.f[79:82] pSphere6.f[100:101] pSphere6.f[120:121] pSphere6.f[140:141] pSphere6.f[160:161] pSphere6.f[180:181] pSphere6.f[200:201] pSphere6.f[220:221] pSphere6.f[240:241] pSphere6.f[260:261] pSphere6.f[280:281] pSphere6.f[299];
select -r $faces;
if (size($faces)) polyChipOff -ch 0 -kft 1 -dup 0 $faces;
select -clear;
}

// ok now separate the object and re-assign the shader to all objects (not faces)
// - node is now only a transform
//
string $polySplitObjects[] = `polySeparate -ch 0 $node`;
string $polySplitObject;


for ($polySplitObject in $polySplitObjects){
//hyperShade -smn ""; Select the asigned Shaders
//select -cl; select -r -ne blinn1 anisotropic2 anisotropic1 phongE1 phong1;x
//print ("selected Split: " + $polySplitObject + "\n");

for ($shadingEngineNode in $shadingEngineNodes){
string $assignedObjects[0];
string $assignedObject;
string $faces[0];

hyperShade -objects $shadingEngineNode;
$assignedObjects = `ls -sl`;
$assignedObjects = `stringArrayRemoveDuplicates($assignedObjects)`;
$assignedObjects = `sort $assignedObjects`;

//print ("assigned Objects:\n");
//print $assignedObjects;


for ($assignedObject in $assignedObjects){
if (`gmatch $assignedObject ($polySplitObject + ".f*")`){
print ("assigning " + $shadingEngineNode + " to " + $polySplitObject + "\n");
select -r $polySplitObject;
hyperShade -assign $shadingEngineNode;

break;
}
}
}
}
}
}
select -clear;
}

global proc tt_selectObjectsWithMultiShaderAssignments()
{
hyperShadePanelMenuCommand("hyperShadePanel1", "selectShadingGroupsAndMaterials");
string $selection[] = `ls -sl`;
string $objects[0];
string $node;
select -clear;

if (size($selection)){
// get associated shaders then associated/connected fileNodes
//


for ($node in $selection){
string $assignedObjects[0];
string $assignedObject;
string $faces[0];

hyperShade -objects $node;
$assignedObjects = `ls -sl`;

for ($assignedObject in $assignedObjects){
if (`gmatch $assignedObject "*.f*"`){
$objects[size($objects)] = `match "^[^\.]*" $assignedObject`;
}
}

}
$objects = `stringArrayRemoveDuplicates($objects)`;
$objects = `sort $objects`;
//print ((size($objects)) + " Objects with multiple Shaders:\n");
//print $objects;
select -r $objects;

}
}

Friday 10 June 2016

houdini and renderman....paste this in the houdini.env file..

RMANTREE = "C:/Program Files/Pixar/RenderManProServer-20.4"
PATH = "$PATH;$RMANTREE/bin"

Monday 23 May 2016

align control to joint script.

global proc cly_orientControlToJoint() {

// selections and error checking
string $jointInQuestion[] = `ls -sl -fl -type "joint"`;
if (`size( $jointInQuestion )` != 1 ) {
error "cly_orientControlToJoint requires that only \"one\" joint be selected before running";
}
string $victims[] = `ls -sl -objectsOnly`;
string $controlSelections[] = stringArrayRemove ( $jointInQuestion, $victims );
if (`size( $controlSelections )` < 1 ) {
error "cly_orientControlToJoint requires that at least one object for alignment, must be selected before running";
}
// selections and error checking end

float $jointPositionValue[] = `xform -q -ws -t $jointInQuestion[0]`;

//aim control and zero out rotation values by burying in a group ( target objects aligned and zeroed )
for ( $c in $controlSelections ) {
string $cGrpName = $c+ "RotateGrp";
string $cGrp = `group -name $cGrpName $c`; // because zero rotation "home" values are good when animating
xform -ws -t $jointPositionValue[0] $jointPositionValue[1] $jointPositionValue[2] $cGrp; // align the group not the object
string $aim[] = `parentConstraint $jointInQuestion[0] $cGrp`;
delete $aim; // clean
makeIdentity -apply true -t 1 -r 1 -s 0 -n 0 $c; // zero possible transforms // to do: preference
}
select -r $victims;
}

Wednesday 11 May 2016

selection set maths. whoop

string $subtractionSet[]=`sets -subtract tipMid tips`;
select $subtractionSet;
sets -n mids;
select mids;

Sunday 21 February 2016

bifrost accelrator direction (use object's transform)

We need to create a relationship between the emitter’s rotation
and its Acceleration Direction vector.To do this, we'll use a pointMatrixMult node.This node allows us to multiply a point by a matrix.Rename it "water_spray_redirect_MULT".First, we'll feed the emitter shape node's "worldMatrix" attributeinto this node's "In Matrix" attribute.The worldMatrix attribute represents the 4 x 4 transformation matrixof the emitter's translation and rotation in World Space.As the emitter moves along with the gun, this vector changes accordingly.Next, we need to multiply this vector by the emitter’s spray direction attribute,which is in its own local space.Remember that our starting direction vector in world space was -1, 0.577, 0.However, relative to the emitting cylinder object, it's simply spraying straight out the top.Thus, we'll set In Point to 0, 1, 0.We'll also need to turn on Vector Multiply to specify that we want a vector productrather than the scalar product.Now you can feed the output of this into the water_spray_emitter_GEOShape's"Bifrost Accelerator Direction" attribute.

Wednesday 17 February 2016

caching bifrost foam

FROM CGTALK

I think I figured it out. 

This is the process:

1. get liquid looking how you'd like
2. cache liquid (default cache control: 1)

3. select container -> add foam

4. get foam looking how you'd like

5. check 'Enable' in Foam Cache tab -> Cache Control set to 2
6. run timeline for length of cache

7. Change Cache Control to 3

Voila! The problem before was that I went to the BiFrost menu bar and tried to recache everything - and Maya was asking if I wanted to replace or rename existing cache - neither of which I wanted to do.

Monday 15 February 2016

bifrost foam particle size

mel script to set render size of foam particles in Maya Bifrost
set display to points..

setAttr foamShape1.renderParticleSize .01; 



Wednesday 13 January 2016

colour mixing

"Also, mix warm with warm colors only, and cool with cool. That is to say, a warm yellow with a warm red or a warm blue. What are the warm blue? Cobalt blue is warm, Prussian Blue is warm. Ultramarine is cool, Cerulean is cool. Alizarin is cool on the red side, Cadmium Red is warm. Lemon yellow is cool, Cadmium Yellow warm. If you keep them in their own family of warm and cool, the colors will be cleaner, not muddy, and they will look beautiful in counterposition to one another."

Jim Meskimen

from parkablogs interview

Monday 11 January 2016

maya fluid tidbit

stolen from tokeru's maya wiki, referenced from a dead highend3d thread:

I used to animate with fields, but didn't get very good results. I felt like I was "forceing" the fluids around instead of letting the sim do it for me. I know you directed this at Ducan, I can get you started by explaining the gist of the internal animation with fluids.
All the animation controls are in 2 places: Dynamic Simulation(sets the world rules), and Content Details (sets how the specific fluid will animate). It's all about temp and density...
Density is what you see. So you can give it a + bouyancy and make it go up. - makes it go down.
It you add temp (what you can't see) and give them conflicting bouyancys then when the temp disapates the density falls (or rises). If you give temp a high diffusion then the fluid will plume out, high dissapation the density bouyancy will take over because the temp dies out. High temp bouyancy and you'll get a mushroom cloud effect. Anyway there's a lot along these lines...