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

    Is InitRender called once for each frame of a render?

    Cinema 4D SDK
    c++ 2024
    2
    3
    569
    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.
    • R
      rui_mac
      last edited by

      When rendering an animation, is the InitRender method of a Shader plugin called just once at the start of the render, or is it called once at the start of each rendered frame?

      ferdinandF 1 Reply Last reply Reply Quote 0
      • ferdinandF
        ferdinand @rui_mac
        last edited by ferdinand

        Hey @rui_mac,

        Thank you for reaching out to us. Let me preface my answer with the premise that you are sort of asking the wrong question here.

        You can quite easily put a print statement into an InitRender method and then see that this method is at least called once per render initlization (at least at first glance). When rendering a document with an animation, this means an initlization occurring at least once per frame.

        The problem with your question is that you are trying to establish a causality where is none. We do deliberately do not give any guarantees as to how often certain methods are being called by Cinema 4D, as the core of Cinema 4D does change over time. The method is called whenever Cinema 4D must initialize a rendering, as hinted at by the method name and docs. This naturally also includes frames, but there could be cases where Cinema 4D decides not to reinitialize a shader for a given frame N because some special circumstance X is met, and instead just reuses the shader instance from the last frame. More likely to happen is however, that a node is reinitialized much more often than it is obvious from the outside; e.g., you might end up with three calls for frame 1 and one call for the rest of the frames.

        So, as hinted at the beginning, you are sort of asking here the wrong question. Yes, Cinema 4D will ask you for each render event to setup your shader. Normally this means for each frame a call, but there might be exceptions. There is not this direct causality "either once per instance or once per frame" you imply. This method is called when Cinema 4D initializes a rendering, we cannot give any guarantees beyond that.

        Cheers,
        Ferdinand

        MAXON SDK Specialist
        developers.maxon.net

        1 Reply Last reply Reply Quote 0
        • R
          rui_mac
          last edited by

          Thank you very much, Ferdinand. I understand.

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