ShadingModel (OGLMaterial)
Description
Returns the shading model of this material as one of the values of the siShadingModel enum. It is usually not possible to exactly represent the mental ray shaders attached to a material in OpenGL. However, XSI tries to guess the best OpenGL shading model to approximate these shaders. XSI chooses a shading model based on specific markings on shader parameters provided by the shader developer (using the ui "mapping" = "guid" syntax in the SPDL). These markings tell XSI if a parameter can be interpreted as a diffuse color, a specular color, etc. Based on the presence or absence of these markings, XSI guesses a shading model. For example, if there is a diffuse, specular, and ambient-like parameter, XSI chooses the Phong shading model (which in OpenGL, is actually Gouraud). If only diffuse and ambient-like parameters are present, Lambert would be used instead (since the Lambert shading model does not have a specular color). If only ambient is present, Constant is used.
C# Syntax
// get accessor siShadingModel rtn = OGLMaterial.ShadingModel;
Examples
VBScript Example
dim grid, oglMat
set grid = ActiveProject.ActiveScene.Root.AddGeometry("Grid", "MeshSurface")
' First put a Phong shader on instead
ApplyShader "Phong", grid
set oglMat = grid.Material.OGLMaterial
Application.LogMessage "OGL material shading model: " & oglMat.ShadingModel
' Now put a Lambert shader on instead
ApplyShader "Lambert", grid
set oglMat = grid.Material.OGLMaterial
Application.LogMessage "OGL material shading model: " & oglMat.ShadingModel
' Finally, a constant shader
ApplyShader "Constant", grid
set oglMat = grid.Material.OGLMaterial
Application.LogMessage "OGL material shading model: " & oglMat.ShadingModel
SOFTIMAGE|XSI v6.01