Jump to content


3d- To 2d-coordinates Conversion


  • Please log in to reply
4 replies to this topic

#1 W.Gerick

W.Gerick

    Piglet

  • Adv Members
  • 7 posts

Posted 09 March 2009 - 12:26 PM

Hi,

is there a way to get the 2D coordinates of a 3D objects as seen through a camera?

An example:
Let's say, you have a locator in 3D space and an animated camera looking at it. The locator has 3D-coordinates, xyz, and gets rendered onto a 2D-canvas. Then it has 2D-coordinates (x and y) on that canvas, or render output. Is there a way, maybe some sort of method of the 3D-camera or 3D-renderer tool, to calculate these 2D-coordinates?

I'm trying to connect the center of a 2D-effect to the rendered position of a locator in 3D-space, which was provided by a matchmove.

A workaround would be to use a small 3D-sphere, link it to the locators position, render it and then track it again. But that sounds like overkill.

In AfterEffects there is a method called toComp(), which does exactly that conversion. Just to give people an idea. Maybe someone had this problem before?!

Thanks in advance!

#2 Gringo

Gringo

    Associate Administrator

  • Adv Members
  • PipPipPipPipPip
  • 1452 posts

Posted 09 March 2009 - 12:33 PM

Once you've created a Locator 3D and fed your camera to its yellow input, you can connect a 2d Center to its numerical output.
Don't forget to set appropriate parameters in the Locator3D>Camera Settings

#3 W.Gerick

W.Gerick

    Piglet

  • Adv Members
  • 7 posts

Posted 09 March 2009 - 03:28 PM

Thanks Gregory! You really saved my day! Works just great.

I'm just wondering, if I were to be using an expression, what exactly is the way to go then? I'm having a hard time, because Fusion is expecting a Point Input for the Center.

I tried:

Point(Locator3D1.Position[time][1], Locator3D1.Position[time][2])

Also not using InTool scripting isn't working:

Transform1.Center = Point(Locator3D1.Position[comp.CurrentTime][1], Locator3D1.Position[comp.CurrentTime][2])

Fusion keeps telling me 'Point' isn't recognized... any ideas? The reference shows an example just like that, so I'm not sure what the problem is...


Thanks in advance!

#4 Gringo

Gringo

    Associate Administrator

  • Adv Members
  • PipPipPipPipPip
  • 1452 posts

Posted 10 March 2009 - 02:32 AM

This one should work:

Point(Locator3D1.Position.X, Locator3D1.Position.Y)

#5 W.Gerick

W.Gerick

    Piglet

  • Adv Members
  • 7 posts

Posted 10 March 2009 - 06:09 PM

What can I say... Thanks again, Gregory! ;) Works perfectly! I thought, you have to define a specific time paramater to read an output. This solution is so much better!




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users