-
Notifications
You must be signed in to change notification settings - Fork 3
Lens file
PBRT Version 3
- JSON files need more documentation
- Methods we used to convert from the prior lens.dat format to the more extensive JSON format
- New OMNI lens methods as per Michael Mara (lenstool in the Docker container)
- Parameters for lens decentering and related transformations (build examples)
- Aspherical lens parameters
- Microlens examples and piCameraInsertMicrolens
- Critical scripts that help understand the microlens calculations are: t_piMicrolens, t_piIntro_microlens
- Main function: piCameraInsertMicrolens
- Docker command: docker run lenstool insertmicrolens ....
There are a number of microlens parameters that can be set by placing them in the Camera struct of ISET3D. We haven't figured out how to get them all there or whether they work. But we think based on this code in src/cameras/omni.h, we should be able to specify these parameters:
OmniCamera(const AnimatedTransform &CameraToWorld, Float shutterOpen,
Float shutterClose, Float apertureDiameter, Float filmdistance,
Float focusDistance, bool simpleWeighting, bool noWeighting,
bool caFlag, const std::vector<OmniCamera::LensElementInterface> &lensData,
const std::vector<OmniCamera::LensElementInterface> µlensData,
Vector2i microlensDims, const std::vector<Vector2f> & microlensOffsets,
float microlensSensorOffset, int microlensSimulationRadius, Film *film, const Medium *medium);
The most important one and recent change is microlensSensorOffset. That used to be specified in lenstool insertmicrolens. Now it should get specified in the omni camera definition (somehow).
Related isetlens and iset3d functions:
piCameraInsertMicrolens.
Lenstool has various options including insertmicrolens. The parameters for the insertmicrolens option are:
--xdim <n> How many microlenses span the X direction. Default: 16
--ydim <n> How many microlenses span the Y direction. Default: 16
--filmwidth <n> Width of target film in mm. Default: 20.0
--filmheight <n> Height of target film in mm. Default: 20.0
--filmtolens <n> Distance from film to back of main lens system (in mm). Default: 50.0
Remove the stuff below after a while.
- PBRT V2 described here.
- For the future (V3) the focal length line will be deleted. It is not really needed.
Lens files are stored in a text format that is used by PBRT V2. By convention the text file extension is '.dat'. A number of lens files are stored in piRootPath/data/lens. An example of a very simple lens file is
# 2 Element simple lens
# Focal length (in mm)
50
# radius (mm) axpos N aperture
67 1.5 1.65 25
0 1.5 1.65 25
-67 0 1 25
A leading "#" is a comment and won't be read by the parser.
The first number (50) is the effective focal length of the lens (mm).
The next comment line defines the four lens parameters.
Each row defines four parameters for each surface or aperture in the multi-element lens. The radius of curvature (the reciprocal of the curvature), the axis position, the index of refraction (N) and the lens aperture.
The first row defines the surface closest to the scene; the last row is the surface closest to the sensor (film).
-
A positive radius means the element is curved toward the sensor while a negative one means its curved toward the scene. Note that his is a convention chosen by us, and the convention used in other lens files might be different, so definitely double check. Units are millimeters.
-
The second value, labeled "axpos" is also known as the "thickness" in Zemax in millimeters. It's the distance between the current surface and the one to its right (toward the sensor). This distance is measured along the optical axis. The total lens thickness is the sum of this column. The thickness for the 11th surface is 0, because there's nothing to the right of it. The distance between the last lens element and the sensor is specified as the "filmDistance" parameter in pbrt-v2-spectral.
-
The third value, labeled "N" is the index of refraction of the material to the right of the current surface. Note that the 11th surface has a index of refraction N = 1, since we assume the medium between the lens and the sensor is air. By default we assume the medium to the left of the first element is also N = 1.
-
The fourth value, "aperture", is called "clear semi-diameter" in Zemax. It's essentially the vertical size of the surface; how tall or short it is in millimeters.
Here is a picture of a more complex lens, a double-gaussian lens that contains 11 surfaces. In this example, the 6th surface is actually the aperture.
One last thing to note is the lens aperture is also treated as a surface. It's the 6th element in this lens. It's identified by it's radius of 0 and it has an index of refraction of 0 (we assume the material to the right of the aperture is the same as the one to the left of it.)
Right now we assume that the surface are a spherical elements. Aspherical elements are theoretically possible but would require some significant changes to PBRT, including changing the lens file format to include x/y curvatures and x/y conic constants. It would also require changing the calculations for how we trace rays through lens system. This might require a new type of camera class altogether.