Orillusion Web Engine

repository·master·Indexed 42 days ago

https://github.com/orillusion/orillusion-web

A web-based engine and platform utilizing WebGPU. It features a comprehensive GUI system with ViewSpace and WorldSpace rendering modes, a particle system via @orillusion/particle, physics simulations based on Ammo.js via @orillusion/physics, and multimedia support through @orillusion/media-extention. The engine includes tools for performance monitoring via @orillusion/stats and supports both NPM and CDN installation workflows.

Tokens
233.8K
Snippets
801
Records
1.2K
Agent score
54%

What's inside Orillusion

  1. Overview of the Ammo namespace

    master

    The Ammo namespace provides access to Ammo.js, which is a JavaScript port of the Bullet2 physics engine. It contains a comprehensive suite of classes for rigid body dynamics, soft body physics, collision detection, constraints, and raycasting.

    Key functional areas include:

    • Dynamics & Worlds: Managing physics simulations using btDynamicsWorld or btDiscreteDynamicsWorld.
    • Collision Shapes: Defining geometry for physical objects via classes like btBoxShape, btSphereShape, btCapsuleShape, and complex meshes like btBvhTriangleMeshShape.
    • Rigid Bodies: Creating physical entities with btRigidBody.
    • Constraints: Connecting bodies using btHingeConstraint, btSliderConstraint, btFixedConstraint, etc.
    • Raycasting: Performing intersection tests using RayResultCallback and related classes.
    • Soft Body Physics: Simulating deformable objects via btSoftBody and btSoftRigidDynamicsWorld.
  2. Use the UIImage class to display images, sprites, or videos

    master

    The UIImage class is a GUI component used to display visual media such as images, sprites, or videos within the Orillusion UI system. It inherits from UIRenderAble and can be used as a child of a UIPanel.

    const image = new UIImage();
    // Further configuration via properties and accessors
  3. Explore @orillusion/core API Reference

    master
    The @orillusion/core package provides the fundamental building blocks for 3D engine functionality, including animation, asset management, camera controllers, collision detection, components, entities, GFX (GPU buffers), GUI systems, geometry, input, lighting, and more. Use this index to navigate to specific technical details for any of these core systems.
  4. Explore @orillusion/core API Reference

    master

    The @orillusion/core package provides the fundamental building blocks for the 3D engine, including materials, math utilities, post-processing effects, and engine configuration. Use the following categories to navigate the API:

    • Material: Shaders and surface properties (e.g., ColorLitMaterial, GlassMaterial, UnLitMaterial).
    • Math: Linear algebra and animation tools (e.g., Vector3, Matrix4, Quaternion, AnimationCurve).
    • Post Effects: Visual enhancements applied after rendering (e.g., BloomPost, SSRPost, TAAPost).
    • Setting: Configuration types for various engine subsystems (e.g., LightSetting, ShadowSetting, BloomSetting).
    • Texture: Texture types and sky implementations (e.g., HDRTexture, BitmapTexture2D, AtmosphericScatteringSky).
    • engine3D: Core engine lifecycle and rendering management (e.g., Engine3D, ForwardRenderJob).
    • Plugin: Extensibility via Interpolator.
  5. Overview of Materials in Orillusion

    master

    In Orillusion, materials are applied to objects via the MeshRenderer component to simulate color, lighting, and texture properties. The engine provides two primary material models:

    1. UnLitMaterial: Does not calculate lighting or shadows; it only renders the raw color and texture information.
    2. LitMaterial: A Physically-Based Rendering (PBR) material designed to simulate realistic lighting effects.

    Note: Using glTF files is recommended, as they contain material information that the engine automatically parses and applies to objects.

  6. What is APatch and how does it work?

    master

    An APatch is a component used to attach specific functionality to an Object3D. It acts as a modular piece of logic that belongs to an owner Object3D.

    Key characteristics:

    • Ownership: Every APatch has an associated object3D owner.
    • Lifecycle: Components can receive update events at each frame (e.g., onUpdate, onLateUpdate).
    • Control: You can enable or disable a patch using the enable accessor. Enabled components receive updates, while disabled ones do not.
  7. What is ComponentBase and how to use it

    master

    In Orillusion, ComponentBase is the fundamental class used to attach functionality to an Object3D. Every component has an owner (an Object3D) to which it is attached. Components are lifecycle-aware and can receive update events at every frame, allowing you to implement custom logic like movement, animation, or physics that runs automatically within the engine's loop.

    Common specialized components that inherit from ComponentBase include:

    • Transform: Manages position, rotation, and scale.
    • AnimatorComponent: Handles animations.
    • ColliderComponent: Manages collision detection.
    • Camera3D: Defines camera behavior.
    • PostProcessingComponent: Manages visual effects.
  8. Overview of Orillusion Graphics Modules

    master

    Orillusion provides the @orillusion/graphic package for efficient real-time drawing of points, lines, planes, and volumes. It offers three main modules:

    1. Graphic3D: Provides basic line-drawing capabilities, useful for auxiliary lines and simple shapes.
    2. Graphic3DMesh Renderer: Creates a collection of cloned Mesh instances in a single renderer. It allows for high-performance batching where each clone can have its own Transform, Texture, and Material properties.
    3. Shape3D Renderer: Used for creating complex custom shapes like EllipseShape3D, RoundRectShape3D, and CircleShape3D. For continuous drawing shapes like Path2DShape3D or Path3DShape3D, the API follows the CanvasPath design, making it familiar to web developers.
  9. What is a Ghost Object and when to use it

    master

    A Ghost Object is a special collision object used for overlap detection (trigger zones) without physical reaction. Unlike a Rigidbody, a Ghost Object:

    • Does not react to forces (gravity, impacts).
    • Does not apply forces to other objects.
    • Is ideal for area detection or trigger zones.

    In Orillusion, you can use the GhostTrigger component to implement this behavior.

    import { GhostTrigger, CollisionShapeUtil } from "@orillusion/physics";
    
    let ghostTrigger = object.addComponent(GhostTrigger);
    ghostTrigger.shape = CollisionShapeUtil.createBoxShape(object);
    ghostTrigger.collisionEvent = (contactPoint, selfBody, otherBody) => {
        // Handle trigger/overlap event
    }
  10. Overview of Texture Types

    master

    Textures are essential resources in 3D rendering used to provide color values for fragments during shading. Orillusion supports several texture types:

    TypeDescription
    BitmapTexture2DThe most common resource; uses 2D UV coordinates for sampling.
    BitmapTextureCubeComposed of 6 2D textures; used for skyboxes and environmental reflections.
    LDRTextureCubeA panoramic sky map composed of 6 LDR textures.
    HDRTextureSampling texture that supports RGBE format.
    HDRTextureCubeA panoramic sky map composed of 6 HDR textures.