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

    Motion blur on procedural movements

    Scheduled Pinned Locked Moved PYTHON Development
    6 Posts 0 Posters 632 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 01/03/2012 at 09:51, xxxxxxxx wrote:

      Hi all,

      I've a problem rendering an object whose movements are non-keyframed, but generated by a script instead. It seems the rendering engine cannot calculate the motion blur.

      Following is a simple example, you can just paste the code in a Python tag on whatever object you want.

      -----------------------------------------------------------------

      import c4d, math
      from c4d import documents, BaseTime

      def main() :
          doc = documents.GetActiveDocument()
          tm = doc.GetTime()
          fps = doc.GetFps()
          fr = tm.GetFrame(fps)
          obj = op.GetObject()
          
          r = 500.0
          ang = -0.3*fr

      obj[c4d.ID_BASEOBJECT_REL_POSITION,c4d.VECTOR_X] = r*math.cos(ang);
          obj[c4d.ID_BASEOBJECT_REL_POSITION,c4d.VECTOR_Y] = r*math.sin(ang);

      -----------------------------------------------------------------

      It creates a procedural orbit on XY plane. If you try to render it with motion blur active (Physical or Standard engine) you'll notice the problem. I guess the problem is the engine is not able to calculate the subframe positions for procedural movements. That happens just for Coffee/Python expressions, because with a Vibrate Tag, just for example, it works well.

      Any suggestion?

      Riccardo

      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 01/03/2012 at 11:02, xxxxxxxx wrote:

        The problem is this line here: doc = documents.GetActiveDocument()
        'doc' here refers to the document in the editor, not in the rendering.
        The document is cloned for the renderer. Just delete line 6, 'doc' is
        predefined in a Python tag and is always a reference to the document
        where the tag is part of.

        Cheers, Sebastian

        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 02/03/2012 at 01:39, xxxxxxxx wrote:

          Thank you for your answer Sebastian.

          That's a useful info, but unfortunately it doesn't solve the problem. If you try to render the scene you'll notice the motion blur doesn't work well. Apparently it's not able to calculate the interframe positions, so the effect is a simple overlap between a couple of frames.

          In fact I've the same problem using the coffee version.

          ----------------------------------------------------------------

          main(doc,op)
          {
               var fr = doc->GetTime()->GetFrame(doc->GetFps());
               var r = 500.0;
               var ang = -0.3*fr;
               op#ID_BASEOBJECT_REL_POSITION:VECTOR_X = r*cos(ang);
               op#ID_BASEOBJECT_REL_POSITION:VECTOR_Y = r*sin(ang);
          }

          ----------------------------------------------------------------

          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 02/03/2012 at 03:27, xxxxxxxx wrote:

            Hi Sebastian,
            I didn't know that, too.
            Is it missing in the docs? I think so, that should be added please.

            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 02/03/2012 at 04:00, xxxxxxxx wrote:

              Thank you for your answer Sebastian.

              That's a useful info, but unfortunately it doesn't solve the problem. If you try to render the scene you'll notice the motion blur doesn't work well. Apparently it's not able to calculate the interframe positions, so the effect is a simple overlap between a couple of frames.

              In fact I've the same problem using the coffee version.

              I can now reproduce it. The problem is related to GetFrame() which just returns the current frame (as integer). So instead of GetFrame() in Coffee I would use doc->GetTime()->GetSecond() and doc.GetTime().Get() in Python which returns a float value of the current time.  To calculate the motion blur effect the renderer modifies the scene time in smaller steps ( < 1 frame) so these functions are more useful here.

              Is it missing in the docs? I think so, that should be added please.

              You can also call op.GetDocument() but I will mark it to be added. Thx.

              Cheers, Sebastian

              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 02/03/2012 at 09:10, xxxxxxxx wrote:

                That definitely solve the problem, thanks again!

                Riccardo

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