Fred's ImageMagick Scripts
My scripts are available free of charge for non-commercial use. If you redistribute or incorporate any of these scripts into other free applications, you may use my scripts by simply referencing my name and this web page: Fred Weinhaus and http://www.fmwconcepts.com/imagemagick/index.html For use of my scripts in commercial use or non-free applications, please contact me for
licensing arrangements. Usage, whether stated in script or not, is also subject to the ImageMagick license, which can be found at: http://www.imagemagick.org/script/license.php |
|
Creates a colored sphere with a combination of diffuse and specular illumination. |
last modified: May 06, 2010
|
USAGE: sphere [-d diameter] [-c color] [-b bgcolor] [-t theta] [-p phi] [-l lambertian] [-s specular] [-e exponent] [infile] soutfile
-d .... diameter ......... desired diameter of sphere; integer>0; default=128; PURPOSE: To create a colored sphere with a combination of diffuse and specular illumination. DESCRIPTION: SPHERE creates a colored sphere with a combination of diffuse and specular illumination. Lighting is from a white light source. The diffuse term is computed from the Lambertian shading model. The specular term is computed from the Blinn-Phong approximation. ARGUMENTS: -d diameter ... DIAMETER of the sphere. Also controls the width and height of the output image. Values are integers>0. The default=128
-c color ... COLOR is the desired color for the sphere. The default=red.
Any valid IM color is allowed.
-b bgcolor ... BGCOLOR is the background color around the outside of the
sphere. The default=black. Any valid IM color is allowed. -t theta ... THETA is the white light azimuth angle measured counter clockwise from the positive x axis. Values are floats between 0 and 360 degrees. The default=135, which means the light is coming from the northwest. -p phi ... PHI is the white light altitude angle measure downward from zenith (vertical) towards horizontal. Values are floats between 0 and 180 degrees. A value of zero means the light is from above the sphere. The default=50. -l lambertian ... LAMBERTIAN is the amplitude of the diffuse lighting. Values are in the range 0<=float<=1. The default=0.9 -s specular ... SPECULAR is the amplitude of the specular lighting. Values are in the range 0<=float<=1. The default=0.6. A value of zero means not to compute the specular component. -e exponent ... EXPONENT is the specular exponent, which controls the area of the reflective effect. Larger values means smaller areas. Values are floats>0. The default=70. NOTE: If infile is provided, then it will be used in place of the color. The infile must be square and the diameter will obtained from the dimensions of the image. REQUIRMENTS: IM 6.5.4-3 or higher due to the use of -compose mathematics.
THEORY: See the following:
http://en.wikipedia.org/wiki/Lambertian_reflectance NOTE: This script may be a little slow due to the use in part of -fx. CAVEAT: No guarantee that this script will work on all platforms, nor that trapping of inconsistent parameters is complete and foolproof. Use At Your Own Risk. |
|
Lambertian vs Lambertian Plus Specular |
|
|
Lambertian |
Lambertian & Specular |
|
|
|
Variation On Specular Size |
||
|
Arguments: |
Arguments: |
Arguments: |
|
|
|
|
Variation On Specular Intensity |
||
|
Arguments: |
Arguments: |
Arguments: |
|
|
|
|
Variation On Background Color |
||
|
Arguments: |
Arguments: |
Arguments: |
|
|
|