DGtalTools  0.9.4
heightfield2shading

Renders a 2D heightfield image into a shading image.

You can choose between lambertian model (diffuse reflectance) and specular model (Nayar reflectance model). You can also choose between a single directional light source (using -l{x,y,z} options) or use light source which emits in all direction (by specifying the light source position with -p{x,y,z} option). Another rendering mode is given from a bitmap reflectance map which represents the rendering for a normal vector value (mapped according the x/y coordinates).

Usage: heightfield2shading [input] [output]

Allowed options are:

-h [ --help ] display this message
-i [ --input ] arg heightfield file.
-o [ --output ] arg output image.
--importNormal arg import normals from file.
-s [ --specularModel ] arg use specular Nayar model with 3 param Kdiff,
Kspec, sigma .
--lx arg x light source direction.
--ly arg y light source direction.
--lz arg z light source direction.
--px arg x light source position.
--py arg y light source position.
--pz arg z light source position.
-r [ --reflectanceMap ] arg specify a image as reflectance map.

Example:

$ heightfield2shading -i ${DGtal}/examples/samples/bunnyHeightField.pgm -o shading.pgm --lx 0.0 --ly 1.0 --lz 1.0 --importNormal ${DGtal}/examples/samples/bunnyHeightField_normals.sdp -s 0.2 0.8

You will obtain such image:

resHeightfield2shading.png
Resulting image with a 90° ccw rotation
See also
heightfield2shading.cpp