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

  1. vector ptransform(vector , matrix )

  2. vector ptransform(string tospace, vector v)

    Transforms from “space:current” (see below).

  3. vector ptransform(string fromspace, string tospace, vector v)

The transform functions let you transform a vector from one space to another.

The possible values for the space arguments are:

An object path

Use the object space of an object specifed by a path string.


In some cases, such as point instancing, mantra may automatically mangle object paths. You can generate an .ifd file and look inside to try to find what mantra is calling the object you want.


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);


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)