C4D Material parameters return wrong values



  • On 24/09/2015 at 04:03, xxxxxxxx wrote:

    User Information:
    Cinema 4D Version:   R17 
    Platform:   Windows  ;   
    Language(s) :     C++  ;

    ---------
    Hello.

    Not sure if it's a bug or not but when i create a C4D material and then i try to retrieve it's specular parameters, i get wrong values.

    Here is the test case:
    -Create a C4D Material.
    -Use only  Reflectance channel (disable the rest).
    -Go to Reflectance > Default Specular and set reflection color and brightness.
    -Get the parameters:

    TextureTag* tag = (TextureTag* )object->GetTag(Ttexture);
    Material* material = (Material* )GetParameterLink(*tag,TEXTURETAG_MATERIAL,Mmaterial);
    Vector s_color =  < Get MATERIAL_SPECULAR_COLOR Parameter >
    Real s_brightness =  < Get MATERIAL_SPECULAR_BRIGHTNESS Parameter >
    

    This is how i get the parameters (Vector Example) :

    GeData ge_data;
    if (object.GetParameter(DescLevel(param_id), ge_data, DESCFLAGS_GET_0))
        return ge_data.GetVector();
    

    The above code returns always 1,1,1 for color and 1 for brightness.

    Now, what's strange is that if i save the project and try the above procedure again, i get the correct values (using the exact same code).

    Do i do anything wrong ?

    Thank you for your time.



  • On 24/09/2015 at 06:09, xxxxxxxx wrote:

    not sure, probably:
    return ge_data.GetVector();



  • On 24/09/2015 at 07:27, xxxxxxxx wrote:

    I misstyped the code. fixed it.



  • On 25/09/2015 at 04:43, xxxxxxxx wrote:

    I mean i fixed the code in this thread. 
    Not the issue.



  • On 25/09/2015 at 08:08, xxxxxxxx wrote:

    Hi,

    I'd prefer to get some contiguous pieces of code, instead of a few lines pseudo code. Especially when talking about Reflectance the details can be important.
    From the first few lines of "code", I assume, you are accessing the Reflectance channel "old style". I'd recommend to rather use the Reflectance Layers directly to access the parameters.
    There's an article about Reflectance in the SDK documentation, that may be helpful.


Log in to reply