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

    CalcAlpha of Material-Plugin not called in Editor

    SDK Help
    0
    1
    186
    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 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://developers.maxon.net/forum/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?

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