Drawings SDK Developer Guide > Working with .dwg Files > Working with Databases > Working with Database Containers > Working with Dictionaries of Objects > Working with Specific Dictionaries > Visual Style Dictionary > Face-related Properties
Face-related Properties

Lighting model property

The kFaceLightingModel property provides the ability to disable faces visualization (Invisible value), fill faces using constant color (Constant value), or choose one of the complex lighting models (Phong or Gooch values).

Phong is a classic photorealistic lighting model. Gooch is a non-photorealistic lighting model, which provides more geometric information of the same richness as human-drawn technical illustrations. Images below show how a drawing is changed according to value of the kFaceLightingModel property.

Invisible

Constant

Phong

Gooch

To change the face's lighting model the setTrait() method can be used. For example,


pVStyle->setTrait(OdGiVisualStyleProperties::kFaceLightingModel, (OdInt32)OdGiVisualStyleProperties::kGooch);

Lighting quality property

The kFaceLightingQuality property can be set in one of the following values:

  • Per-face lighting. In this mode lighting will be calculated separately for each face. This mode is helpful to review models structure.
    
    pVStyle->setTrait(OdGiVisualStyleProperties::kFaceLightingQuality, (OdInt32)OdGiVisualStyleProperties::kPerFaceLighting);
    

  • Per-vertex lighting provides smoother results, since lighting calculated separately for each primitive vertex.
    
    pVStyle->setTrait(OdGiVisualStyleProperties::kFaceLightingQuality, (OdInt32)OdGiVisualStyleProperties::kPerVertexLighting);
    

  • Per-pixel lighting is the most precis. In this mode lighting calculated separately for each pixel, so a result image contains more lighting details. This details is the most visible onto large planar surfaces.
    
    pVStyle->setTrait(OdGiVisualStyleProperties::kFaceLightingQuality, (OdInt32)OdGiVisualStyleProperties::kPerPixelLighting);
    

Color mode property

The kFaceColorMode property allows to choose which color modification will be applied to final faces.

  • kObjectColor mode instructs visualizer to use original object colors for its faces.
    
    pVStyle->setTrait(OdGiVisualStyleProperties::kFaceColorMode, (OdInt32)OdGiVisualStyleProperties::kObjectColor);
    

  • kBackgroundColor mode instructs visualizer to use a background color for faces filling.
    
    pVStyle->setTrait(OdGiVisualStyleProperties::kFaceColorMode, (OdInt32)OdGiVisualStyleProperties::kBackgroundColor);
    

  • kMono color mode allows to choose which color will be used for faces filling. For choosing a color, use the kFaceMonoColor property.
    
    pVStyle->setTrait(OdGiVisualStyleProperties::kFaceColorMode, (OdInt32)OdGiVisualStyleProperties::kMono);
    // Set a color
    OdCmColor cmColor(OdCmEntityColor::kByColor);
    cmColor.setRGB(0, 255, 0);
    pVStyle->setTrait(OdGiVisualStyleProperties::kFaceMonoColor, &cmColor);
    

  • kTint color mode changes hue and saturation values of face colors using a specified reference color. The reference color is set by the kFaceMonoColor property.
    
    pVStyle->setTrait(OdGiVisualStyleProperties::kFaceColorMode, (OdInt32)OdGiVisualStyleProperties::kTint);
    // Set a face tint color
    OdCmColor tintColor(OdCmEntityColor::kByColor);
    tintColor.setRGB(255, 255, 165);
    pVStyle->setTrait(OdGiVisualStyleProperties::kFaceMonoColor, &tintColor);
    

  • kDesaturate color mode softens a color by reducing its saturation component by 30 percent.
    
    pVStyle->setTrait(OdGiVisualStyleProperties::kFaceColorMode, (OdInt32)OdGiVisualStyleProperties::kDesaturate);
    

Opacity override

Opacity override can be helpful to review details of large geometry models, where front objects overlay back objects. To show the changes of the kFaceOpacity property, the kFaceOpacity flag should be set in the kFaceModifiers property.


bool faceOpacityFlag = pVStyle->traitFlag(OdGiVisualStyleProperties::kFaceModifiers, OdGiVisualStyleProperties::kFaceOpacityFlag);
if (!faceOpacityFlag)
  pVStyle->setTraitFlag(OdGiVisualStyleProperties::kFaceModifiers, OdGiVisualStyleProperties::kFaceOpacityFlag);
pVStyle->setTrait(OdGiVisualStyleProperties::kFaceOpacity, 0.5);

Specular override

The kFaceSpecular property is used to control the size of light glare on a shiny surface. Glare is a reflected light source, illuminating a surface. For a more realistic effect it is recommended to set a value of the kFaceSpecular property as small as possible. To show the changes of the kFaceSpecular property, the kSpecular flag should be set in the kFaceModifiers property.


bool faceSpecularFlag = pVStyle->traitFlag(OdGiVisualStyleProperties::kFaceModifiers, OdGiVisualStyleProperties::kSpecularFlag);
if (!faceSpecularFlag)
  pVStyle->setTraitFlag(OdGiVisualStyleProperties::kFaceModifiers, OdGiVisualStyleProperties::kSpecularFlag);
pVStyle->setTrait(OdGiVisualStyleProperties::kFaceSpecular, 3.0);

Copyright © 2002 – 2020. Open Design Alliance. All rights reserved.