Rotate pointcloud in TOPs ?

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

Cologne area TD artists? Let’s get in touch

Achim

Posts: 1706
Joined: Wed Nov 14, 2007 1:52 pm
Location: Cologne

Re: Rotate pointcloud in TOPs ?

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.

greg
Staff

Posts: 549
Joined: Tue Nov 13, 2007 1:08 am

Re: Rotate pointcloud in TOPs ?

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: Select all
`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;   }`
Attachments
swirlingBalls_GLSL_Transforms.3.toe

lucasm

Posts: 257
Joined: Sat Apr 28, 2012 7:55 pm
Location: Dallas, TX

Re: Rotate pointcloud in TOPs ?

That's brilliant, and beautiful, Lucas.

greg
Staff

Posts: 549
Joined: Tue Nov 13, 2007 1:08 am

Re: Rotate pointcloud in TOPs ?

transform_point_cloud.png (9.58 KiB) Viewed 209 times

Here's another file: https://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.
DavidBraun

Posts: 343
Joined: Wed Feb 25, 2015 1:35 pm
Location: Chicago

Re: Rotate pointcloud in TOPs ?

Thx a lot Lucas and David. Works perfectly.

Cologne area TD artists? Let’s get in touch

Achim

Posts: 1706
Joined: Wed Nov 14, 2007 1:52 pm
Location: Cologne

Re: Rotate pointcloud in TOPs ?

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

https://github.com/yeataro/TD-PointClou ... former.tox

yeataro

Posts: 18
Joined: Tue Sep 28, 2010 2:31 pm
Location: Taipei