Here you will find documentation on all the descriptions that Cinema 4D currently has. You can list them Alphabetically, by Type or Plugin . The sample Python and C++ code is automatically generated and in some cases may not be 100% correct. If something doesn't work then please refer to the official Cinema 4D SDK documentation for more information.

IDs and information for Mfog

Mfog

Attributes

  • ENGLISH NAME : FogShader
  • NAME : Mfog
  • INCLUDE : Mpreview
  • INCLUDE : Mbase
  • INCLUDE : Massign
  • PATH : shader/description/mfog.res
  • PLUGIN : shader
  • MAXON online help (may not exist): MFOG

Elements

ID UI Name Type Parameters Cycle
MATERIAL_PAGE_PROPERTIES BOOL
HIDDEN
PAGE
PARENTMSG ID_MATERIALPROPERTIES
FOGSHADER_COLOR Color COLOR  
FOGSHADER_SAMPLES Samples LONG
MIN 4
MAX 100
FOGSHADER_VOLUMETRIC Volumetric BOOL  
FOGSHADER_SCALE Frequency VECTOR
MIN 0.0
STEP 0.01
FOGSHADER_TYPE Type LONG  
FOGSHADER_TYPE_LINEAR Linear
FOGSHADER_TYPE_EXPONENTIAL Exponential
FOGSHADER_TYPE_NODECREASE NoDecrease
FOGSHADER_THICKNESS Thickness REAL
UNIT PERCENT
MIN 0.0
FOGSHADER_DECREASE Decrease REAL
UNIT PERCENT
MIN 0.0
FOGSHADER_TURBULENCE Turbulence REAL
UNIT PERCENT
MIN 0.0
FOGSHADER_AMPLITUDE Amplitude REAL
UNIT PERCENT
MIN 0.0
MAX 1000.0
FOGSHADER_FREQUENCY TFrequency REAL
UNIT PERCENT
MIN 0.0
STEP 0.01

Example Code

The following code does not use the correct values when setting the data. You should check directly in C4D for the correct values that you should use in place of the ones that are shown. This code is just to show you how to access the values for getting and setting the parameters.

Python

import c4d
from c4d import gui
def main():
    material = c4d.BaseMaterial(c4d.Mfog)
    
    #You can set parameters two different ways. 
    #First way              
    material[c4d.MATERIAL_PAGE_PROPERTIES] = True
    material[c4d.FOGSHADER_SAMPLES] = 1
    material[c4d.FOGSHADER_VOLUMETRIC] = True
    material[c4d.FOGSHADER_SCALE] = c4d.Vector(1.0,1.0,1.0)
    material[c4d.FOGSHADER_TYPE] = c4d.FOGSHADER_TYPE_LINEAR
    material[c4d.FOGSHADER_THICKNESS] = 0.1
    material[c4d.FOGSHADER_DECREASE] = 0.1
    material[c4d.FOGSHADER_TURBULENCE] = 0.1
    material[c4d.FOGSHADER_AMPLITUDE] = 0.1
    material[c4d.FOGSHADER_FREQUENCY] = 0.1
    
    #Second way, using the base container.
    bc = material.GetDataInstance()
    bc.SetBool(c4d.MATERIAL_PAGE_PROPERTIES,True)
    bc.SetInt32(c4d.FOGSHADER_SAMPLES,1)
    bc.SetBool(c4d.FOGSHADER_VOLUMETRIC,True)
    bc.SetVector(c4d.FOGSHADER_SCALE, c4d.Vector(1.0,1.0,1.0)
    bc.SetInt32(c4d.FOGSHADER_TYPE,c4d.FOGSHADER_TYPE_LINEAR)
    bc.SetFloat(c4d.FOGSHADER_THICKNESS,0.1)
    bc.SetFloat(c4d.FOGSHADER_DECREASE,0.1)
    bc.SetFloat(c4d.FOGSHADER_TURBULENCE,0.1)
    bc.SetFloat(c4d.FOGSHADER_AMPLITUDE,0.1)
    bc.SetFloat(c4d.FOGSHADER_FREQUENCY,0.1)

if __name__=='__main__':
    main()
             

C++

#include "c4d.h"
#include "../shader/description/mfog.h"
void SampleFunction()
{
    BaseDocument *pDoc = GetActiveDocument();
    BaseMaterial *pMaterial = BaseMaterial::Alloc(Mfog);  
    
    //You can set parameters two different ways. 

    //First way              
    //Some objects do not store all their data in the container. You need to use GetParameter()/SetParameter() instead. 

    DESCFLAGS_SET flags = DESCFLAGS_SET_PARAM_SET;
    pMaterial->SetParameter(DescID(MATERIAL_PAGE_PROPERTIES),GeData(true),flags);
    pMaterial->SetParameter(DescID(FOGSHADER_SAMPLES),GeData(1),flags);
    pMaterial->SetParameter(DescID(FOGSHADER_VOLUMETRIC),GeData(true),flags);
    pMaterial->SetParameter(DescID(FOGSHADER_SCALE),GeData(Vector(1.0,1.0,1.0)),flags);
    pMaterial->SetParameter(DescID(FOGSHADER_TYPE),GeData(FOGSHADER_TYPE_LINEAR),flags);
    pMaterial->SetParameter(DescID(FOGSHADER_THICKNESS),GeData(0.1),flags);
    pMaterial->SetParameter(DescID(FOGSHADER_DECREASE),GeData(0.1),flags);
    pMaterial->SetParameter(DescID(FOGSHADER_TURBULENCE),GeData(0.1),flags);
    pMaterial->SetParameter(DescID(FOGSHADER_AMPLITUDE),GeData(0.1),flags);
    pMaterial->SetParameter(DescID(FOGSHADER_FREQUENCY),GeData(0.1),flags);
    pMaterial->Message(MSG_UPDATE);            

    //Second way, using the base container.
    BaseContainer *bc =     pMaterial->GetDataInstance();
    bc->SetBool(MATERIAL_PAGE_PROPERTIES,true);
    bc->SetInt32(FOGSHADER_SAMPLES,1);
    bc->SetBool(FOGSHADER_VOLUMETRIC,true);
    bc->SetVector(FOGSHADER_SCALE, c4d.Vector(1.0,1.0,1.0);
    bc->SetInt32(FOGSHADER_TYPE,FOGSHADER_TYPE_LINEAR);
    bc->SetFloat(FOGSHADER_THICKNESS,0.1);
    bc->SetFloat(FOGSHADER_DECREASE,0.1);
    bc->SetFloat(FOGSHADER_TURBULENCE,0.1);
    bc->SetFloat(FOGSHADER_AMPLITUDE,0.1);
    bc->SetFloat(FOGSHADER_FREQUENCY,0.1);
    pMaterial->Message(MSG_UPDATE);                                                      
}