R16 Material Reflectance [LIMITATION]



  • On 14/04/2015 at 10:46, xxxxxxxx wrote:

    Sorry, I had not formulate well my answer in my previous post.
    This seems an important blocking issue, strange it's not been reported earlier. I'll forward it to the developement team, but I fear it's too late for R16...



  • 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 :/



  • 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 🙂.



  • 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 :/



  • 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   
    


  • 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?



  • 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.



  • 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 :).



  • 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]
    


  • 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.



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

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


Log in to reply