ptransform VEX function
Transforms a vector from one space to another.
Contexts: image3d, chop, cop, pop, sop, surface, displace, fog, light, shadow, photon, cvex
See also: ntransform, vtransform
-
vector ptransform(vector , matrix ) -
vector ptransform(string tospace, vector v)Transforms from “space:current” (see below).
-
vector ptransform(string fromspace, string tospace, vector v)
The transform functions let you transform a vector from one space to another.
-
ptransform interprets the vector as a position.
-
vtransform interprets the vector as a direction vector, and so doesn’t apply the translations from the matrix.
-
ntransform interprets the vector as a normal vector, and so multiplies by the inverse transpose of the matrix (ignoring the translations).
The possible values for the space arguments are:
|
An object path |
Use the object space of an object specifed by a path string. Tip
In some cases, such as point instancing, mantra may automatically mangle object paths. You can generate an |
|
|
Object space of the current object. |
|
|
Houdini world space. |
|
|
mantra camera space. |
|
|
Space assigned to the current shader. |
|
|
Normal Device Coordinate space. |
|
|
The current space the vector is in. |
|
|
Houdini world space. |
The version with only a tospace argument assumes fromspace is “space:current”. For example:
Pworld = ptransform("space:world", P);
…is equivalent to:
Pworld = ptransform("space:current", "space:world", P);
Examples
Transform a vector from its current space to object space:
ospace = ptransform("space:object", P)
Transform a vector from object space to mantra’s natural coordinate space (“camera” space):
ospace = ptransform("space:object", "space:current", P)