Pass-Through MaterialData Plugin

On 25/07/2014 at 14:54, xxxxxxxx wrote:

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

Hi there,

I want to create a material that has some options and can be dragged onto objects. C4D evaluates materials from right to left, so if multiple materials are used I would have to select an appropriate blend mode, right? I would like my material to do absolutely nothing, just a complete pass-through for all channels/shaders/options/etc. It should behave like it is actually not there at all, so that the user does not have to select blend modes and such things. You could see this material more like a tag, but it feels like a material for the user.

What functions do I have to override or is this not even necessary at all? If I have to override functions like CalcSurface, what do they have to do? Simply copy the content from source to destination? In an ideal case my material should not use any resources.

Thanks a lot. By the way, this forum is great and has very short response times. Have a nice day! 🙂

On 29/07/2014 at 01:09, xxxxxxxx wrote:

Ok, I got something:

MyMaterial overrides the following functions:

VOLUMEINFO MyMaterial::GetRenderInfo(BaseMaterial* mat)
void MyMaterial::CalcSurface(BaseMaterial* mat, VolumeData* vd)
	vd->col = Vector(0.0f, 1.0f, 0.0f);
void MyMaterial::CalcAlpha(BaseMaterial* mat, VolumeData* vd)
	vd->alpha = 0.0f;

CalcSuface is called automatically and my material appears green in the editor as well as in a rendering. 
CalcAlpha is not called automatically so I tell C4D that my material/shader needs alpha computations in the GetRenderInfo method. 
Now CalcAlpha is called when I render the scene but it is not called in the editor.

Here are two images form C4D:

When I use a C4D-Material with alpha, then everything works as expected, even in the editor, see here:

Remember, that I want my material to be invisible nevertheless where it is in the material hierarchy. Therefore I thought that alpha might be the best way of doing this 🙂

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

On 31/07/2014 at 10:29, xxxxxxxx wrote:

Since my question became more precise, I have it reposted here:

If anyone knows another way of making a "pass-through" material (other than alpha-blending), please post it here 🙂