This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
sample_geometry [2018/01/24 16:56] 185.62.108.185 |
sample_geometry [2018/01/24 18:19] (current) 89.103.122.186 |
||
---|---|---|---|
Line 63: | Line 63: | ||
{{ :objects.png?400 |}} | {{ :objects.png?400 |}} | ||
+ | |||
+ | As the voxel based mesh features the staircasing effect, we need to handle the surface normal calculation carefully, while evaluating interaction of the ray with the object. Use of some particular method is chosen in the main parameter file, using e.g. this command | ||
<code> | <code> | ||
INTERFACE_METHOD | INTERFACE_METHOD | ||
- | integer | + | 3 |
</code> | </code> | ||
- | - sets the surface/interface normal calculation method, 0 - simple weighing, 1 - RS, 2 - gradient based, 3 - minimal (single voxel). Simple weighting gives slightly wrong angles and should not be used, RS method provides local plane fitting, gradient method is an approximate method using gradient of material within the sample, minimal method only looks to adjacent voxels and therefore can only produce normals of individual voxel faces. All the averaging based methods may fail at large angles hitting edges of objects (where real staircased object normal is too much different from averaged one); if it fails algorithm automatically uses the minimal method for the particular reflection/transmission. Default value is 2. | + | which sets the crudest method significantly affected by staircasing. |
+ | |||
+ | There are different surface normal evaluation methods implemented: if we use 0 as the above command parameter, simple weighting of the pixel neighbourhood is used. Regime 1 means something more advanced, however again based on weighting of the amount of material around the pixel where we do the evaluation. Regime 2 is most resistant to staircasing, being based on pre-calculation of local neighbourhood gradient and then using this information as shown in the figure below. Finally, regime 3 means only local evaluation, searching for adjacent voxels and should be used only for rectangular objects. | ||
+ | |||
+ | If the gradient based control method is used, it can be controlled further by local averaging area selection, using e.g. this directive: | ||
+ | <code> | ||
+ | AVERAGE | ||
+ | 3 | ||
+ | </code> | ||
+ | |||
+ | The provided value is typically in range of 2-5, the higher value the smoother the object boundaries are. However, too much of smoothing can also remove some fine details. Note that gradient based method is precomputing the data at the calculation start, this can affect the computation time. | ||
+ | |||
+ | {{ :normals.png?400 |}} | ||