How to 'aim' ray from ray pop based on attribute

i am using vive controllers to ‘airbrush’ a projection-mapped object. my intent was to use rayPOP, with a ray origin at each control position, aimed in the direction of controller rotation from the openVR chop. and then use the rayPOP intersection attributes get the point of intersection from the ray and object i am projection mapping, do stuff w that, etc. i have most of the setup working, but now i am stuck on how to ‘aim’ the ray. I am using P as the ray attribute, so the point of origin is the controller pos in world space. but how can i also point the ray in the direction of rotation, stored in attribute R? is this possible? right now it seems like the ray always points toward the origin…

to be precise, the information i am using is the Tex coords of the ray intersection, which I am using to draw a texture on the geometry, and finally projection map the real object. so any solution needs to allow me to get the tex coords of the intersection of a ray originating a point P with direction R and a static piece of geometry

Hello @watershed

You can use a Transform POP to generate a direction attribute for the Ray POP. Be sure to set the Transform Attribute Scope to Vector mode on the Transform POP. With both the direction and position attributes in place, the Ray POP will be able to compute the interpolated Tex values at the intersection.

RayPOPIntersectionTexValue.toe (7.1 KB)

thank you for the example. so is it correct to say that the position of the ray source will come from P in all / most cases by default (in this example, from the point positions), and the Ray Attribute parameter is actually the direction? which would explain why it was always pointing to the origin when I had it set to P ….

The Ray attribute should correspond to the ray direction. The ray origin is the input P attribute. If P were defined as a direction and Negate Ray were enabled on the Ray POP, the resulting rays would point toward the origin, yes.

thank you that clarifies things, much appreciated

1 Like