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

    Different shaders with same settings

    SDK Help
    0
    3
    925
    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 16/06/2018 at 03:04, xxxxxxxx wrote:

      User Information:
      Cinema 4D Version:   R18.057 
      Platform:   Windows  ; Mac  ;  
      Language(s) :     C++  ;  XPRESSO  ;  PYTHON  ;

      ---------
      Hello PluginCafe,

      I have been developing a plugin for a client where I have two different shaders but with the same settings. Internally I have a Class wich does (relatively heavy) computations and the shaders are different represantations of the computed data.

      What I currently have are two seperately working shaders, the problem is, that they are intended to be used together. They way it is now it is doing the same computation twice. Also for them to work together one would have to change the same settings in both shaders to the same value.

      So my question(s) essentially is(are) : 
      Is there a way to store my computed data in some kind of buffer object, which the two shaders can access? Also moving the settings to one shader/object instead of two different shaders?

      Would this be possible with an object data plugin?
      The shaders do animate, so I am not shure how this would work with recalculating each frame if I would use an object data plugin.

      Hope everything is clear. 
      Best regards and thanks in advance,
      Florian

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

        On 18/06/2018 at 09:00, xxxxxxxx wrote:

        Hi Florian,

        the proper way to hold additional data (your computed data) inside of a document is in a branch (GetBranchInfo()) of a SceneHookData. Then both of your shaders would retrieve the data from the SceneHook.
        Maybe not the easiest topic, but we can get you there.
        Depending on your specific needs and use-case it can be more or less complicated. Instead of trying to explain everything (and most likely writing more than needed), I'd rather like to support you while you go, answering more specific questions.

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

          On 19/06/2018 at 03:05, xxxxxxxx wrote:

          Hi Andreas,

          thank you for this information! 
          I will take a look, and try it. 
          If a question arises, I will go ahead an ask it 🙂

          best regards,
          Florian

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