Pages

Monday, 9 February 2015

Matrix Rotation

Here are 2 examples of using a matrix to perform rotation of an object about a pivot point, implemented in the VOP SOP context and VEX code in both the point and attribute wrangle nodes.




Monday, 19 January 2015

Get Primitive's Points with VEX

Note:
Code below was developed for Houdini 13
Since Houdini 14 the primpoints(int input, int @primnum); function returns an array of points per primitive. Obviously a much better solution


Attribute Wrangle in Detail Attribute mode

The following VEX code returns the points associated with the given primitive. In this case the primitive is chosen based on the proximity to the current point, using the xyzdist() function, where the first argument is the geometry containing the primitives to test against the current point, argument defined as "1" gives access to the second input of the attribute wrangle node.

i@prim;
v@uv;
float dist = xyzdist(1, @P, @prim, @uv);
//Above gets the prim(n) and prim(uv) for a given point position
//Also the distance between the given point and the prim returned
//Although all we really need is the primitive number

//--

//Create array to store the primitive's point numbers
int primpoints[];
v@primpoints;//This vector is used to store the 3 points instead of using an array, due to a limit with array attributes. 

NOTE:
Basically if you want to access the array in another wrangle further down the chain, you need to use a data type other than an array instead, a vector or matrix can be used to store array like data structures.

//Get the number of vertex for a given prim
int nvtx = primvertexcount(1, @prim); 

//Loop over the vertercies to find their associated points
for (int i = 0; i < nvtx; i++){

    //Get the linear vertex numbers for the prim(n)
    int linearvertex = vertexindex(1, @prim, i);

    //Get the point number from the linear vertex number
    int vertexpoint = vertexpoint(1, linearvertex); 

    //Put point numbers into the points array
    primpoints[i] = vertexpoint;
    @primpoints[i] = vertexpoint;
}

//Display primitive's point numbers
//printf("%g \n", points);

Tuesday, 25 November 2014

Mushroom Asset Development - Renders : GI

Initial mushroom renders.
Fairly basic light setup and the mantra surface shader.

Multiple camera renders:








Multiple object level copies of the mushroom asset, posed in world space simply for the purposes of render testing

Same again with addition of DOF

Thursday, 13 November 2014

Mushroom Gills - Radial Sorting

If you've ever needed to sort in a radial fashion, see below to find out how.

I've come against this problem countless times. It's come up again while creating the mushroom gills, so I thought it would be good to share the solution I've come up with.

The idea came when I was thinking about the angular gradient as a way to do radial sorting, I recalled the underlying formula for the angular gradient (shown below).

angularGradient = atan2($TX, $TZ) / 2 * $PI

Above you'll notice the $TX and $TZ, that will give us a circular / angular gradient about the Y Axis. Changing those position variables will give results about the other axis.

I might try to implement a VOP version which uses textures to do sorting in a similar way, be very handy to have a visual way to sort attributes.











Wednesday, 15 October 2014

Mushroom Asset Development - Sketching

Sketching 

Helps me to get a better idea of what I'm creating, also how to create it.
I guess some sketching can be classed to be more about the style, how it's going to look and move, for example. On the other hand, this definitely applies in the case of asset development, it's me undergoing a process of dissecting, breaking down the elements.