Solved How to get Pixel Coordinates of Spline point on 2D render canvas?

Hi everyone,

  • Let's say I have a render settings at 1920x1080.
  • In front of a camera there is a spline rectangle shape.
  • It has 4 points.

Is there a way to get pixel coordinates of those points on 2D canvas?

In the end I wanted to get a list of pixel coordinates for those 4 points, that will represent where those points will be located on final render.

I tried to find corresponding function in API Doc, but no luck unfortunately.

Would be awesome to know the answer!
Have a great day everyone!


You will want to use

 BaseView.WS(self, p)

Converts p from world space to screen space (pixels relative to the view)

Or maybe better: Camera to screen conversion

BaseView.CS(self, p, z_inverse)

@c4ds Oh, wow, thank you so much!

Hello @constantine_sazonov,

thank you for reaching out to us. And thank you again @C4DS for providing an answer. The conversion methods to convert between different coordinate systems are attached to c4d.BaseView as demonstrated by @C4DS. Depending on the concrete implementation, you might have to take care of safe frames though, since screen space does not imply them, but is simply all visible area of the view, i.e., the view frame.

There has been this topic in the past which was similar in nature where I also did provide some code.


MAXON SDK Specialist

@ferdinand Thank you very much for the info!