Galacean Engine Documentation

repository·main·Indexed 26 days ago

https://github.com/galacean/engine

A high-performance, real-time interactive engine for web (HTML5) and WeChat minigames. It features a component-based architecture for 2D/3D graphics, animation, physics, and UI. The ecosystem includes specialized packages such as @galacean/engine-math, @galacean/engine-shaderlab, @galacean/engine-ui, and physics implementations via @galacean/engine-physics-lite and @galacean/engine-physics-physx, as well as WebXR support through @galacean/engine-xr-webxr.

Tokens
136.3K
Snippets
251
Records
919
Agent score
91%

What's inside Galacean Engine

  1. Overview of Spine 2D Skeletal Animation in Galacean

    main

    Spine is a 2D skeletal animation system supported by Galacean. Instead of frame-by-frame imagery, it uses bone-based animation data, which provides several advantages for game development:

    • Smaller file sizes: Stores bone animation data rather than full image sequences.
    • Reduced art requirements: Requires fewer assets compared to traditional animation.
    • Smoothness: Uses interpolation for smooth playback between frames.
    • Attachment slots: Allows swapping equipment (weapons, accessories) or character appearances by binding images to bones.
    • Animation blending: Supports playing multiple animations simultaneously (e.g., walking while shooting).
    • Programmatic control: Bones can be manipulated via code for dynamic effects like aiming at a cursor or adjusting posture.
  2. Overview of the Scene Editing Page

    main

    The Scene Editing Page is the primary workspace for building scenes. The interface is divided into several functional panels:

    • Sidebar: Main menu, panel switches, and personalization settings.
    • Hierarchy Panel: Displays all nodes within the current scene.
    • Assets Panel: Displays all project assets (HDR maps, models, textures, scripts, fonts, etc.).
    • Inspector Panel: Shows editing options and properties for the currently selected object.
    • Main Editing Area (Viewport): The central area for scene manipulation using mouse and keyboard.
    • Toolbar: Quick operations like switching Gizmo modes, scene views, and camera configurations.
    • Camera Preview Area: A small viewport at the top left of the main area to preview the scene from the selected camera's perspective.
    • Animation Clip Editing: Interface for editing specific AnimationClip assets.
    • Animation Controller Editor: Interface for editing AnimatorController assets.
  3. Overview of 3D Models in Galacean

    main

    In Galacean, a Model is considered an asset that typically consists of a collection of:

    • Meshes
    • Materials
    • Textures
    • Animations

    The standard workflow involves exporting a model from 3D modeling software, importing it into the Galacean editor, and then adjusting it within the engine environment.

  4. Overview of the Galacean Editor Home Page

    main

    The Galacean Editor Home page provides the entry point for managing your development workflow. Key areas include:

    • Create Project: Start a new 3D or 2D project.
    • Projects: View and manage your existing projects; double-click a project to open it.
    • Sidebar: Access business templates, documentation, and the editor discussion area.
  5. Overview of Texture Types in Galacean

    main

    Galacean supports standard WebGL textures which can be sourced from images, canvas, raw data, or videos. Use the appropriate texture type based on your rendering needs:

    • 2D Texture: The standard artistic resource sampled using 2D UV coordinates.
    • Cube Texture: Composed of 6 2D textures; used for skyboxes and environmental reflections.
    • 2D Texture Array: Occupies a single texture unit; ideal for implementing texture atlas switching.
  6. Overview of the Galacean UI System

    main

    The Galacean UI system is used to build interactive user interfaces. It provides tools for visual editing, rendering, and event handling. Key capabilities include:

    • Visual Editing: Use the Galacean Editor with the RectTool (shortcut T) for intuitive interface development.
    • Rendering: Supports components like Image and Text.
    • Interactivity: Supports components like Button and provides event bubbling for UI interactions.
    • Attribute Inheritance: Use the UIGroup component to manage how properties like opacity and interactivity are inherited or ignored by child elements.
  7. Overview of Galacean Engine Audio System

    main
    Galacean Engine provides a comprehensive audio system designed for immersive gaming experiences. The system allows developers to import standard audio formats and attach audio functionality to Entities. It supports playing sounds in 3D space, which is useful for both background music and localized sound effects.
  8. Introduction to ShaderLab

    main
    ShaderLab is Galacean's proprietary declarative shader description language. It is designed to organize all components of a shader—including material properties, UI configuration, rendering states, and actual shader code—into a single modular structure. This solves common issues like code duplication between vertex/fragment shaders, manual script assembly for multiple passes, and the difficulty of reflecting properties in editors.
  9. Overview of Galacean Engine components

    main

    Galacean Engine is a web-first, mobile-first interactive solution consisting of two main parts:

    1. Editor: An online web interactive creation platform (Galacean Editor) used to create, edit, and export interactive projects by managing assets, materials, lighting, and entities.
    2. Runtime: A high-performance interactive runtime (@galacean/runtime) for executing projects in the browser, supplemented by the Toolkit for business logic customization and various ecosystem packages.
  10. Overview of Renderer types in Galacean

    main

    The Renderer is a component responsible for displaying graphics in a 3D scene. Depending on your needs, you can use different built-in renderer types:

    • Mesh Renderer: Renders 3D objects using mesh and material.
    • Skinned Mesh Renderer: Extends the Mesh Renderer with support for skeletal animation and Blend Shape.
    • Sprite Renderer: Displays 2D images using sprite and material.
    • Sprite Mask Renderer: Implements masking effects for sprite renderers.
    • Text Renderer: Displays text in the scene.
    • Particle Renderer: Displays particle effects.
  11. WebXR device compatibility overview

    main

    Galacean Engine's XR system currently only officially supports the WebXR standard. Compatibility is determined by the device's support for WebXR:

    • PC: Supported via browsers like Chrome. You can use the Immersive Web Emulator for simulation.
    • Android: Supported via mobile Chrome. Requires Google Play Services for AR to be installed.
    • iOS: Safari on iPhone does not support WebXR. However, Apple Vision Pro does support WebXR.
    • HMDs: Most Chromium-based HMD browsers support WebXR.
  12. Understand AnimatorController components

    main

    The AnimatorController organizes animation playback logic for characters or objects using a flowchart-like structure. It consists of two main components:

    • AnimatorControllerLayer: Manages AnimatorStateMachine instances. Multiple layers can run simultaneously on an Animator component, achieving animation blending via different weights and blending modes.
    • AnimatorControllerParameter: Used to control state transitions within an AnimatorStateMachine. When the values of these parameters meet the conditions of an AnimatorStateTransition, the engine automatically switches to the target AnimatorState and plays the associated AnimationClips.