beastapi/beastmaterial.h File Reference

#include "beastapitypes.h"

File Description

The api for specifying materials in beast.

Enumerations

enum  ILBMaterialChannel {
  ILB_CC_DIFFUSE = 0, ILB_CC_SPECULAR, ILB_CC_EMISSIVE, ILB_CC_TRANSPARENCY,
  ILB_CC_SHININESS, ILB_CC_REFLECTION, ILB_CC_NONDIRECTIONAL, ILB_CC_NORMAL
}
 
enum  ILBMaterialChannelWrapMode { ILB_WM_REPEAT = 0, ILB_WM_MIRROR, ILB_WM_CLAMP }
 

Functions

ILBStatus ILBCreateMaterial (ILBSceneHandle scene, ILBConstString name, ILBMaterialHandle *material)
 
ILBStatus ILBCreateShader (ILBManagerHandle beastManager, ILBConstString uniqueName, ILBConstString fileName, ILBShaderHandle *target)
 
ILBStatus ILBFindMaterial (ILBSceneHandle scene, ILBConstString name, ILBMaterialHandle *material)
 
ILBStatus ILBFindShader (ILBManagerHandle beastManager, ILBConstString uniqueName, ILBShaderHandle *target)
 
ILBStatus ILBSetAlphaAsTransparency (ILBMaterialHandle material, ILBBool alphaAsTransparency)
 
ILBStatus ILBSetChannelUVLayer (ILBMaterialHandle material, ILBMaterialChannel channel, ILBConstString uvLayerName)
 
ILBStatus ILBSetGIScale (ILBMaterialHandle material, float diffuseBoost, float emissiveScale, float specularScale)
 
ILBStatus ILBSetMaterialColor (ILBMaterialHandle material, ILBMaterialChannel channel, const ILBLinearRGBA *color)
 
ILBStatus ILBSetMaterialDisplayName (ILBMaterialHandle material, ILBConstString displayName)
 
ILBStatus ILBSetMaterialScale (ILBMaterialHandle material, ILBMaterialChannel channel, float scale)
 
ILBStatus ILBSetMaterialTexture (ILBMaterialHandle material, ILBMaterialChannel channel, ILBTextureHandle texture)
 
ILBStatus ILBSetMaterialTextureWrapMode (ILBMaterialHandle material, ILBMaterialChannel channel, ILBMaterialChannelWrapMode wrapModeU, ILBMaterialChannelWrapMode wrapModeV, ILBTextureHandle texture)
 
ILBStatus ILBSetMaterialUseVertexColors (ILBMaterialHandle material, ILBMaterialChannel channel)
 
ILBStatus ILBSetPrimaryGICorrection (ILBMaterialHandle material, float intensity, float saturation)
 
ILBStatus ILBSetSecondaryGICorrection (ILBMaterialHandle material, float intensity, float saturation)
 
ILBStatus ILBSetShader (ILBMaterialHandle material, ILBShaderHandle shader)
 
ILBStatus ILBSetShaderParamColor (ILBMaterialHandle material, ILBConstString param, ILBLinearRGB *value)
 
ILBStatus ILBSetShaderParamFloat (ILBMaterialHandle material, ILBConstString param, float value)
 
ILBStatus ILBSetShaderParamInt (ILBMaterialHandle material, ILBConstString param, int32 value)
 
ILBStatus ILBSetShaderParamTexture (ILBMaterialHandle material, ILBConstString param, ILBTextureHandle value)
 
ILBStatus ILBSetShaderParamUV (ILBMaterialHandle material, ILBConstString param, ILBConstString value)
 

Enumeration Type Documentation

Defines the different channels in the Beast API shading model.

Enumerator
ILB_CC_DIFFUSE 

Contains the visible color or texture of the surface.

ILB_CC_SPECULAR 

Contains the color of the specular highlights reflected by the surface.

ILB_CC_EMISSIVE 

Contains the color of the light emitted by the surface, if any.

ILB_CC_TRANSPARENCY 

Determines the color of the light that can pass through the surface.

ILB_CC_SHININESS 

Determines how smooth the surface will appear. Larger values produce smaller, more intense specular highlights.

ILB_CC_REFLECTION 

Determines how reflective the surface is.

ILB_CC_NONDIRECTIONAL 

Contains the color of the ambient or non-directional light that should be applied to the surface. Used only by the RNM render pass.

ILB_CC_NORMAL 

Normal map containing high frequency detail of the surface.

Enumerator
ILB_WM_REPEAT 

Clamps to the border value outside the 0..1 UV range.

ILB_WM_MIRROR 

Mirrors around the border outside the 0..1 UV range. U=1.1 becomes 0.9.

ILB_WM_CLAMP 

Repeats around the border value outside the 0..1 UV range. U=1.1 becomes 0.1

Function Documentation

ILBStatus ILBCreateShader ( ILBManagerHandle  beastManager,
ILBConstString  uniqueName,
ILBConstString  fileName,
ILBShaderHandle target 
)

Compiles and creates a representation of an OSL shader.

Parameters
beastManagerthe Beast Manager
uniqueNamea unique name for the shader
fileNamethe path to the OSL source file
targetpointer where the newly created shader will be stored
+ Examples:
ILBStatus ILBFindMaterial ( ILBSceneHandle  scene,
ILBConstString  name,
ILBMaterialHandle material 
)

Checks if the material exists, if it does, it returns its handle.

Parameters
scenethe scene the material is a part of
namethe name of the material
materiala pointer to the material handle to store the result in
Returns
ILB_ST_SUCCESS if the material was found, ILB_ST_UNKNOWN_OBJECT if it wasn't
ILBStatus ILBFindShader ( ILBManagerHandle  beastManager,
ILBConstString  uniqueName,
ILBShaderHandle target 
)

Retrieves an OSL shader based on its unique name.

Parameters
beastManagerthe Beast Manager
uniqueNamethe unique name of the shader to retrieve
targetpointer where the shader will be stored
ILBStatus ILBSetAlphaAsTransparency ( ILBMaterialHandle  material,
ILBBool  alphaAsTransparency 
)

Sets if the material should use the alpha value of the diffuse channel as transparency.

This is disabled by default.

Parameters
materialthe material to change the setting on
alphaAsTransparencythe new setting
+ Examples:
ILBStatus ILBSetChannelUVLayer ( ILBMaterialHandle  material,
ILBMaterialChannel  channel,
ILBConstString  uvLayerName 
)

Sets what UV layer should be used for the texture for a color channel.

Parameters
materialthe material to change texture channel for
channelthe channel to set the texture on
uvLayerNamethe name of the UV layer on the mesh to use. This parameter can not be checked at call time and if the UV layer is not present it will fall back on default
+ Examples:
ILBStatus ILBSetGIScale ( ILBMaterialHandle  material,
float  diffuseBoost,
float  emissiveScale,
float  specularScale 
)

Sets boost and scaling factors for different aspects of the material in GI calculations.

Default values are all 1.0.

Parameters
materialthe material to change the setting on
diffuseBoostthe value to boost the diffuse value with in GI calculations
emissiveScalethe value to scale the emissive value with in GI calculations
specularScalethe value to scale the specular value with in GI calculations
ILBStatus ILBSetMaterialDisplayName ( ILBMaterialHandle  material,
ILBConstString  displayName 
)

Sets the display name for the material.

This name does not have to be unique within the scene and can be used by tools to give human understandable names to objects that has names that are generated and for some reason isn't suitable to read

Parameters
materialthe material to set the name for
displayNamethe display name to set
ILBStatus ILBSetMaterialScale ( ILBMaterialHandle  material,
ILBMaterialChannel  channel,
float  scale 
)

Sets a scale for a channel on a material Will be multiplied with material color, texture and vertex colors if specified on the channel Can also be used to set the shininess of the material.

The default value of the scale is 1.0f.

Parameters
materialthe material to apply the color on
channelthe channel to set the color on
scalethe scale to set
+ Examples:
ILBStatus ILBSetMaterialTexture ( ILBMaterialHandle  material,
ILBMaterialChannel  channel,
ILBTextureHandle  texture 
)

Sets the texture for a channel on a material.

Will be multiplied with material color, scale and vertex colors if specified on the channel

Parameters
materialthe material to apply the texture on
channelthe channel to set the texture on.
texturethe texture to apply
+ Examples:
ILBStatus ILBSetMaterialTextureWrapMode ( ILBMaterialHandle  material,
ILBMaterialChannel  channel,
ILBMaterialChannelWrapMode  wrapModeU,
ILBMaterialChannelWrapMode  wrapModeV,
ILBTextureHandle  texture 
)

Sets the texture wrap mode for a channel on a material.

U and V can be wrapped independently.

Parameters
materialthe material to apply the texture on
channelthe channel to set the texture on.
wrapModeUthe wrap to apply for the U coordinate
wrapModeVthe wrap to apply for the V coordinate
ILBStatus ILBSetMaterialUseVertexColors ( ILBMaterialHandle  material,
ILBMaterialChannel  channel 
)

Sets the material to use vertex color for a channel.

Will be multiplied with material color, scale and texture if specified on the channel

Parameters
materialthe material to apply vertex colors on
channelthe channel to set the vertex colors on support multiple vertex color sets
+ Examples:
ILBStatus ILBSetPrimaryGICorrection ( ILBMaterialHandle  material,
float  intensity,
float  saturation 
)

Sets color correction on the primary GI calculations on the material.

Default values are 1.0 for intensity and 1.0 for saturation.

Parameters
materialthe material to change the setting on
intensitythe desired primary GI intensity
saturationthe desired primary GI saturation
ILBStatus ILBSetSecondaryGICorrection ( ILBMaterialHandle  material,
float  intensity,
float  saturation 
)

Sets color correction on the secondary GI calculations on the material.

Default values are 1.0 for intensity and 1.0 for saturation.

Parameters
materialthe material to change the setting on
intensitythe desired secondary GI intensity
saturationthe desired secondary GI saturation
ILBStatus ILBSetShader ( ILBMaterialHandle  material,
ILBShaderHandle  shader 
)

Assigns an OSL shader to a material.

The material must be created in a physical scene.

Parameters
materialthe material to assign the shader to
shaderthe shader to assign
+ Examples:
ILBStatus ILBSetShaderParamColor ( ILBMaterialHandle  material,
ILBConstString  param,
ILBLinearRGB value 
)

Sets an OSL color input parameter for a material.

Parameters
materialthe material to set the parameter on
paramthe parameter name
valuethe value to set for the parameter
+ Examples:
ILBStatus ILBSetShaderParamFloat ( ILBMaterialHandle  material,
ILBConstString  param,
float  value 
)

Sets an OSL float input parameter for a material.

Parameters
materialthe material to set the parameter on
paramthe parameter name
valuethe value to set for the parameter
ILBStatus ILBSetShaderParamInt ( ILBMaterialHandle  material,
ILBConstString  param,
int32  value 
)

Sets an OSL integer input parameter for a material.

Parameters
materialthe material to set the parameter on
paramthe parameter name
valuethe value to set for the parameter
+ Examples:
ILBStatus ILBSetShaderParamTexture ( ILBMaterialHandle  material,
ILBConstString  param,
ILBTextureHandle  value 
)

Sets an OSL texture input parameter for a material.

Parameters
materialthe material to set the parameter on
paramthe parameter name
valuethe value to set for the parameter
+ Examples:
ILBStatus ILBSetShaderParamUV ( ILBMaterialHandle  material,
ILBConstString  param,
ILBConstString  value 
)

Connects an UV set to an OSL UV input parameter for a material.

The parameter is declared like this in OSL: "vector uvset = vector(0.0,0.0,0.0) [[int lockgeom=0]]". Note that the lockgeom=0 must be set in order for OSL to eval the parameter every shading call.

Parameters
materialthe material to set the parameter on
paramthe parameter name
valuethe UV set to connect to the parameter
+ Examples:

Go to the source code of this file.