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

    R16 Material Reflectance [LIMITATION]

    Scheduled Pinned Locked Moved PYTHON Development
    16 Posts 0 Posters 2.0k 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

      On 14/04/2015 at 11:02, xxxxxxxx wrote:

      Thanks Yannick - Yes it IS an important blocking issue..  The plugins we are developing we hope will ease the transition from 3dsMax to Cinema4D and also offers VRAY material and settings conversion, so potentially a really important bridge between the two apps..

      The plugins as they were when i recently took over development, were written in Python, because it was more than enough for this type of functionality, and C4D Python encryption meant we could wrap them up as fully fledged plugins.  Refactoring to C++ is possible but would be a lot of work..  And really, it doesn't make sense to not include Reflectance in the Python API when pretty much everything else is there, it's just silly 😕

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

        On 15/04/2015 at 04:03, xxxxxxxx wrote:

        Hi,

        I got the confirmation that it's too late to add the support for reflection layers in R16 :frowning2:.
        But it will be added in the future 🙂.

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

          On 15/04/2015 at 06:31, xxxxxxxx wrote:

          Okay - thanks for doing that Yannick, much appreciated.

          I guess we could look at a C++ solution just for the reflectance element of our plugin.  Assuming it's possible and not too inelegant to launch another plugin from Python and do it that way 😕

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

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

            Hi Eclectrik,
            if it is sufficient for you to use the default specular layer you could hardcode the main layer id and then append the constants for the parameters like this:

              
                mainLayerId = 526336   
                mat[mainLayerId + c4d.REFLECTION_LAYER_MAIN_BLEND_MODE] = 0 # default specular mix mode -> Normal   
                mat[mainLayerId + c4d.REFLECTION_LAYER_MAIN_DISTRIBUTION] = c4d.REFLECTION_DISTRIBUTION_GGX   
                mat[mainLayerId + c4d.REFLECTION_LAYER_MAIN_ADDITIVE] = 0 # sets attenuation to average   
            
            1 Reply Last reply Reply Quote 0
            • H Offline
              Helper
              last edited by

              On 23/04/2015 at 06:27, xxxxxxxx wrote:

              Originally posted by xxxxxxxx

              Hi Eclectrik,
              if it is sufficient for you to use the default specular layer you could hardcode the main layer id and then append the constants for the parameters like this:

               
                mainLayerId = 526336   
                mat[mainLayerId + c4d.REFLECTION_LAYER_MAIN_BLEND_MODE] = 0 # default specular mix mode -> Normal   
                mat[mainLayerId + c4d.REFLECTION_LAYER_MAIN_DISTRIBUTION] = c4d.REFLECTION_DISTRIBUTION_GGX   
                mat[mainLayerId + c4d.REFLECTION_LAYER_MAIN_ADDITIVE] = 0 # sets attenuation to average   
              

              Hi Satara -

              That's really useful thank you very much..  How did you find out the ID for the default layer?  Atm i'm crawling through the basecontainer for the material, trying to find some clues as to what is what - is there an easier way?

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

                On 23/04/2015 at 08:52, xxxxxxxx wrote:

                Normally you can drag and drop the parameter labels into the console input field, but for the reflection parameters it does not take the layer id into account.
                So in this case I also took the manual approach by iterating through the basecontainer to find the id for a specific reflectance parameter and then subtracted the corresponding constant to get the layer id.

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

                  On 23/04/2015 at 09:13, xxxxxxxx wrote:

                  Hi,

                  The C++ API provides the method ReflectionLayer::GetDataID() which gives the data ID in the material container for a layer. It is defined in the API header c4d_reflection.h (all reflection layer data IDs are defined in there too) as this:

                  Int32 GetDataID() const { return REFLECTION_LAYER_LAYER_DATA + REFLECTION_LAYER_LAYER_SIZE * layerID; }
                  

                  Where REFLECTION_LAYER_LAYER_DATA is defined as 0x80000 (=524288) and REFLECTION_LAYER_LAYER_SIZE  as 0x0200 (=512).
                  layerId is then easy to calculate :).

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

                    On 24/04/2015 at 00:12, xxxxxxxx wrote:

                    On a side note, the default reflection layer has the layer ID "4".

                    import c4d
                    mat = doc.GetActiveMaterial()
                    base = c4d.REFLECTION_LAYER_LAYER_DATA + c4d.REFLECTION_LAYER_LAYER_SIZE * 4
                    print mat[base + c4d.REFLECTION_LAYER_MAIN_DISTRIBUTION]
                    
                    1 Reply Last reply Reply Quote 0
                    • H Offline
                      Helper
                      last edited by

                      On 24/04/2015 at 05:17, xxxxxxxx wrote:

                      That's great guys thanks a lot for the help, this should be enough to keep things working in the plugin for now.

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

                        On 25/04/2016 at 10:22, xxxxxxxx wrote:

                        Super Super thanks a lot  guys !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

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