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:
Positionals:
1 TEXT:FILE REQUIRED input heightfield file (2D image).
2 TEXT output image.
Options:
-h,--help Print this help message and exit
-i,--input TEXT:FILE REQUIRED input heightfield file (2D image).
-o,--output TEXT output image.
--importNormal TEXT import normals from file.
--lightDir,--lDir,--ld FLOAT x 3 light source direction: lx ly lz.
--lightPos,--lPos,--lp FLOAT x 3 light source position: px py pz.
-s,--specularModel FLOAT x 3 use specular Nayar model with 3 param Kdiff, Kspec, sigma.
-r,--reflectanceMap TEXT:FILE specify a image as reflectance map.
Example:
$ heightfield2shading ${
DGtal}/examples/samples/bunnyHeightField.pgm shading.pgm --lDir 0.0 1.0 1.0 --importNormal ${
DGtal}/examples/samples/bunnyHeightField_normals.sdp -s 1.0 0.2 0.8
You will obtain such image:
Resulting image with a 90° ccw rotation
- See also
- heightfield2shading.cpp