envtools
envtools copied to clipboard
Utilities to manipulate spherical images
Environment Mapping Tools
Copyright © 2012–2013 — Robert Kooima
The environment mapping tools are a set of command line utilities that operate upon spherical images in TIFF form. These operations including remapping between common spherical projections and generating diffuse irradiance maps from specular environment maps.
- envremap.c
- envtoirr.c
The following header files provide the ICC profiles needed for well-formed floating-point TIFFs.
- gray.h
- sRGB.h
Spherical Remapping
This code supports reprojection and resampling between any two of the following spherical image projections. A high-resolution example image of each type is included.
| The rect type corresponds to the equirectangular projection, much like the common map of the world. It represents the full sphere, though with significant distortion near the poles. (Example.) | |
| The ball type corresponds to a photograph of a mirrored sphere, or "light probe". It represents the full sphere, but with significant distortion toward the back. (Example.) | |
| The dome type gives a "dome master". This is an image suitable for projection onto a fulldome planetarium. The view looks up and the radius varies linearly with latitude. It represents only half of the sphere. (Example.) | |
| The hemi type is mathematically identical to the dome type, though the view faces forward instead of up. This corresponds to a photograph taken with an 8mm "fisheye" lens. This too represents only half of the sphere. (Example.) | |
| The cube type corresponds to an OpenGL cube map texture, and is the best choice for use in real-time 3D rendering. The TIFF contains each of the six cube faces in a separate page. The cube faithfully represents the full sphere with minimal distortion. (Example.) |
The output is sampled using one of several sampling patterns, which give a quality-speed tradeoff.
![]() | cent … One sample at the centroid of the output pixel |
![]() | rgss … Rotated-grid super sampling |
![]() | box2 … 2 × 2 super sampling |
![]() | box3 … 3 × 3 super sampling |
![]() | box4 … 4 × 4 super sampling |
This tool remaps the input image src.tif to the output dst.tif. The sample depth and format of the input TIFF is preserved in the output.
envremap [-i input] [-o output] [-p pattern] [-f filter] [-n n] src.tif dst.tif
-
-i inputInput projection type. May be
ball,cube,dome,hemi, orrect. The default isrect. -
-o outputOutput projection type. May be
ball,cube,dome,hemi, orrect. The default isrect. -
-p patternOutput sampling pattern. May be
cent,rgss,box2,box3, orbox4. The default isrgss. -
-f filterInput filter type. Maybe
nearestorlinear. The default islinear. -
-n nOutput size. Image will have size
n×n, exceptrectwhich will have size 2n×n.
Irradiance Generation
This tool generates an irradiance environment map from a given environment map using the method of Ramamoorthi and Hanrahan's An Efficient Representation for Irradiance Environment Maps. The input must be a 32-bit floating point TIFF image in cube map format with six pages.
envtoirr [-n n] [-f src.tif] [-ges] dst.tif
-
-n nOutput size. The output will be a 32-bit floating point TIFF with six pages, each
n×nin size. -
-f src.tifInput TIFF file.
-
-g
-e
-sForego loading an input file and instead generate an irradiance map using one of the parameter sets from Ramamoorth and Hanrahan. Options are
-gGrace Cathedral,-eEucalyptus Grove, orsSt. Peter's Basilica.




