Credits | Overview | Plotting Styles | Commands | Terminals
--- | --- | --- | --- | ---

## lighting

Syntax:

         set pm3d lighting {primary <frac>} {specular <frac>} {spec2 <frac>}
         set pm3d spotlight {rgb <color>} {rot_x <angle>} {rot_z <angle>}
                            {Phong <value>} {default}

By default the colors assigned to pm3d objects are not dependent on orientation or viewing angle. This state corresponds to set pm3d nolighting. The command set pm3d lighting selects a simple lighting model consisting of a single fixed source of illumination contributing 50% of the overall lighting. The strength of this light relative to the ambient illumination can be adjusted by set pm3d lighting primary <fraction>. Inclusion of specular highlighting can be adjusted by setting a fractional contribution:

         set pm3d lighting primary 0.50 specular 0.0   # no highlights
         set pm3d lighting primary 0.50 specular 0.6   # strong highlights

Solid-color pm3d surfaces tend to look very flat without specular highlights.

Since highlights the primary source only affect one side of the surface, it may help to add illumination from a second spotlight shining from another direction. The strength of this second spotlight is set by "spec2 <fraction>". The second spotlight is included in the lighting model only if spec2 is greater than zero. The direction, color, and specular model is controlled by "set pm3d spotlight". Use and positioning of this spotlight is illustrated in the interactive demo spotlight.dem. See also hidden_compare.dem (comparison of hidden3d and pm3d treatment of solid-color surfaces) Example:

         set pm3d lighting primary 0.8 spec 0.4 spec2 0.4
         set pm3d spot rgb "blue"