An application for Mac to compute Spherical Harmonics from pictures.
Tweet
Harmonikr
A tool to compute the spherical harmonics of an environment map. Features:- Support for HDR images, both for import and export.
- Compute any arbitrary number of harmonics.
- Compute irradiance.
- Store harmonics or irradiance as a 2D map, for fast sampling in a custom shader.
- Import side-cross cubemaps, or individual faces, and export side-cross cubemaps.
- Import equirectangular maps.
- Rotate cubemaps.
- Save project files, containing images and settings per project.
Usage
Main window
When you start a new project, you will see a new window with these elements (from top to bottom):- A toolbar
- A Sphere Map, which is a 2D map representing the spherical harmonics, and a cubemap next to it.
- A place to drag & drop images at the middle, in the shape of a side-cross cubemap.
- An area at the bottom where you can either see the list of spherical harmonics, or the settings of your project.
Importing images
To create a new environment map, drag images to the central area, which represents a cubemap: -X, +Z, +X, -Z, for the central row, and +Y, and -Y for the top and bottom, respectively. See visual guide below:- Set 6 pictures, one per face. They will just be interpreted as the 6 faces of a cubemap. The resulting cubemap is shown at the top of the project and the faces are displayed in this order: +X, -X, +Y, -Y, -Z, +Z. See screenshot above.
- Set 4 pictures (top, bottom, 1st and 3rd from the middle row). The pictures at the central row will be stretched.
- Set just one picture, at the left-most image well (labelled -X above). The image will be interpreted as an equirectangular map. See example at the top of this document. But if you also place an image at -Y, the ground of the environment map will be replaced with the face you pasted there.
Compute spherical harmonics
Once you have a cubemap, click on Compute to compute the Spherical Harmonics coefficients for the given cubemap. Notice how the Sphere Map next to the cubemap changes when done. You can compute the Irradiance once you have computed the Spherical Harmonics. Just click on the Irradiance button. The Sphere Map will be updated again. You can export the Sphere Map as a PNG image file, or as an HDR file for 32-bit output precision.Save project
You can also save the project to an .spharm file. The file contains all the images you pasted, and the settings you may have configured.Settings
Through the Settings tab you can:- increase/decrease the number of bands/coefficients for the Spherical Harmonics,
- increase/decrease the number of samples (jittered stratification over a sphere) used when computing them,
- set the area used to represent the positive hemisphere in the Sphere Map. The center of the Sphere Map is the positive hemisphere, whereas the rest represent the negative side. This parameter is the radius of the positive size.
- increase/decrease the resolution of the Sphere Map,
- increase/decrease the resolution of the cubemap,
- change the color precision of the environment map: LDR (8 bits per channel), HDR16 (16 bits per channel, integer), HDR32 (32 bits per channel, float; for .hdr images);
- apply a global scale to the values (in linear RGB),
- rotate the cubemap along the vertical axis (Y). See below an example illustrating the result of rotating a cubemap.