CalcAlpha of Material-Plugin not called in Editor



  • On 31/07/2014 at 10:25, xxxxxxxx wrote:

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

    ---------
    Hi there,

    this post is related to this post of mine: https://plugincafe.maxon.net/topic/8046/10461_passthrough-materialdata-plugin&PID=40545
    No one answered so I try to reformulate my question here: I want my material to be completely transparent (blended! not physically correct transparent). So in all cases, independent of the order of materials on an object, my material should simply have no impact on the object/material/color.

    Therefore, I have the following Material, which returns 0.0f for alpha.

    VOLUMEINFO MyMaterial::GetRenderInfo(BaseMaterial* mat) { return VOLUMEINFO_ALPHA; }
      
    void MyMaterial::CalcSurface(BaseMaterial* mat, VolumeData* vd) { vd->col = Vector(0.0f, 1.0f, 0.0f); } // Green test-color, should not be seen though!
      
    void MyMaterial::CalcAlpha(BaseMaterial* mat, VolumeData* vd) { vd->alpha = 0.0f; }
    

    CalcSuface is called automatically in the Editor and when I render the scene, which is fine.
    CalcAlpha is called, when I render the scene but is NOT called when I'm in the editor.

    Here are two images form C4D, where a red C4D default material lies "below" my own material. In the editor the alpha is simply ignored, the function is never called (tested with GePrint(), std::cout with console and VisualStudio-Debugger). When I render the image, the alpha is called and perfectly evaluated.

    So I thought that the C4D editor might not support alpha-blending (for whatever reason) and I tried to use a C4D default material with an alpha channel. As you can see in the following image, the C4D-Material works perfectly in the editor and is transparent. I use a alpha-texture here, because I seem to be not able to find a single alpha-value for the whole material?!

    So what do I have to do to tell C4D to call CalcAlpha in the editor as well?


Log in to reply