maketransform matrix vex

   721   12   2
User Avatar
Member
582 posts
Joined: April 2014
Offline
I have a question about the maketransform vex function. The arguments for one ask for a constant integer translate, rotate and scale; correct ? Any tutorials etc, would be helpful ?
Houdini is Life Cereal, once you had a bowl you can't stop.
User Avatar
Member
3108 posts
Joined: July 2007
Offline
the explanation is in help:
docs
matrix maketransform(int trs, int xyz, vector t, vector r, vector s, vector p, vector pr, vector shears)
builds a general 4×4 transform matrix given an order of transformations (trs), an order for rotations (xyz), a vector representing the translation (t), rotation (r), scale (s) (and optionally a pivot (p), pivot rotatation (pr), and shears (shears)). The specifications for the trs and xyz parameters can be found in $HFS/houdini/vex/include/math.h

so you can see that the integer arguments, trs, and xyz are transform order and rotation order
and translate, rotate, scale (and others) are vectors as you would expect
Edited by tamte - Dec. 6, 2017 21:22:03
Tomas Slancik
FX Supervisor
Method Studios, NY
User Avatar
Member
582 posts
Joined: April 2014
Offline
Something like this ?
matrix maketransform(3,6,{0,0,0},{0,0,0},{0,0,0},{0,0,0}
Edited by Christopher_R - Dec. 7, 2017 10:34:56
Houdini is Life Cereal, once you had a bowl you can't stop.
User Avatar
Member
1212 posts
Joined: Sept. 2011
Offline
User Avatar
Member
582 posts
Joined: April 2014
Offline
When it asks for an argument of `const int trs` or `constant vector z axis` that requires a single integer, correct ?
Houdini is Life Cereal, once you had a bowl you can't stop.
User Avatar
Member
1212 posts
Joined: Sept. 2011
Offline
int means single integer, vector means 3 floats, const means the function does not change the value of the input. With maketransform(), instead of typing in a literal integer, typically one would include math.h and use the defined transform orders such as XFORM_SRT or XFORM_XYZ for readability.

// Defines for the maketransform() VEX function.  The function takes two
// integer arguments which determine the order that the transform gets made.
#define XFORM_SRT	0	// Scale, Rotate, Translate
#define XFORM_STR	1	// Scale, Translate, Rotate
#define XFORM_RST	2	// Rotate, Scale, Translate
#define XFORM_RTS	3	// Rotate, Translate, Scale
#define XFORM_TSR	4	// Translate, Scale, Rotate
#define XFORM_TRS	5	// Translate, Rotate, Scale

#define XFORM_XYZ	0	// Rotate order X, Y, Z
#define XFORM_XZY	1	// Rotate order X, Z, Y
#define XFORM_YXZ	2	// Rotate order Y, X, Z
#define XFORM_YZX	3	// Rotate order Y, Z, X
#define	XFORM_ZXY	4	// Rotate order Z, X, Y
#define XFORM_ZYX	5	// Rotate order Z, Y, X
example:
#include <math.h>
vector t,r,s;
t = chv('translate');
r = chv('rotate');
s = chv('scale');
matrix m = maketransform( XFORM_SRT, XFORM_XYZ, t, r, s);
@P *= m;
Edited by jsmack - Dec. 7, 2017 16:28:51
User Avatar
Member
582 posts
Joined: April 2014
Offline
Math.h can supply the chart you presented In your post; where can I get more into on Math.h, unless it's cmath?
I understood that all the maketransform() functions except two require the order of transformations & rotations.
Houdini is Life Cereal, once you had a bowl you can't stop.
User Avatar
Member
1212 posts
Joined: Sept. 2011
Offline
Open it?
User Avatar
Member
582 posts
Joined: April 2014
Offline
jsmack
Open it?
Sorry, it's a file ?
Houdini is Life Cereal, once you had a bowl you can't stop.
User Avatar
Member
3108 posts
Joined: July 2007
Offline
Christopher_R
Sorry, it's a file ?
tamte
docs
… can be found in $HFS/houdini/vex/include/math.h
Edited by tamte - Dec. 8, 2017 12:29:36
Tomas Slancik
FX Supervisor
Method Studios, NY
User Avatar
Member
1212 posts
Joined: Sept. 2011
Offline
The houdini/vex folder in your houdini installation folder is a gold mine. I would read every file first before even posting here.
User Avatar
Member
582 posts
Joined: April 2014
Offline
@jsmack have any favorites ?
Houdini is Life Cereal, once you had a bowl you can't stop.
User Avatar
Member
1212 posts
Joined: Sept. 2011
Offline
If you wonder how many vops work, check out voplib.h

If you want to know how mantra works check out:
  • in the Surface folder: pbrlighting.vfl, mislighting.vfl
  • in include: pbr_direct_lighting.h

How the ggx specular used by the principled and classic shader works:
  • in include: bsdf.h, ggx_utils.h
  • in CVex: ggx_eval.vfl, ggx_sample.vfl

Subsurface scattering:
  • pbr_sss_lighting.h, singlescatter.h, approxsss.h, expsampler.h

General shading stuff:
  • shading.h, cie_cmf.h, dispersion.h

Other math libs:
  • math.h, complex.h

Some geometry libraries:
  • subdcurve.h, spherepack.h, advect.h

For the new chop based constraints, it helps to know the underlying struct and it's member functions:
  • chop_constraints.h
Edited by jsmack - Dec. 8, 2017 21:55:29
  • Quick Links