Online normal creation

x3dom needs normal(s) per vertex to calculate the shading for lit surfaces. The system tries to create (and update) this normals if not given by the user. The normal-creation process can be controlled with a user-defined creaseAngle-value per element. The creaseAngle defines an angle (in radians) for determining whether adjacent polygons are drawn with sharp edges or smooth shading. If angle between normals of two adjacent polygons is less than "creaseAngle", smooth shading is rendered across the shared line segment.

The HTML-Profile only requires Geometry3D component support level 2. Therefore some systems (e.g. WebGL-backend) may only support 0.0 or 3.14

Performance Hint: Even so hard-edges look simpler they are harder to render, since we can not share the normals per vertex. This kills the vertex-cache.

Same DataSet with different normals generated.

Left: creaseAngle=0 means render all edges sharply. Right: creaseAngle=3.14 means render all edges smoothly