Rotate pointcloud in TOPs ?

Imagine a pointcloud encoded in TOPs , so then usual rbg = xyz in 32 bit float. I can translate and scale the whole pointcloud using math TOPs (and channel masks), but is there also a way to rotate the pointcloud (completely in TOPs)?

Thx in advance

We’re building a few point cloud COMPs with shaders, one that acts like a Transform CHOP transforming texture pixels containing 32-bit floats in RGB. I’ll see if it’s releasable tomorrow.

sounds like what you want is the ability to apply a full matrix based transform to a 3d coordinate, but on the gpu as in tx,ty,tz,rx,ry,rz,sx,sy,sz ?

I’ve attached something I was fiddling around with the other day - may be what you’re looking for.

the actual transform function is quite particular, it looks like this:

[code]vec3 Transform(vec3 p, vec3 t, vec3 r, vec3 s)
{
float px = p.x;
float py = p.y;
float pz = p.z;

float tx = t.x;
float ty = t.y;
float tz = t.z;

float rx = r.x;
float ry = r.y;
float rz = r.z;

float sx = s.x;
float sy = s.y;
float sz = s.z;

float crx = cos(rx*PI/180);
float cry = cos(ry*PI/180);
float crz = cos(rz*PI/180);

float srx = sin(rx*PI/180);
float sry = sin(ry*PI/180);
float srz = sin(rz*PI/180);

px *= sx;
py *= sy;
pz *= sz;

vec3 result = vec3(0.);
result.x = (cry * crz) * px + (srx * sry * crz - srz * crx) * py + (crx * sry * crz + srx * srz) * pz + tx;
result.y = (cry * srz) * px + (srz * srx * sry + crx * crz) * py + (crx * sry * srz - srx * crz) * pz + ty;
result.z = -sry * px + (srx * cry) * py + (crx * cry) * pz + tz;

return result;

}[/code]
swirlingBalls_GLSL_Transforms.3.toe (2.92 MB)

That’s brilliant, and beautiful, Lucas.

transform_point_cloud.png
Here’s another file: github.com/DBraun/TouchDesigner … _cloud.tox

It’s pretty easy to modify the code to change the order of operations. As Lucas has done, it gets cool when you augment the translation/rotation/scale parameters with another input texture.

Thx a lot Lucas and David. Works perfectly.

I also share my simple tool, which can be easily integrated with object COMP:

github.com/yeataro/TD-PointClou … former.tox

1 Like