Using a physical camera

After you set up a Kanzi Studio project to use Physical Camera Plugin, you can create a Physical Camera node that simulates a real camera.

To use a physical camera:

  1. In the Node Tree, delete the Viewport 2D node and from the Prefabs drag the Physical Camera Effects prefab to the RootPage node.

    _images/node-tree-physical-camera-effects.png
  2. In the Physical Camera Effects > Scene, create content. In the Preview, use the Camera tool camera-tool to adjust the position of the camera.

    For example, create content that you want to show in the foreground and background, and light the scene

    _images/node-tree-scene.png
  3. (Optional) Motion blur effect.

    To create the motion blur effect, a material type must use velocity buffer. The Physical Camera Plugin asset package contains a material type that supports velocity buffer.

    For the motion blur effect, the Physical Camera Plugin has the Draw Objects With Motion Blur Render Pass that sets the PreviousProjectionCameraWorldMatrix property. You use this property to compute the motion vector between the previous and current frames.

    By default, the Physical Camera Render Pass expects motion vectors to be written to Composition Target 1.

    If you use a standard Kanzi smart physically-based material type, in the Library, drag the materials to the SmartPhysicallyBasedWithVelocityBuffer material type from the Physical Camera Plugin asset package.

    _images/update-materials-1.png _images/update-materials-2.png
  4. In the Node Tree, select the Physical Camera node and adjust the properties:

    • To adjust the camera, set the properties in the Physical Camera category:

      _images/physical-camera-properties.png

      Property

      Description

      Focus Distance

      Sets the distance to the focus plane.

      • Focus on the near object (3.5m)

        _images/focus-distance-near.png
      • Focus on the far object (100m)

        _images/focus-distance-far.png

      Focal Length

      Sets the distance between the sensor and the camera lens. This distance determines the field of view. Higher values make field of view narrower and depth of field shallower.

      • 25mm focal length

        _images/focal-length-25mm.png
      • 70mm focal length

        _images/focal-length-70mm.png

      Exposure Value

      Sets the image brightness in stops.

      • 0 EV

        _images/exposure-0.png
      • +1 EV

        _images/exposure-1.png

      Aperture F Number

      Sets the depth of field. The f-number affects the aperture size that is defined as focal length divided by the f-number. Lower values make the depth of field shallower.

      To make it easier to adjust the depth of field and exposure independently, the f-number does not affect the exposure.

      • f/1.4

        _images/aperture-f1.4.png
      • f/4

        _images/aperture-f4.png

      Sensor Size

      Sets the size of the sensor that captures the image. Sensor size determines the field of view and physical camera aspect ratio.

      • 36mm x 24mm

        _images/sensor-size-big.png
      • 24mm x 16mm

        _images/sensor-size-small.png

      Gate Fit

      Defines the behavior when the screen and the physical camera sensor use different aspect ratios.

      • Horizontal sensor hight has no effect on resulting image.

        _images/gate-fit-horizontal.png
      • Vertical sensor width has no effect on resulting image.

        _images/gate-fit-vertical.png
      • Fill fits the screen to the smaller axis of the sensor, and crops the rest of the camera image.

      • Overscan fits the screen to the larger axis of the sensor, and overscans the area outside of boundaries of the sensor.

      Tip

      To visualize the physical camera frustum and sensor size, in the Preview use the Analyze mode and enable the preview for the Debug objects.

      _images/preview-analyze-debug-objects.png

      Shutter Angle

      Sets the angle of the rotary shutter in degrees. Larger values give a stronger motion blur effect.

      • 0° Shutter angle

        _images/shutter-angle-0.png
      • 90° Shutter angle

        _images/shutter-angle-90.png
      • 180° Shutter angle

        _images/shutter-angle-180.png
    • To control the performance and quality of the visual effects, set the properties in the Performance and Quality category:

      _images/physical-camera-performance-and-quality.png

      Property

      Description

      Maximum DoF Blur Radius

      Limits the performance cost of depth of field by limiting the maximum blur radius in pixels. The performance cost of maximum blur is

      \[r^2\]

      Motion Blur Samples

      The quality of the motion blur as samples. More samples produce higher quality motion blur.

      DoF Sampling Step

      Controls the trade-off of sampling density and artifacts. Values close to 1 produce good quality. Values higher than 1.5 have better performance, but can have visible artifacts.

      Randomize DoF Sampling Angle

      Depending on the hardware randomizing sampling angle and the use of the high-sampling step, this property can improve performance with the trade-off that it adds noise. Disabling this property is a safe default.