Layershader [SOLVED]

On 03/09/2014 at 09:05, xxxxxxxx wrote:

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


I have been looking through the various posts, and I understand that in previous versions of Cinema you cannot create a LayerShader and then add new shaders to the LayerShader. Is this still the case or is it possible to do so now? Specifically I am trying to add the different Effect items and/or the various Shader items.

Thanks for any replies

On 03/09/2014 at 10:02, xxxxxxxx wrote:


I was looking at. Be possible with Melange. (blendlayers.h header)

It is not clear just how.
Please give an example if possible....
All types of care solutions
It would be very important

Thanks for any replies

On 04/09/2014 at 10:10, xxxxxxxx wrote:

I took a look at the Melange documentation and it doesn't look like it allows what I am looking for.

This is my code to create a Shader of type Xlayer and insert it into the Color Shader field of a newly created material.

  //Create a new material "Material1"  
  //and insert it in the document  
  BaseDocument* doc = GetActiveDocument();  
  Material* myMat = (Material* )BaseMaterial::Alloc(Mmaterial);  
  //Create a BaseShader of type Xlayer and insert in the   
  BaseContainer *data = NULL;  
  data = myMat->GetDataInstance();  
  BaseShader *shader = NULL;  
  shader = BaseShader::Alloc(Xlayer);  
  data->SetLink(MATERIAL_COLOR_SHADER, shader);  
  myMat->InsertShader(shader, NULL);  
  myMat->Update(TRUE, TRUE);  

From here I'm trying to add the different Shader options or Effect options to the LayerShader. This is where I run into trouble, and most of the code examples I've found are dealing with bitmap images.


On 04/09/2014 at 13:36, xxxxxxxx wrote:


it looks like one can only read a layer shader but cannot add new layers.

best wishes,

On 04/09/2014 at 13:43, xxxxxxxx wrote:

Thanks for replying Sebastian, that was the answer I was afraid of.


On 07/09/2014 at 07:06, xxxxxxxx wrote:


Found LayerShader description in melange SDK.