How do I create a vertex shader that allows to choose 3 non aligned direction vectors and then allows to morph all vectors positions such that every vertex is remapped so that two vertices that are parallel to one of the axis, now become parallel to the direction between the vertex and a choosen vanishing points coordinate.


  • Axis 1 : (1,0,0)
  • Axis 2 : (0,1,0)
  • Axis 3 : (0,0,1)

Vanishing points:

  • P1 : Axis 1*10000
  • P2 : Axis 2*10000
  • P3 : Axis 3*10000

Assume then we have 2 points (3,0,100) and (6,0,100)

Those are parallel to axis 1 so if i set the vanishing points 1 to (10000,10000,0) I expect the coordinates of the points to become parallel to the new axe

(3,3,100) and (6,6,100).

Basically I want to choose 3 Axis and rotate Them indipendently around the origin and then the geometry should morph accordingly. The rotation is performed using "target far away points".

It is not necessary to handle huge rotation angles. 45 spherical degrees is more than enough


Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Browse other questions tagged or ask your own question.