Solid Color

To make the most of the visualization capability of Mechanics Explorer, the Solid block provides two parameterizations that you can use to specify the graphic appearance of a solid: Simple and Advanced. The two parameterizations accept material color and opacity parameters as input. Light source parameters are fixed for all models. The table provides a comparison of the input parameters present in each graphic parameterization.

Graphic ParameterSimpleAdvanced
Diffuse Color
Ambient Color
Specular Color
Emissive Color
Opacity
Shininess

As an example, the figure shows two identical elliptical extrusions, one based on Simple and the other on Advanced graphic parameterizations. In both cases, the extrusion is completely opaque with a gray diffuse color. The advanced version adds to the solid a set of blue highlights, through the use of specular color, and a red ambient hue, through the use of ambient color.

Color ParameterSimpleAdvanced
Diffuse Color[0.8 0.8 0.8][0.8 0.8 0.8 1.0]
Ambient Color[0.1 0.05 0.05 1.0]
Specular Color[0 0 1.0 1.0]

The material colors — diffuse, ambient, specular, and emissive — form the core of the graphical representation of a solid in SimMechanics™. You can specify the material colors in terms of RGB or RGBA color vectors.

Basic Graphic Parameters

Both Simple and Advanced graphic parameterizations require you to specify the diffuse color and opacity of the solid. Together, these two parameters represent the graphical core of a SimMechanics solid. The way in which you specify the parameters differs slightly between the two parameterizations, but the meaning of each parameter remains the same.

Diffuse Color

Apparent color of a rough solid surface exposed to direct white light. Diffuse light scatters equally in all directions according to Lambert's law, causing the intensity and color of the scattered light to appear the same from all angles. The diffuse color normally provides the dominant contribution to the color of a solid surface. In most cases, you can think of the diffuse color as the "true color" of a solid surface.

ParameterizationParameter Name UsedSpecification
SimpleColor[R G B] vector
AdvancedDiffuse Color[R G B A] vector

The figure shows the effect of varying the diffuse color of a solid. The array of spheres have identical graphical properties, with the exception of Diffuse Color. The RGBA color vector of the diffuse color progresses from [1 1 1], at the left corner, to [0.85 0.45 0], at the right corner. A gray ambient color gives the solid a darker appearance.

Opacity

The opacity is the degree to which a solid blocks light from passing through. A completely opaque solid blocks all light penetration through the solid. The opposite of a completely opaque solid is a transparent solid, which allows all light to pass through. You can reduce the opacity of a solid in order to improve the visibility of other solids otherwise blocked from view.

ParameterizationParameter Name UsedSpecification
SimpleOpacityScalar number (0–1)
AdvancedA element of Diffuse Color [R G B A] vectorScalar number (0–1)

The figure shows the effect of varying the opacity of a solid. The array of spheres have identical graphical properties, with the exception of Opacity. The opacity value progresses from 0.1, at the left corner, to 1, at the right corner. An opacity value of 0 represents a completely transparent, or invisible, solid. An opacity value of 1 represents a completely opaque solid.

Advanced Graphic Parameters

In addition to the diffuse color and opacity, the Advanced parameterization provides a set of colors that enhance the 3–D graphical appearance of the solid. The additional colors include specular, ambient, and emissive colors, each of which includes an opacity (A) element in the [R G B A] color vector. You can omit the fourth element in the RGBA vector, in which case the color uses a maximum opacity value of 1.

Specular Color

The specular color is the apparent color of the glossy highlights arising from a solid surface exposed to direct light. The size of the specular highlights depends on the value of the Shininess parameter. The intensity of the specular color is not uniform in space, and has a strong dependence on the viewing angle. Changing the specular color changes only the color of the specular highlights. For most applications, the [R G B A] vector [0.5 0.5 0.5 1] works well.

The figure shows the effect of varying the specular color of a solid. The array of spheres have identical graphical properties, with the exception of Specular Color. The RGBA color vector of the specular color progresses from [1 1 1 1], at the left corner, to [1 0 0 1], at the right corner. A gray ambient color gives the solid a darker appearance.

Ambient Color

The ambient color is the apparent color of a solid surface exposed only to indirect light. Changing the ambient color changes the overall color of the entire solid surface. For most applications, the RGBA vector [0.15 0.15 0.15 1] works well.

The figure shows the effect of varying the ambient color of a solid. The array of spheres have identical graphical properties, with the exception of the Ambient Color. The RGBA color vector of the ambient color progresses from [1 1 1 1], at the left corner, to [1 0 0 1], at the right corner. A gray ambient color gives the solid in the left corner a darker appearance.

Emissive Color

The emissive color is the apparent color of light emitted directly by the solid surface. Examples of solids with a nonzero emissive color include glowing hot metal, light displays, and the Sun. For most applications, the RGBA vector [0 0 0 1] works well.

The figure shows the effect of varying the emissive color of a solid. The array of spheres have identical graphical properties, with the exception of the Emissive Color. The RGBA color vector of the emissive color progresses from [1 1 1 1], at the left corner, to [1 0 0 1], at the right corner. A gray ambient color gives the solid in the left corner a darker appearance. The glowing appearance of the emissive color differentiates the emissive color from ambient and diffuse colors.

Shininess

The shininess is a parameter that encodes the size and rate of decay of specular highlights on a solid surface. A small shininess value corresponds to a large specular highlight with gradual falloff in highlight intensity. On the other hand, a large shininess value corresponds to a small specular highlight with sharp falloff in highlight intensity.

The figure shows the effect of varying the shininess of a solid. The array of spheres have identical graphical properties, with the exception of Shininess. The shininess value progresses from 5, at the left corner, to 25, at the right corner. As the shininess value increases, the area of the specular highlight decreases, while the falloff rate in highlight intensity increases.

Was this topic helpful?