# Shape::CalculateNormals

### From Solid Graphics Wiki

The **Shape::CalculateNormals** method calculates shape normals. The normals can be later used to render the shape using DrawSmoothCAShadedShape, DrawFlatShadedShape or DrawSmoothShadedShape functions.

## Syntax

bool **Shape::CalculateNormals**( VectorList & *normals*, NormalMapping *normalMapping*, float *creaseAngle* ) const;

## Parameters

*normals*[out]

*normalMapping*[in]

*creaseAngle*[in]

*SKL3D::SmoothWithCreaseAngle*. It specifies the crease angle value in degrees to be used to determine whether smooth or flat shading normal should be calculated for a shape edge.

## Return Value

The function always returns *true*. The return value might be removed in future version of the SolidKit library.

## Remarks

SolidKit Library supports three types of NormalMapping.

*Flat*. For this type the*CalculateNormals*method calculates one normal vector per shape triangle. The*Flat*shading is best suited for shapes with all sharp edges, such as cubes.*Smooth*. For this type the*CalculateNormals*method calculates one normal vector per shape point. The*Smooth*shading is best suited for shapes without any sharp edges, such as spheres.*SmoothWithCreaseAngle*. For this type the*CalculateNormals*method calculates three normal vectors for each shape triangle. The*SmoothWithCreaseAngle*shading is best suited for shapes with both sharp edges and curved surfaces.__This type of shading is recommendeded to be used__since it gives good results for almost all shapes.

The implementation of *CalculateNormals* function for *Smooth* and *SmoothWithCreaseAngle* normal mapping is tradeoff between calculating good results and calculating them in reasonable time. It does not provide optimal results for all shapes. If more precise shading is needed then the *SolidKit Library* functions should not be used - a third party or custom-made code should be used instead.