Tuesday 31 January 2023

exporting custom attributes in Alembic to Blender

We use the setattribtypeinfo function to force an attribute to be a color type. Just like Cd usually is.

This will probably streamlined and not necessary in future versions of Blender, but it seems like it is still necessary atm (Jan 2023)

using a point wrangle, set to detail (so it only runs once)

 setattribtypeinfo(0,"point","attributename","color");


here I'm forcing an attribute called attributename to be recognised as a color type & not just 3 floats.
I'm using the rop_alembic output to write the abc file.

Friday 6 January 2023

doing things to for each sop loops

 

How to get information about the current loop

Sometimes you need to use the current loop or the current piece number in an expression on one of the nodes in the same loop. You can get this information with a  Block Begin SOP node that uses the Fetch Metadata method.

  1. Set up a looping block using the instructions above.

  2. Select the  Block Begin SOP node, and then in the Parameter Editor click Create Meta Import Node.

    This button adds a second Block Begin SOP node to the side of the existing one. This node is set up to generate an empty geometry with some detail attributes.

    The detail attributes are as follows:

    numiterations

    The expected total number of iterations, taking into account the Max Iterations and Single Pass parameters on the  Block End SOP node of the loop.

    iteration

    The current iteration number, always starting at 0 and increasing by 1 each loop.

    value

    In piecewise loops, this is the current value of the attribute. For example, the piece integer or name string, or if there is no attribute, the current point or primitive number.

    In simple repetition loops, this is a floating point value starting at the Block End SOP’s Start Value and increasing by the specified Increment each loop.

    ivalue

    In simple repetition, this is an integer version of value. This can be useful if the value is naturally an integer (for example, starts at 1 and increments by 2) and/or if values are over 24 million (where floating point numbers lose precision).

  3. To grab the value of these attributes in a node inside the loop, do the following:

Monday 21 November 2022

another way to cut or slice objects




Use 2 clip SOPs in a For Each loop. The "detail" function access the iteration number. These little expressions are pasted in the X, Y or Z origin boxes. The first cuts to the top of the division, The second cuts to the bottom of it (technically to the top of the previous iteration - which is what the "-1" is for.

 -8.26+detail("../foreach_count1", "iteration",0)*4

-8.26+(detail("../foreach_count1", "iteration",0)-1)*4

This does not create interior detail - but is good for troublesome geo.

Tuesday 15 November 2022

Cutting/slicing up an object in equal divisions

 Houdini Quick tip - slice equally - YouTube

Sometimes the Boolean Fracture lets you down, so use the Voronoi Fracture, and feed a line into the second input. That is pretty much the gist of the video.

Thursday 27 October 2022

GLSL style textures with COPS

 Create a COP network.

Create a VOP Generator

Inside this, make a snippet.

below is an example of what you could do inside the texture. This fills the image with pink and has blue borders on the left and right side of the image. The Step function doesn't exist in vex, so I define it in the beginning. So at least functions are code-able. Annoyingly chf("blabla" aren't possible, but you can add parameter inputs to the node.
The bottom line is the important part. It assigns the red, green, blue and alpha to the output (you don't need to plug anything into the output nodes of the VOP network).

Instead of U and V, you have X and Y.
You can still do things like multiply X and the modulo it to achieve tiling. I need to test out things like matrix rotations next. Much excite

float step(float a, b){

float jog=0;

if(a<b){jog=1;

}

else{jog=0;}


return jog;

}


float are=step(0.1,X)*(1-step(0.9,X));


vector4 rgba=set(are,0,1,1);

assign(R,G,B,A,rgba);



ROTATION UPDATE

so I couldn't figure out the matrix stuff...but handily a maths site mentioned that the resultant x' and y'

were: x'= x*cos(angle)-y*sin(angle) AND y'=x*sin(angle)+y*cos(angle)

doing some crap maths in vex gives you this:

vector2 uv=set(X,Y);

vector2 uvN=uv;

uvN.x=uv.x*cos(angle)-uv.y*sin(angle);

uvN.y=uv.x*sin(angle)+uv.y*cos(angle);


so now when you use uvN for any coordinate references the image will be rotated! I think the pivot is broken though...so that's next on the list of things

number padding and clamping file sequences

padding file names and clamping at the same time -


  `padzero(7,clamp($F4,1091,1256))`

 Think I've shown this snippet before, but maybe not combo'd with the clamp. Remember to use the back ticks to evaluate the expression when using it in a file name...And use all relevant brackets

accessing COP outputs in textures

use this expression to get to COP stuff - 


 op:/obj/cop2net1/out


the "op:/" is key!