MultiOutputChannelTexmapToTexmap : textureMap
MultiOutputChannelTexmapToTexmap - superclass: textureMap; super-superclass:material - 3:1 - classID: #(-1989217540, 1153266751)
Available in 3ds Max 2011 and higher.This texture map is used to switch the output of a MetaSL shader that provides more
than one output.
Constructor:
MultiOutputChannelTexmapToTexmap...
Properties:
<MultiOutputChannelTexmapToTexmap>.numInputs Integer default: 1 -- integer;
Contains the number of Inputs found in the sourceMap.
Read-only.
<MultiOutputChannelTexmapToTexmap>.outputChannelIndex Integer default: 1 -- integer; Output_Channel_Index
Get/Set the Output Channel index.
<MultiOutputChannelTexmapToTexmap>.sourceMap UndefinedClass default: undefined -- texturemap; Source_Map
Get/Set the Source Map.
MultiOutputChannelTexmapToTexmap interfaces:
Interface:iMultiOutputConsumer
Properties:
.numInputs : integer : Read
Contains the number of Inputs found in the sourceMap.
Read-only.
Methods:
<bool>SetOutputToInput <index>input_index <maxObject>output_rtarg <index>output_index
Contains Sets the Output with index specified by the third argument of the shader
specified with the second argument to the input specified with the first argument.
<maxObject>GetOutputRefTargetFromInput <index>input_index
Returns the Reference Target of the indexed input.
<index>GetOutputIndexFromInput <index>input_index
Returns the Output Index of the indexed input.
<bool>CanAssignOutputToInput <index>input_index <maxObject>output_rtarg <index>output_index
Returns true if setting the input specified by the first argument to the output with
index specified by the third argument of the shader provided by the second argument
is possible, false otherwise.
<String by value>GetInputName <index>input_index
Returns the name of the indexed input.
<String by value>GetInputLocalizedName <index>input_index
Returns the localized name of the indexed input.
EXAMPLE
|
Here's an example of using this shader in conjunction with a multi-output MetaSL shader:
|
c=Illumination_Phong() --create an instance of a MetaSL shader
Illumination_Phong:Illumination Phong
showinterfaces c --show the interfaces of the MetaSL shader
Interface: IMtlRender_Compability_MtlBase
Properties:
Methods:
Actions:
Interface: IMaterialBrowseEntryInfoInterface
Properties:
Methods:
Actions:
Interface: iMultipleOutputChannels
Properties:
.numIMultipleOutputChannels : integer : Read
Methods:
<TSTR by value>getIMultipleOutputChannelLocalizedName <index>index
getIMultipleOutputChannelLocalizedName - no automatic redraw after invoked
<TSTR by value>getIMultipleOutputChannelName <index>index
getIMultipleOutputChannelName - no automatic redraw after invoked
Actions:
Interface: iMultiOutputConsumer
Properties:
.numInputs : integer : Read
Methods:
<bool>SetOutputToInput <index>input_index <maxObject>output_rtarg <index>output_index
<maxObject>GetOutputRefTargetFromInput <index>input_index
<index>GetOutputIndexFromInput <index>input_index
<bool>CanAssignOutputToInput <index>input_index <maxObject>output_rtarg <index>output_index
<TSTR by value>GetInputName <index>input_index
GetInputName - no automatic redraw after invoked
<TSTR by value>GetInputLocalizedName <index>input_index
GetInputLocalizedName - no automatic redraw after invoked
Actions:
OK
getpropnames c
#(#Illumination_phong_Phen, #diffuse_color, #diffuse_scalar, #specular_color, #specular_scalar, #specular_shininess, #normalPhen, #Connection_struct__0000__Illumination_phong_Phen, #diffuse_color_connected, #diffuse_color_shader, #diffuse_color_paramName, #diffuse_scalar_connected, #diffuse_scalar_shader, #diffuse_scalar_paramName, #specular_color_connected, #specular_color_shader, #specular_color_paramName, #specular_scalar_connected, #specular_scalar_shader, #specular_scalar_paramName, ...)
--Get the number of output channels of the MetaSL shader:
n_outputs = c.numIMultipleOutputChannels
4
--Print the localized and internal names of the output channels of
--the MetaSL shader :
for i = 1 to n_outputs do format "% : %\n" \
(c.getIMultipleOutputChannelLocalizedName i) \
(c.getIMultipleOutputChannelName i)
result : result
sum : sum
diffuse : diffuse
specular : specular
OK
--Get the number of inputs of the MetaSL shader:
n_inputs = c.numInputs
6
--Print the localized and internal input names of the MetaSL shader:
for i = 1 to n_inputs do
format "% : %\n" (c.GetInputLocalizedName i) (c.GetInputName i)
Diffuse Color : Diffuse Color
Diffuse Float : Diffuse Float
Specular Color : Specular Color
Specular Float : Specular Float
Specular Shininess : Specular Shininess
Normal : Normal
OK
--Create an instance of the MultiOuputChannelTexmapToTexmap shader,
--using the MetaSL shader as source and set the index of the output
--channel to 1:
mo = MultiOutputChannelTexmapToTexmap sourceMap:c outputChannelIndex:1
MultiOutputChannelTexmapToTexmap:MultiOutputChannelTexmapToTexmap
--Check the property names of the new shader:
getpropnames mo
#(#sourceMap, #outputChannelIndex, #numInputs)
--If the source map and index are not specified in the constructor as
--we did above, they can be assigned to the respective properties:
mo.sourcemap = c
Illumination_Phong:Illumination Phong
mo.outputChannelIndex = 1
1
--Get the number of the inputs of the new shader:
n_inputs = mo.numInputs
1
--Print the inputs' localized and internal name, ref.target and index:
for i = 1 to n_inputs do
format "% : % : % : %\n" (c.GetInputLocalizedName i) \
(c.GetInputName i) (mo.GetOutputRefTargetFromInput i) \
(mo.GetOutputIndexFromInput i)
Diffuse Color : Diffuse Color : Illumination_Phong:Illumination Phong : 1
OK
--Create a new standard material with the new map as diffuse map
--and show it in the viewport:
m = standard diffusemap:mo showInViewport:true
Standardmaterial:Standard
--Create a teapot with this material assigned and non-real-world UVs:
teapot material:m realWorldMapSize:off
$Teapot:Teapot001 @ [0.000000,0.000000,0.000000]
--Load the shaders into the Material Editor's slots 1,2 and 3:
meditmaterials[1]=mo
MultiOutputChannelTexmapToTexmap:MultiOutputChannelTexmapToTexmap
meditmaterials[2]=c
Illumination_Phong:Illumination Phong
meditmaterials[3]=m
Standardmaterial:Standard
--Set output 2 of the MetaSL shader to input 1:
mo.SetOutputToInput 1 c 2
true
|