Houdini 20.5 Nodes VOP nodes

Karma Physical Lens VOP node

A pre-made lens shader implementation with controls for most common lens shader effects, such as bokeh, chromatic aberrations, and tilt/shift.

On this page
Since 18.5

Overview

This is an “uber lens shader” for the Karma renderer, provided so you can easily add common camera effects without having to implement your own lens shader.

How to

To...Do this

Set up a Physical Lens node

  1. In a LOP network (such as /stage), set up the camera you want to render from.

  2. Next to the camera, create a Material Network node.

  3. Dive inside the Material Network and create a Karma Physical Lens node.

    Use the parameters on the Physical Lens node to set up effects.

  4. Go back up and select the camera node. Click the Karma tab.

    • Set the drop-down menu next to Use lens shader to “Set or create”, then turn on Use lens shader.

    • Set the drop-down menu next to Lens shader VOP to “Set or create”, then click the chooser icon next to the text field and use the chooser window to find and select the Physical Lens node you created.

  5. If you switch the scene viewer to look through the camera using Karma, it should render the scene using the Physical Lens shader you configured.

Rolling shutter

Rolling shutter is an effect of consumer-grade digital camera sensors. Unlike chemical film which is exposed “all at once”, in some digital sensors the controlling circuitry scans across the image (vertically or horizontally) very rapidly. This means different parts of the image are not captured at the exact same instant, which can cause distortion (such as wobble and skew) when capturing extremely fast or extremely brief subjects.

You can use the controls on the Shutter tab to simulate this effect (for example, to match existing digitally captured footage).

About time offset and time scale

The Time offset and Time scale parameters may be hard to understand.

  • In a lens shader, “time” is a value representing the current point in the shutter time (from 0.0, shutter opening, to 1.0, shutter closed).

  • Time offset is the base time, so if you have a time offset value of 0.5 and a time scale of 0, the image will have no motion blur as it will just display the state of all objects half way through the shutter period.

  • Time scale is how much randomness (blurriness) is added to the Time offset. In camera terms, time scale is how long the sensor is exposed to light.

  • You can use time offset to determine when in the shutter period the virtual camera sensor starts imaging, and time scale to determine how long it images for.

  • In terms of a rolling shutter, the time offset is the position of the gap in the shutter, and the time scale is the size of the gap.

Parameters

Bokeh

Circular bokeh, with rotation and anisotropy
Polygon bokeh with 5 sides
Butterfly texture map bokeh

Bokeh Shape

A choice for what shape the bokeh should be: Circular, Polygonal (see Number of sides), or Texture Map (see Bokeh texture map).

Bokeh Texture Map

When Bokeh shape is “Texture map”, this is the path to the texture to use. The texture should contain a bright bokeh shape on a black background.

(The shader samples the texture based on its intensity using importance_remap, shaping the bokeh to the bright parts of the texture).

Number of Sides

When Bokeh shape is “Polygonal”, this is the number of sides the bokeh shape has. This value must be greater than 3.

Bokeh Rotation

Rotate the bokeh shape by this number of degrees.

Anisotropy

This is a value from -1.0 to 1.0 which controls the aspect ratio of the bokeh shape. Set this to 0 to get square (equal height and width) shapes. Negative fractions make the bokeh shape narrower than it is tall. Positive fractions make the bokeh shape shorter than it is wide.

Anisotropy Texture Map

A texture map to control anisotropy (see the Anisotropy parameter above) for each pixel. In the texture image, black represents -1.0 and white represents 1.0.

Lens Distortion

Curvature
Chromatic Aberration
Cubic curvature of -0.2
Quadratic curvature of -0.625
Quadratic curvature of 0.8
Amount of Aberration: 0.05
Amount of Aberration: 0.15
Amount of Aberration: 0.3

Projection

Change the projection type of the lense.

Perspective creates a default view of the world in front of the camera. This type can capture the depth of different objects. Orthographic creates a view of the world in front of the camera. This type can`t capture the depth of the different objects. Polar creates a 3-dimensional panoramic view around the camera. You can use the result in a dome-shaped world, for example a sky. Cylindrical creates a 3-dimensional panoramic view similar to the Polar view. Here the shape, that is used to enclose the camera, is a cylinder instead of a sphere. Polar Stereographic projection is used if preserving the shape of small object on image plane is required. Polar Equidistant projection is used if preserving angular sizes of object on image plane is required. Polar Equisolid projection is used if preserving constant ration of solid angles in object and image spaces is required. Polar Orthographic projection is used if evenness of illumination through the entire image plane is required.

Type of Curvature

A type of curvature to distort the lens with: “None”, “Quadratic”, “Cubic”, or “Texture Map”.

Curvature Texture Map

When Curvature type is “Texture map”, this is a path to the texture map. Values in the texture image represent the unit “height” of the lens (distance from flat) at a given position across the face of the lens. Black represents -1.0 and white represents 1.0.

Lens Curvature

When Curvature type is not “None”, this is the amount of curvature to apply, from -1.0 to 1.0.

Chromatic Aberration

The amount of chromatic aberration to add to the lens.

This value plus one represents the index of refraction applied to blue light. The shader then linearly maps this value down to an index of refraction of 1.0 for red light. For example, a value of 0.2 means the index of refraction is 1.2 for blue light and 1.0 for red light, with a linear gradient in between.

For more control over the mapping use the Aberration ramp.

Aberration Ramp

This ramp controls the mapping of aberrations between blue and red light. The left edge of the ramp represents blue light and the right edge represents red light. The vertical axis represents the index of refraction and goes from 1.0 at the bottom to 1.0 + the value of Chromatic Aberration at the top.

Tint and Exposure

Tint color: 1,0,0.5
Tint Texture Map
Exposure: 1, Vignetting: 5

Tint

Adds a color tint to the output. You can use numbers greater than 1.0 to (unrealistically) brighten the image.

Tint Texture Map

Effectively multiplies this texture map over the output image.

Exposure

An exponential scale for the brightness of the image.

Intensity

A linear scale for the brightness of the image.

Vignetting

An amount to darken the image around the edges. Because this is physically based, it is relative to the camera’s field of view. Alternatively, you can use the Tint texture map to get full control over darkening parts of the image.

Tilt and Shift

Tilt X

The number of degrees to tilt the plane of focus by in the X direction (around the camera’s Y axis).

Tilt Y

The number of degrees to tilt the plane of focus by in the Y direction (around the camera’s X axis).

Shift X

The distance (in Houdini world units) to shift the lens in the X direction.

Shift Y

The distance (in Houdini world units) to shift the lens in the Y direction.

Focus Mapping

F-Stop Texture Map

The path to a texture map that specifies the f-stop value at each pixel. In the texture image, black represents F-stop near and white represents F-stop far.

F-Stop Near

The lower bound of the F-stop texture map.

F-Stop Far

The upper bound of the F-stop texture map.

Focus Texture Map

The path to a texture map that specifies the focus distance at each pixel. In the texture image, black represents Focus near and white represents Focus far.

Focus Near

The lower bound of the Focus Texture Map.

Focus Far

The upper bound of the Focus Texture Map.

OpenCV

Radial distortion and tangential distortion are the two major forms of distortion. Radial distortion is calculated as shown below:

x d i s t o r t e d = x ( 1 + k 1 r 2 + k 2 r 4 + k 3 r 6 ) y d i s t o r t e d = y ( 1 + k 1 r 2 + k 2 r 4 + k 3 r 6 )

Tangential distortion follows this rule:

x d i s t o r t e d = x + [ 2 p 1 x y + p 2 ( r 2 + 2 x 2 ) ] y d i s t o r t e d = y + [ p 1 ( r 2 + 2 y 2 ) + 2 p 2 x y ]

To describe the amount of distortion you need to find at least five distortion parameters k and p:

D i s t o r t i o n c o e f f i c i e n t s = ( k 1 k 2 p 1 p 2 k 3 )

There are also the intrinsic and extrinsic parameters of the camera. Intrinsic parameters are specific to a camera. They include information like focal length f and optical centers c. Both are used to create a camera matrix to remove distortion due to the lenses of a specific camera. The camera matrix is unique to a specific camera, so once calculated, it can be reused on other images taken by the same camera. It is expressed as a 3×3 matrix:

c a m e r a m a t r i x = [ f x 0 c x 0 f y c y 0 0 1 ]

Extrinsic parameters correspond to rotation and translation vectors.

Enable OpenCV Distortion

Turn this on to use an the OpenCV defined intrinsic camera parameters for lens distortion.

Refer to OpenCV documentation for more details on each of the constants in the intrinsic camera parameters.

k1

The k1 radial distortion constant in the intrinsic camera parameters defined by OpenCV.

Positive values will produce a barrel distortion, and negative values will produce a pincushion distortion.

k2

The k2 radial distortion constant in the intrinsic camera parameters defined by OpenCV.

Positive values will produce a barrel distortion, and negative values will produce a pincushion distortion.

k3

The k3 radial distortion constant in the intrinsic camera parameters defined by OpenCV.

Positive values will produce a barrel distortion, and negative values will produce a pincushion distortion.

k4

The k4 radial distortion constant in the intrinsic camera parameters defined by OpenCV.

Negative values will produce a barrel distortion, and positive values will produce a pincushion distortion.

k5

The k5 radial distortion constant in the intrinsic camera parameters defined by OpenCV.

Negative values will produce a barrel distortion, and positive values will produce a pincushion distortion.

k6

The k6 radial distortion constant in the intrinsic camera parameters defined by OpenCV.

Negative values will produce a barrel distortion, and positive values will produce a pincushion distortion.

p1

The p1 tangential distortion constant in the intrinsic camera parameters defined by OpenCV.

Positive values will give the effect that the top of the image plane is farther away than the bottom, and negative values will do the opposite.

p2

The p2 tangential distortion constant in the intrinsic camera parameters defined by OpenCV.

Positive values will give the effect that the right side of the image plane is farther away than the left side, and negative values will do the opposite.

Shutter

Rolling Shutter Direction

A choice for how to simulate rolling shutter: “None”, “Bottom First”, “Top First”, “Left First”, “Right First”, or “Custom” (see Time offset curve below).

Time Offset Ramp Rotation

When Rolling shutter is “Custom”, the direction of the shutter movement, in degrees. A value of 0 represents straight up (positive Y in camera space).

Time Offset Ramp

When Rolling shutter is “Custom”, this ramp to control the progression of the shutter across the image. See understanding time offset and scale above. The horizontal axis represents shutter time, the vertical axis represents shutter progress, where the bottom is the start position and the top is the end position. So, the default ramp (a line from bottom left to top right) represents a linear progression across the image.

Time Offset Texture Map

Path to a texture map file to control the time offset. See understanding time offset and scale above.

Time Scale

A base scale on the shutter time. Basically, this affects how blurry the image is, however see understanding time offset and scale above for more information. For rolling shutter effects time scale must be quite small, otherwise the rolling shutter will not be visible.

Time Scale Texture Map

Path to a texture map file to control the time offset. See understanding time offset and scale above.

Use Shutter Curve

Turn this on to get custom control over the amount of light allowed into the camera aperture across the shutter time.

Shutter Curve

When Use shutter ramp is on, the ramp represents the weighting of a time sample based on it’s position in the shutter period. In terms of a camera, this ramp represents how much light gets through to the sensor (vertical axis) at a given moment across the the shutter time (horizontal axis). The default distribution is uniform.

See also

VOP nodes