Scene configuration files define the complete 3D environment setup for each scenario in your application. Each scenario (e.g., customer-service, wellness-center, ...) has its own SceneConfig.js
file that controls the space, lighting, camera positions, and avatar placement.
Scene settings are defined in the SceneConfig.js
file located at /src/components/[scenario]/3d/SceneConfig.js
.
export const SceneConfig = { scenario: "customer-service", setupManager: true, // ... };
scenario
→ unique key identifying the scenariosetupManager
→ enables interactive setup panel for fine-tuning positionsWe will discuss each section of the configuration in detail below.
The space settings define the 3D environment model and its visual properties. The configuration includes the model file, background gradient settings, and spatial transformations.
spaceSettings: { spaceFile: "/models/customer-service/office.glb", // Path to your 3D environment model (Optional) translation: { position: [0.25, 0, -3.5], // [x, y, z] position in 3D space rotation: [0, 0, 0], // [x, y, z] rotation in radians scale: 0.8 // Uniform scale factor }, screens: [ // Optional: Define interactive screens in the space { name: "Screen1", // Name of the material in the GLB model url: "/images/customer-service/logo.png", // URL of the image to display type: "image" // Type of content (currently only "image" supported) } ], backgroundSettings: { // Gradient background for simple good-looking backdrop (Optional) colorBottom: "#47210a", // Bottom gradient color colorTop: "#ebebeb", // Top gradient color colorMiddle: "#d6975a", // Middle gradient color for transition blendMiddle: 0.1, // Middle color blend position (0-1) blendIntensity: 0.37 // Overall gradient intensity } }
You can adjust the space position, rotation, and scale to perfectly align your 3D environment:
[x, y, z]
[x, y, z]
in radiansEnable setupManager in SceneConfig.js
to use the interactive UI controls for fine-tuning and choose Space
in Item to Edit
:
Use the UI controls to copy/paste space transformation values
Use the getTranslation
button to copy space transformation values and paste them into your SceneConfig.js
Lighting in your 3D scene is controlled through a dedicated <Lights />
component.
Each scenario has its own lighting component at /src/components/[scenario]/3d/Lights.jsx
where you can define and customize:
Example implementation:
// /components/customer-service/3d/Lights.jsx export function Lights() { return ( <> <ambientLight intensity={0.5} /> <directionalLight position={[10, 10, 5]} intensity={1} /> <pointLight position={[0, 2, 0]} intensity={0.5} color="white" /> </> ); }
Camera settings control the viewport and user perspective. The system supports multiple camera positions for different UI states and responsive layouts.
cameraSettings: { fov: 60, // Field of view in degrees smoothTime: 0.5, // Camera transition smoothing time idleCamWander: { // Optional: Subtle camera movement when idle enabled: true, intensity: { x: 0.1, // Horizontal wander intensity y: 0.05 // Vertical wander intensity }, speed: { x: 0.4, // Horizontal wander speed y: 0.2 // Vertical wander speed } }, positions: { ["default"]: { // Default layout positions [CameraPosition.LOADING]: { position: [x, y, z], // Camera position target: [x, y, z] // Camera look-at target }, [CameraPosition.DEFAULT]: { /* ... */ }, [CameraPosition.ZOOM_IN]: { /* ... */ }, [CameraPosition.ZOOM_OUT]: { /* ... */ } }, ["expanded"]: { // Expanded layout positions // Alternative camera positions for different UI states } } }
The system supports multiple predefined camera positions:
Each camera position requires:
[x, y, z]
coordinates where the camera is located[x, y, z]
coordinates where the camera looks atTo find the perfect values, enable setupManager in SceneConfig.js
and use the mouse and your keyboard to navigate the 3D scene:
Controls:
W
: Move forwardS
: Move backwardA
: Move leftD
: Move rightQ
: Move downE
: Move upOnce you have the desired view, use the getCameraPosition
button in the Camera section of the setup panel. This will copy the current camera position and target to your clipboard, which you can then paste into your SceneConfig.js
.
Avatar positioning controls where your 3D character appears in the scene and how they orient relative to the camera.
avatarSettings: { translations: { ["default"]: { position: [-0.02, 0, -0.975], // [x, y, z] position rotation: [0, 0, 0], // [x, y, z] rotation in radians scale: [1, 1, 1] // [x, y, z] scale factors } }, lookAtCameraOffset: { x: 0, // Horizontal offset for head tracking y: 0, // Vertical offset for head tracking z: 0 // Depth offset for head tracking } }
Position: Places the avatar in 3D space [x, y, z]
Rotation: Orients the avatar [x, y, z]
in radians
Scale: Adjusts avatar size [x, y, z]
[1.2, 1.2, 1.2]
) to maintain proportionsWhen setupManager is enabled in SceneConfig.js
, you can use the UI controls to adjust avatar position interactively. Choose Avatar
in Item to Edit
:
Use the getTranslation
button to copy/paste avatar transformation values
The lookAtCameraOffset
fine-tunes how the avatar's head tracks the camera:
Remember that you have complete control over the 3D experience and can fine-tune every aspect:
Multiple Layouts: Define different camera and avatar positions for various UI states (default, expanded, session, etc.)
Responsive Design: Use different position sets for different screen sizes or interaction modes
Dynamic Updates: All values can be updated programmatically during runtime for interactive experiences
Testing Values: Use the UI controls to experiment with values in real-time, then copy the perfect configuration to your SceneConfig file
Scene Variants: Each scenario can have completely different spatial configurations, allowing unique experiences for different use cases
For developers who want to go beyond configuration and customize the default behavior, here are the key files you can modify:
/components/[scenario]/3d/SceneConfig.js
: Main configuration file for each scenario. Feel free to add custom properties as needed./store/constants.js
: Global constants for camera positions and animation states/components/[scenario]/3d/Lights.jsx
: Custom lighting setup for each scenario/components/[scenario]/3d/Scene.jsx
: Main 3D scene component handling rendering/components/[scenario]/3d/Experience.jsx
: Core 3D experience logic and interactions/components/core/3d/avatar/Avatar.jsx
: Base avatar component and loading logic/components/core/3d/avatar/Animations.jsx
: Animation system and blending logic/components/core/3d/CameraManager.jsx
: Camera state and position management/components/core/3d/space/Space.jsx
: 3D environment loading and setup/components/core/3d/space/Background.jsx
: Gradient background implementation