Xxmbsubsurface
Attributes
-
ENGLISH NAME : SubsurfaceScatteringShader
-
NAME : Xxmbsubsurface
-
INCLUDE : Mpreview
-
INCLUDE : Xbase
-
PATH : c4dplugin/description/xxmbsubsurface.res
-
PLUGIN : c4dplugin
-
MAXON online help (may not exist): XXMBSUBSURFACE
Elements
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():
shader = c4d.BaseShader(c4d.Xxmbsubsurface)
#You can set parameters two different ways.
#First way
shader[c4d.XMBSUBSURFACESHADER_PRESET] = c4d.XMBSUBSURFACESHADER_PRESET_CUSTOM
shader[c4d.XMBSUBSURFACESHADER_STRENGTH] = 0.1
shader[c4d.XMBSUBSURFACESHADER_LENGTH] = 0.1
shader[c4d.XMBSUBSURFACESHADER_LENGTH_R] = 0.1
shader[c4d.XMBSUBSURFACESHADER_LENGTH_G] = 0.1
shader[c4d.XMBSUBSURFACESHADER_LENGTH_B] = 0.1
shader[c4d.XMBSUBSURFACESHADER_MULTIPLE_MODE] = c4d.XMBSUBSURFACESHADER_MULTIPLE_MODE_CACHE
shader[c4d.XMBSUBSURFACESHADER_MULTIPLE_ENABLED] = True
shader[c4d.XMBSUBSURFACESHADER_CACHE_INTERPOLATION] = True
shader[c4d.XMBSUBSURFACESHADER_CACHE_SAMPLE_DENSITY] = 0.1
shader[c4d.XMBSUBSURFACESHADER_CACHE_SMOOTHING] = 0.1
shader[c4d.XMBSUBSURFACESHADER_CACHE_ERROR] = 0.1
shader[c4d.XMBSUBSURFACESHADER_DIRECT_SPLIT] = True
shader[c4d.XMBSUBSURFACESHADER_DIRECT_RATIO] = 0.1
shader[c4d.XMBSUBSURFACESHADER_MULTIPLE_CUSTOM_ENABLED] = True
shader[c4d.XMBSUBSURFACESHADER_MULTIPLE_CUSTOM_SAMPLING] = 0.1
shader[c4d.XMBSUBSURFACESHADER_SINGLE_ENABLED] = True
shader[c4d.XMBSUBSURFACESHADER_SINGLE_SPLIT] = True
shader[c4d.XMBSUBSURFACESHADER_SINGLE_TRACE] = True
shader[c4d.XMBSUBSURFACESHADER_SINGLE_PHASE] = 0.1
shader[c4d.XMBSUBSURFACESHADER_SINGLE_CUSTOM_ENABLED] = True
shader[c4d.XMBSUBSURFACESHADER_SINGLE_CUSTOM_SAMPLING] = 0.1
shader[c4d.XMBSUBSURFACESHADER_FRESNEL] = 0.1
shader[c4d.XMBSUBSURFACESHADER_DITHER] = 0.1
shader[c4d.XMBSUBSURFACESHADER_IOR] = 0.1
shader[c4d.XMBSUBSURFACESHADER_LIGHTS_GI] = True
shader[c4d.XMBSUBSURFACESHADER_LIGHTS_MODE] = c4d.XMBSUBSURFACESHADER_LIGHTS_MODE_INCLUDE
shader[c4d.XMBSUBSURFACESHADER_GPURENDER_SSS_WEIGHT] = 0.1
shader[c4d.XMBSUBSURFACESHADER_GPURENDER_PRESET] = c4d.XMBSUBSURFACESHADER_PRESET_CUSTOM
shader[c4d.XMBSUBSURFACESHADER_GPURENDER_RADIUS_SCALE] = 0.1
shader[c4d.XMBSUBSURFACESHADER_GPURENDER_PHASE] = 0.1
shader[c4d.XMBSUBSURFACESHADER_GPURENDER_IS_TRANSPARENT] = True
shader[c4d.XMBSUBSURFACESHADER_GPURENDER_EMISSION_BRIGHTNESS] = 0.1
shader[c4d.XMBSUBSURFACESHADER_GPURENDER_MULTISCATTER_ENABLED] = True
#Second way, using the base container.
bc = shader.GetDataInstance()
bc.SetInt32(c4d.XMBSUBSURFACESHADER_PRESET,c4d.XMBSUBSURFACESHADER_PRESET_CUSTOM)
bc.SetFloat(c4d.XMBSUBSURFACESHADER_STRENGTH,0.1)
bc.SetFloat(c4d.XMBSUBSURFACESHADER_LENGTH,0.1)
bc.SetFloat(c4d.XMBSUBSURFACESHADER_LENGTH_R,0.1)
bc.SetFloat(c4d.XMBSUBSURFACESHADER_LENGTH_G,0.1)
bc.SetFloat(c4d.XMBSUBSURFACESHADER_LENGTH_B,0.1)
bc.SetInt32(c4d.XMBSUBSURFACESHADER_MULTIPLE_MODE,c4d.XMBSUBSURFACESHADER_MULTIPLE_MODE_CACHE)
bc.SetBool(c4d.XMBSUBSURFACESHADER_MULTIPLE_ENABLED,True)
bc.SetBool(c4d.XMBSUBSURFACESHADER_CACHE_INTERPOLATION,True)
bc.SetFloat(c4d.XMBSUBSURFACESHADER_CACHE_SAMPLE_DENSITY,0.1)
bc.SetFloat(c4d.XMBSUBSURFACESHADER_CACHE_SMOOTHING,0.1)
bc.SetFloat(c4d.XMBSUBSURFACESHADER_CACHE_ERROR,0.1)
bc.SetBool(c4d.XMBSUBSURFACESHADER_DIRECT_SPLIT,True)
bc.SetFloat(c4d.XMBSUBSURFACESHADER_DIRECT_RATIO,0.1)
bc.SetBool(c4d.XMBSUBSURFACESHADER_MULTIPLE_CUSTOM_ENABLED,True)
bc.SetFloat(c4d.XMBSUBSURFACESHADER_MULTIPLE_CUSTOM_SAMPLING,0.1)
bc.SetBool(c4d.XMBSUBSURFACESHADER_SINGLE_ENABLED,True)
bc.SetBool(c4d.XMBSUBSURFACESHADER_SINGLE_SPLIT,True)
bc.SetBool(c4d.XMBSUBSURFACESHADER_SINGLE_TRACE,True)
bc.SetFloat(c4d.XMBSUBSURFACESHADER_SINGLE_PHASE,0.1)
bc.SetBool(c4d.XMBSUBSURFACESHADER_SINGLE_CUSTOM_ENABLED,True)
bc.SetFloat(c4d.XMBSUBSURFACESHADER_SINGLE_CUSTOM_SAMPLING,0.1)
bc.SetFloat(c4d.XMBSUBSURFACESHADER_FRESNEL,0.1)
bc.SetFloat(c4d.XMBSUBSURFACESHADER_DITHER,0.1)
bc.SetFloat(c4d.XMBSUBSURFACESHADER_IOR,0.1)
bc.SetBool(c4d.XMBSUBSURFACESHADER_LIGHTS_GI,True)
bc.SetInt32(c4d.XMBSUBSURFACESHADER_LIGHTS_MODE,c4d.XMBSUBSURFACESHADER_LIGHTS_MODE_INCLUDE)
bc.SetFloat(c4d.XMBSUBSURFACESHADER_GPURENDER_SSS_WEIGHT,0.1)
bc.SetInt32(c4d.XMBSUBSURFACESHADER_GPURENDER_PRESET,c4d.XMBSUBSURFACESHADER_PRESET_CUSTOM)
bc.SetFloat(c4d.XMBSUBSURFACESHADER_GPURENDER_RADIUS_SCALE,0.1)
bc.SetFloat(c4d.XMBSUBSURFACESHADER_GPURENDER_PHASE,0.1)
bc.SetBool(c4d.XMBSUBSURFACESHADER_GPURENDER_IS_TRANSPARENT,True)
bc.SetFloat(c4d.XMBSUBSURFACESHADER_GPURENDER_EMISSION_BRIGHTNESS,0.1)
bc.SetBool(c4d.XMBSUBSURFACESHADER_GPURENDER_MULTISCATTER_ENABLED,True)
if __name__=='__main__':
main()
C++
#include "c4d.h"
#include "../c4dplugin/description/xxmbsubsurface.h"
void SampleFunction()
{
BaseDocument *pDoc = GetActiveDocument();
BaseShader *pShader = BaseShader::Alloc(Xxmbsubsurface);
//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;
pShader->SetParameter(DescID(XMBSUBSURFACESHADER_PRESET),GeData(XMBSUBSURFACESHADER_PRESET_CUSTOM),flags);
pShader->SetParameter(DescID(XMBSUBSURFACESHADER_STRENGTH),GeData(0.1),flags);
pShader->SetParameter(DescID(XMBSUBSURFACESHADER_LENGTH),GeData(0.1),flags);
pShader->SetParameter(DescID(XMBSUBSURFACESHADER_LENGTH_R),GeData(0.1),flags);
pShader->SetParameter(DescID(XMBSUBSURFACESHADER_LENGTH_G),GeData(0.1),flags);
pShader->SetParameter(DescID(XMBSUBSURFACESHADER_LENGTH_B),GeData(0.1),flags);
pShader->SetParameter(DescID(XMBSUBSURFACESHADER_MULTIPLE_MODE),GeData(XMBSUBSURFACESHADER_MULTIPLE_MODE_CACHE),flags);
pShader->SetParameter(DescID(XMBSUBSURFACESHADER_MULTIPLE_ENABLED),GeData(true),flags);
pShader->SetParameter(DescID(XMBSUBSURFACESHADER_CACHE_INTERPOLATION),GeData(true),flags);
pShader->SetParameter(DescID(XMBSUBSURFACESHADER_CACHE_SAMPLE_DENSITY),GeData(0.1),flags);
pShader->SetParameter(DescID(XMBSUBSURFACESHADER_CACHE_SMOOTHING),GeData(0.1),flags);
pShader->SetParameter(DescID(XMBSUBSURFACESHADER_CACHE_ERROR),GeData(0.1),flags);
pShader->SetParameter(DescID(XMBSUBSURFACESHADER_DIRECT_SPLIT),GeData(true),flags);
pShader->SetParameter(DescID(XMBSUBSURFACESHADER_DIRECT_RATIO),GeData(0.1),flags);
pShader->SetParameter(DescID(XMBSUBSURFACESHADER_MULTIPLE_CUSTOM_ENABLED),GeData(true),flags);
pShader->SetParameter(DescID(XMBSUBSURFACESHADER_MULTIPLE_CUSTOM_SAMPLING),GeData(0.1),flags);
pShader->SetParameter(DescID(XMBSUBSURFACESHADER_SINGLE_ENABLED),GeData(true),flags);
pShader->SetParameter(DescID(XMBSUBSURFACESHADER_SINGLE_SPLIT),GeData(true),flags);
pShader->SetParameter(DescID(XMBSUBSURFACESHADER_SINGLE_TRACE),GeData(true),flags);
pShader->SetParameter(DescID(XMBSUBSURFACESHADER_SINGLE_PHASE),GeData(0.1),flags);
pShader->SetParameter(DescID(XMBSUBSURFACESHADER_SINGLE_CUSTOM_ENABLED),GeData(true),flags);
pShader->SetParameter(DescID(XMBSUBSURFACESHADER_SINGLE_CUSTOM_SAMPLING),GeData(0.1),flags);
pShader->SetParameter(DescID(XMBSUBSURFACESHADER_FRESNEL),GeData(0.1),flags);
pShader->SetParameter(DescID(XMBSUBSURFACESHADER_DITHER),GeData(0.1),flags);
pShader->SetParameter(DescID(XMBSUBSURFACESHADER_IOR),GeData(0.1),flags);
pShader->SetParameter(DescID(XMBSUBSURFACESHADER_LIGHTS_GI),GeData(true),flags);
pShader->SetParameter(DescID(XMBSUBSURFACESHADER_LIGHTS_MODE),GeData(XMBSUBSURFACESHADER_LIGHTS_MODE_INCLUDE),flags);
pShader->SetParameter(DescID(XMBSUBSURFACESHADER_GPURENDER_SSS_WEIGHT),GeData(0.1),flags);
pShader->SetParameter(DescID(XMBSUBSURFACESHADER_GPURENDER_PRESET),GeData(XMBSUBSURFACESHADER_PRESET_CUSTOM),flags);
pShader->SetParameter(DescID(XMBSUBSURFACESHADER_GPURENDER_RADIUS_SCALE),GeData(0.1),flags);
pShader->SetParameter(DescID(XMBSUBSURFACESHADER_GPURENDER_PHASE),GeData(0.1),flags);
pShader->SetParameter(DescID(XMBSUBSURFACESHADER_GPURENDER_IS_TRANSPARENT),GeData(true),flags);
pShader->SetParameter(DescID(XMBSUBSURFACESHADER_GPURENDER_EMISSION_BRIGHTNESS),GeData(0.1),flags);
pShader->SetParameter(DescID(XMBSUBSURFACESHADER_GPURENDER_MULTISCATTER_ENABLED),GeData(true),flags);
pShader->Message(MSG_UPDATE);
//Second way, using the base container.
BaseContainer *bc = pShader->GetDataInstance();
bc->SetInt32(XMBSUBSURFACESHADER_PRESET,XMBSUBSURFACESHADER_PRESET_CUSTOM);
bc->SetFloat(XMBSUBSURFACESHADER_STRENGTH,0.1);
bc->SetFloat(XMBSUBSURFACESHADER_LENGTH,0.1);
bc->SetFloat(XMBSUBSURFACESHADER_LENGTH_R,0.1);
bc->SetFloat(XMBSUBSURFACESHADER_LENGTH_G,0.1);
bc->SetFloat(XMBSUBSURFACESHADER_LENGTH_B,0.1);
bc->SetInt32(XMBSUBSURFACESHADER_MULTIPLE_MODE,XMBSUBSURFACESHADER_MULTIPLE_MODE_CACHE);
bc->SetBool(XMBSUBSURFACESHADER_MULTIPLE_ENABLED,true);
bc->SetBool(XMBSUBSURFACESHADER_CACHE_INTERPOLATION,true);
bc->SetFloat(XMBSUBSURFACESHADER_CACHE_SAMPLE_DENSITY,0.1);
bc->SetFloat(XMBSUBSURFACESHADER_CACHE_SMOOTHING,0.1);
bc->SetFloat(XMBSUBSURFACESHADER_CACHE_ERROR,0.1);
bc->SetBool(XMBSUBSURFACESHADER_DIRECT_SPLIT,true);
bc->SetFloat(XMBSUBSURFACESHADER_DIRECT_RATIO,0.1);
bc->SetBool(XMBSUBSURFACESHADER_MULTIPLE_CUSTOM_ENABLED,true);
bc->SetFloat(XMBSUBSURFACESHADER_MULTIPLE_CUSTOM_SAMPLING,0.1);
bc->SetBool(XMBSUBSURFACESHADER_SINGLE_ENABLED,true);
bc->SetBool(XMBSUBSURFACESHADER_SINGLE_SPLIT,true);
bc->SetBool(XMBSUBSURFACESHADER_SINGLE_TRACE,true);
bc->SetFloat(XMBSUBSURFACESHADER_SINGLE_PHASE,0.1);
bc->SetBool(XMBSUBSURFACESHADER_SINGLE_CUSTOM_ENABLED,true);
bc->SetFloat(XMBSUBSURFACESHADER_SINGLE_CUSTOM_SAMPLING,0.1);
bc->SetFloat(XMBSUBSURFACESHADER_FRESNEL,0.1);
bc->SetFloat(XMBSUBSURFACESHADER_DITHER,0.1);
bc->SetFloat(XMBSUBSURFACESHADER_IOR,0.1);
bc->SetBool(XMBSUBSURFACESHADER_LIGHTS_GI,true);
bc->SetInt32(XMBSUBSURFACESHADER_LIGHTS_MODE,XMBSUBSURFACESHADER_LIGHTS_MODE_INCLUDE);
bc->SetFloat(XMBSUBSURFACESHADER_GPURENDER_SSS_WEIGHT,0.1);
bc->SetInt32(XMBSUBSURFACESHADER_GPURENDER_PRESET,XMBSUBSURFACESHADER_PRESET_CUSTOM);
bc->SetFloat(XMBSUBSURFACESHADER_GPURENDER_RADIUS_SCALE,0.1);
bc->SetFloat(XMBSUBSURFACESHADER_GPURENDER_PHASE,0.1);
bc->SetBool(XMBSUBSURFACESHADER_GPURENDER_IS_TRANSPARENT,true);
bc->SetFloat(XMBSUBSURFACESHADER_GPURENDER_EMISSION_BRIGHTNESS,0.1);
bc->SetBool(XMBSUBSURFACESHADER_GPURENDER_MULTISCATTER_ENABLED,true);
pShader->Message(MSG_UPDATE);
}