Main Content

Manipulate the Color of a Solid

Visual Property Parameterizations

The solid blocks provides two parameterizations, Simple and Advanced, that you can use to specify solid visual properties. The Simple parameterization provides control over the solid color and opacity. The Advanced parameterization adds control over highlight, shadow, and self-illumination colors. You can use the Advanced visual properties to model emissive solids such as the sun and glossy solids such as polished metal parts.

You select a visual-property parameterization through the Graphic > Visual Properties block parameter. The figure contrasts the two parameterizations. On the left is a solid with Simple visual properties. On the right is the same solid with Advanced visual properties—including Specular Color and Shininess parameters, which impart to the solid a slight metallic sheen.

Try It

Set the visual-property parameterization of a solid to Advanced:

  1. Add a Spherical Solid block to a new model canvas. The block provides its own visualization pane. You can use this pane to visualize the solid even if the model is not topologically valid. In later examples, the curved spherical surface makes the specular highlights and ambient shadows easier to see.

  2. In the Spherical Solid block dialog box, set the Graphic > Visual Properties parameter to Advanced. You set the visual-property parameterization individually for each solid.

RGB and RGBA Vectors

You can specify colors directly as [R,G,B] and [R,G,B,A] vectors on a normalized scale of 0–1. The R, G, and B elements provide the red, green, and blue contents of the specified color. The A element provides the color opacity—the degree to which the solid obstructs other components located behind it. Omitting the A element is equivalent to setting its value to 1.

Try It

Identify the color and opacity given by the [R,G,B,A] vectors below:

  • [0,0,1,1] — Denotes a solid color with no red or blue contents, maximum green content, and maximum opacity. The solid is bright green and fully opaque.

  • [1,0,0,0.5] — Denotes a solid color with maximum red content, no green or blue contents, and partial opacity. The solid is bright red and transparent.

Simple Visual Properties

The Simple parameterization enables you to set the solid color and opacity. You can select a color using an interactive color picker or specify a color as an [R,G,B] vector. The Color parameter in the Simple parameterization is the same as the Diffuse Color parameter in the Advanced parameterization.

See It

See the parameters that comprise the Simple parameterization:

  1. In the Spherical Solid block dialog box, set the Visual Properties parameter to Simple. This setting is the parameter default.

  2. Expand the Visual Properties node. Color and Opacity appear as the active visual property parameters.

Advanced Visual Properties

The Advanced parameterization adds control over the highlight, shadow, and self-illumination colors as well as the size of the highlight areas. You must specify the colors directly as [R,G,B,A] vectors. The optional A element serves the same purpose as the Opacity parameter in the Simple parameterization.

See It

See the parameters that comprise the Advanced parameterization:

  1. In the Spherical Solid block dialog box, set the Visual Properties parameter to Advanced.

  2. Expand the Visual Properties node. The solid colors and shininess appear as the active visual property parameters.

Adjust Solid Opacity

You can make a solid transparent using either parameterization. If using the Simple parameterization, set the Opacity parameter to a value less than one. If using the Advanced parameterization, set the optional fourth element of the Diffuse Color [R,G,B,A] vector to a value less than one.

Try It

Model a transparent red solid using the Advanced visual-property parameterization:

  1. Under the Graphic > Visual Properties node, change the Diffuse Color parameter to [1,0,0,0.5].

  2. In the visualization pane, click the button to refresh the solid visualization.

    Delete the fourth vector element in the Diffuse Color parameter or set its value to 1 in order to make the solid opaque again.

Adjust Highlight Color

You can control the size and color of specular highlights by adjusting the Shininess and Specular Color parameters in the Advanced visual-property parameterization. Lower the shininess value for large but soft highlights. Increase its value for small but sharp highlights.

Try It

Give the specular highlights a bright green hue. Set the Diffuse Color vector to [1,0,0,1] in order to make the solid opaque. Then:

  1. In the Graphic > Visual Properties node, lower the Shininess parameter to 10. This value increases the highlight size, making the specular color easier to see.

  2. Change the Specular Color parameter to [0,1,0,1]. This vector sets the highlight color to bright green.

  3. In the visualization pane, click the button to refresh the solid visualization. The specular color combines with the diffuse color to give highlight areas a green hue.

Adjust Shadow Color

You can control the color of shadow areas by adjusting the Ambient Color parameter in the Advanced visual-property parameterization.

Try It

Give the shadow areas a slight blue hue:

  1. In the Graphic > Visual Properties node, set the Ambient Color parameter to [0.15,0.15,0.3]. This vector sets the shadow color to dark blue.

  2. In the visualization pane, click the button to refresh the solid visualization. The ambient color combines with the diffuse color to give shadow areas a blue hue.

Adjust Self-Illumination Color

You can model self-illuminating solids such as the sun by adjusting the Emissive Color parameter in the Advanced visual-property parameterization.

Try It

Give the solid surface a red emissive color:

  1. Under the Graphic > Visual Properties node, change the Emissive Color parameter to [1,0,0,1].

  2. In the visualization pane, click the button to refresh the solid visualization.

Related Topics