Maxon Developers Maxon Developers
    • Documentation
      • Cinema 4D Python API
      • Cinema 4D C++ API
      • Cineware API
      • ZBrush Python API
      • ZBrush GoZ API
      • Code Examples on Github
    • Forum
    • Downloads
    • Support
      • Support Procedures
      • Registered Developer Program
      • Plugin IDs
      • Contact Us
    • Categories
      • Overview
      • News & Information
      • Cinema 4D SDK Support
      • Cineware SDK Support
      • ZBrush 4D SDK Support
      • Bugs
      • General Talk
    • Unread
    • Recent
    • Tags
    • Users
    • Login

    Worldspace to Screenspace conversion

    Scheduled Pinned Locked Moved SDK Help
    7 Posts 0 Posters 532 Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • H Offline
      Helper
      last edited by

      THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

      On 04/07/2007 at 05:21, xxxxxxxx wrote:

      User Information:
      Cinema 4D Version:   R10 
      Platform:      Mac OSX  ; 
      Language(s) :   C.O.F.F.E.E  ;   XPRESSO  ;

      ---------
      Hi,
      i'm looking for a way to convert world coordinates to screen coordinates in COFFEE. I know in cg-shader-language, I just have to multiply the local coordinates with the model-view-projection matrix.

      Can I access a similar matrix inside COFFEE? Or do I have to create it all by myself (based on camera position, rotation and focal length)?

      Or (even better) : is there a function, which does exactly that conversion?

      Best regards,
      sk.

      1 Reply Last reply Reply Quote 0
      • H Offline
        Helper
        last edited by

        THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

        On 04/07/2007 at 07:40, xxxxxxxx wrote:

        Nope, there is no such function in COFFEE. In C++ however you have several functions to convert from/to world, camera and screen space.

        1 Reply Last reply Reply Quote 0
        • H Offline
          Helper
          last edited by

          THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

          On 05/07/2007 at 04:54, xxxxxxxx wrote:

          I am quite sure that the source code for the function used internally by C4d to do world->screen projections is avilable somewhere in the C++ API docs. Using that as reference, implementing a corresponding function in COFFEE should not be that hard.

          If you can't find it, let me know and I'll look it up for you.

          /Filip

          1 Reply Last reply Reply Quote 0
          • H Offline
            Helper
            last edited by

            THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

            On 05/07/2007 at 08:40, xxxxxxxx wrote:

            Totally forgot about this. It´s in the GetViewParameter description. At least that´s the only source I know.

            1 Reply Last reply Reply Quote 0
            • H Offline
              Helper
              last edited by

              THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

              On 05/07/2007 at 08:49, xxxxxxxx wrote:

              Quote: Originally posted by FilipM on 05 July 2007
              >
              > * * *
              >
              > Using that as reference, implementing a corresponding function in COFFEE should not be that hard.
              >
              >
              > * * *

              Nice tip, but it seems like the BaseView-class, which implements the WS() method is proprietary or something. At least I found only the header-file in the SDK, not the source itself. If you find out more, please let me know.

              For this project a C++ plugin would only be the last resort, so I fear I have to create the matrix myself. I found a nice tutorial to calculate the projection matrix (http://www.codeguru.com/cpp/misc/misc/math/article.php/c10123\__3/), the rest should be relatively easy. But a built-in approach would be much more desirable, of course!

              Thanks,
              sk.

              1 Reply Last reply Reply Quote 0
              • H Offline
                Helper
                last edited by

                THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

                On 06/07/2007 at 12:53, xxxxxxxx wrote:

                As I said, it´s in the GetViewParameter description of the C++ SDK documentation!

                1 Reply Last reply Reply Quote 0
                • H Offline
                  Helper
                  last edited by

                  THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

                  On 06/07/2007 at 13:40, xxxxxxxx wrote:

                  Thank you, guys...
                  I simply overlooked that part. So after a good deal of tweaking, I've got a more or less working plugin. 🙂

                  I haven't found out, how to react to changes in the focal length, though... This negative-z value seems to be hard-coded to the standard-issue 36mm camera. But I guess that'll be not that much of a problem, and it's not that important anyway.

                  greets,
                  stefan

                  1 Reply Last reply Reply Quote 0
                  • First post
                    Last post