For AI agents: the complete documentation index is available at /vue-vrm/llms.txt, the full documentation bundle is available at /vue-vrm/llms-full.txt, and this page is available as Markdown at /vue-vrm/guide/camera-and-lighting.md.

Camera & Lighting

Automatic framing

When a model is loaded, the camera distance is chosen so the whole model fits in the view. Call resetCamera() to return to this position after the user has moved the camera.

Camera props

PropDefaultEffect
camera-options{ fov: 30, near: 0.1, far: 100 }Field of view (degrees) and clipping planes. Omitted fields use the defaults.
camera-look-at[0, 0.9, 0]The point the camera looks at, in meters. Ignored while orbit controls are enabled.
camera-distancefitted to the modelDistance from the target. Overrides automatic framing.
camera-euler[0, 0, 0]Rotation around the target as Euler angles (X, Y, Z) in radians.
camera-offset[0, 0, 0]Moves the target (the center of the model) that the camera is placed around.

The camera is placed at camera-distance from the target, rotated by camera-euler. The target is the center of the model plus camera-offset. For example, to look at the face from slightly to the left:

<template>
  <VrmCanvas
    :model-data="modelData"
    :camera-offset="[0, 0.6, 0]"
    :camera-look-at="[0, 1.4, 0]"
    :camera-distance="1.2"
    :camera-euler="[0, -0.4, 0]"
  />
</template>

camera:change is emitted whenever the camera position or target changes, and camera:options-change when camera-options changes.

Orbit controls

Set camera-interaction to let users move the camera with the mouse or touch. It is off by default.

<script setup lang="ts">
  import { VrmCanvas, type CameraInteractionOptions } from 'vue-vrm';

  const interaction: CameraInteractionOptions = {
    enabled: true,
    roll: true,
    minDistance: 0.5,
    maxDistance: 20
  };
</script>

<template>
  <VrmCanvas :model-data="modelData" :camera-interaction="interaction" />
</template>
OptionDefaultEffect
enabled—Turns the controls on. Required.
rotatetrueRotate around the target by dragging.
pantruePan with the right mouse button or Ctrl + drag.
zoomtrueZoom with the mouse wheel or a pinch gesture.
rollfalseRoll the camera with the Q / E keys while the canvas has focus.
rotateSpeed1Rotation speed.
panSpeed1Pan speed.
zoomSpeed1Zoom speed.
dampingtrueSmooths the movement after the pointer is released.
dampingFactor0.08Strength of the damping.
minDistance0.1Closest allowed distance to the target.
maxDistanceInfinityFarthest allowed distance from the target.
rollSpeed0.03Roll per key press, in radians.
Tip

When roll is enabled, the canvas becomes focusable. Users click the canvas (or move focus to it with Tab) before pressing Q / E.

Lights

The scene has an ambient light and a directional light.

PropDefaultEffect
ambient-light{ color: '#ffffff', intensity: 0.5 }Light that reaches every surface equally.
directional-light{ color: '#ffffff', intensity: 1, position: [1, 1, 1] }Light from one direction, like sunlight.
<template>
  <VrmCanvas
    :model-data="modelData"
    :ambient-light="{ color: '#ffe8d0', intensity: 0.6 }"
    :directional-light="{ color: '#ffffff', intensity: 1.2, position: [-1, 2, 1] }"
  />
</template>

Changes are applied immediately and reported through light:ambient-change and light:directional-change.