Skip to main content

Cam::setDofMaxNearInFocusDistanceBlendLevel

Client-side function

JavaScript​

This function sets the blend level for the maximum near focus distance in the camera's depth of field (DOF) settings, providing smoother transitions for objects near the camera. Adjusting this parameter allows you to refine the near-focus blur effect, useful in creating a cinematic depth of field look.

Required Params​

  • camera: number — The camera handle.
  • p1: number — Blend level for near focus; typical range is from 0 to 1.

Return value​

  • void

Syntax​

mp.game.cam.setDofMaxNearInFocusDistanceBlendLevel(camera, p1);

Example​

// Create a new camera and set DOF blend level for near focus
const camera = mp.cameras.new("default", new mp.Vector3(0, 0, 10), new mp.Vector3(0, 0, 0), 40);
camera.setActive(true);
mp.game.cam.setDofMaxNearInFocusDistanceBlendLevel(camera.handle, 0.5); // Set blend level to 0.5 for smooth near-focus transition
mp.game.cam.renderScriptCams(true, false, 0, true, false);