Maxon Developers Maxon Developers
    • Documentation
      • Cinema 4D Python API
      • Cinema 4D C++ API
      • Cineware 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

    MatPreview not matching camera view [SOLVED]

    SDK Help
    0
    22
    14.5k
    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
      Helper
      last edited by

      On 14/07/2015 at 10:53, xxxxxxxx wrote:

      I copy pasted it from somewhere when I was searching, but this doesn't change any result after removing "DTYPE_REAL"

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

        On 15/07/2015 at 08:27, xxxxxxxx wrote:

        Hello,

        as commented in the header file, both CAMERAOBJECT_FOV and CAMERAOBJECT_FOV_VERTICAL are "virtual" parameters that are not stored in the camera's base container (and thus should not be used this way).

        In the case of CAMERAOBJECT_FOV_VERTICAL it indeed accesses the active object. It seems this parameter is only used in certain internal cases. So you have to calculate this value on your own using the current film aspect and CAMERAOBJECT_APERTURE.

        Best wishes,
        Sebastian

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

          On 15/07/2015 at 09:31, xxxxxxxx wrote:

          so I consider this a "bad behavior" which is not anticipated.
          thanks Sebastian for clarification, I will handle it.

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

            On 19/07/2015 at 00:24, xxxxxxxx wrote:

            here is what I did, works fine, but I need to confirm that it is safe "I'm using BaseVideoPost node's document"

              
            		BaseContainer bcRender = node->GetDocument()->GetActiveRenderData()->GetData();
              
            		float w;
            		float h;
              
            		w = bcRender.GetFloat(RDATA_XRES);
            		h = bcRender.GetFloat(RDATA_YRES);
              
            		float fov_h = 2.f * atanf((ap) / (2.f * focus));
            		float fov_v = 2.f * atanf((ap / (w / h)) / (2.f * focus));
              
            		float fov = (fov_v < fov_h)? fov_v : fov_h;  
            
            1 Reply Last reply Reply Quote 0
            • H
              Helper
              last edited by

              On 20/07/2015 at 01:39, xxxxxxxx wrote:

              Hello,

              RenderDocument() has a parameter for the used render settings. These render settings can be accessed with Render::GetRenderData(), so if you want to get the resolution you should use:

                
              BaseContainer rdata = vps->render->GetRenderData();  
              

              best wishes,
              Sebastian

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

                On 20/07/2015 at 02:31, xxxxxxxx wrote:

                true, but...
                the SDK got a bug at this point, let me explain where the problem occurs:
                1- let's consider I used the old approach "CAMERAOBJECT_FOV_VERTICAL and CAMERAOBJECT_FOV" as you mentioned, these are virtual,
                so they fail in MatPreview "as they use the current Document camera, NOT the MatPreview Document camera"

                2- I already tested vps->render->GetRenderData(), works fine in MatPreview and picture viewer
                but it fails in viewport "guess what? camera horizontal and vertical FOV are represented by the virtual descriptions!!!
                which doesn't match Document dimensions" for example: Document image = 1280 x 720, viewport image = 1100 x 500,
                camera got FOV calculated from the 1280 x 720 image "not the correct width, height values"

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

                  On 20/07/2015 at 11:04, xxxxxxxx wrote:

                  Hello,

                  you could check the renderflags if RENDERFLAGS_EXTERNAL is set and react accordingly.

                  Best wishes,
                  Sebastian

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

                    On 20/07/2015 at 11:06, xxxxxxxx wrote:

                    this looks great!!. so RENDERFLAGS_EXTERNAL means non viewport render?

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

                      On 20/07/2015 at 14:15, xxxxxxxx wrote:

                      Originally posted by xxxxxxxx

                      this looks great!!. so RENDERFLAGS_EXTERNAL means non viewport render?

                      Yes!

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

                        On 23/07/2015 at 19:29, xxxxxxxx wrote:

                        thanks Sebastian and Robert
                        you can consider this solved.

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