All Projects → actnwit → RhodoniteTS

actnwit / RhodoniteTS

Licence: MIT license
Rhodonite Web3D Library in TypeScript

Programming Languages

typescript
32286 projects
GLSL
2045 projects

Projects that are alternatives of or similar to RhodoniteTS

Three.js
JavaScript 3D Library.
Stars: ✭ 78,237 (+111667.14%)
Mutual labels:  webxr
spacesvr
A standardized reality for the future of the 3D Web.
Stars: ✭ 135 (+92.86%)
Mutual labels:  webxr
emscripten-webxr
WebXR library for use with Emscripten.
Stars: ✭ 21 (-70%)
Mutual labels:  webxr
Webview-unity-3d-2017.3-or-higher-
Webview unity 3d 2017.3 or higher - can be open website url on unity3d or open Html5, html and js on unity offline
Stars: ✭ 18 (-74.29%)
Mutual labels:  webxr
aframe-react
React library for A-frame
Stars: ✭ 58 (-17.14%)
Mutual labels:  webxr
MyOOS
MyOOS [Shop system] Repository
Stars: ✭ 26 (-62.86%)
Mutual labels:  webxr
Webxr Polyfill
Use the WebXR Device API today, providing fallbacks to native WebVR 1.1 and Cardboard
Stars: ✭ 251 (+258.57%)
Mutual labels:  webxr
ossos
Webbased Character Animation System
Stars: ✭ 158 (+125.71%)
Mutual labels:  webxr
VRStreaming
Unity Render Streaming SDK to stream VR from CloudXR to WebXR over WebRTC
Stars: ✭ 112 (+60%)
Mutual labels:  webxr
layers
A feature repo for working on multi-layer support in WebXR. Feature leads: Rik Cabanier and Artem Bolgar (Oculus)
Stars: ✭ 74 (+5.71%)
Mutual labels:  webxr
depth-sensing
Specification: https://immersive-web.github.io/depth-sensing/ Explainer: https://github.com/immersive-web/depth-sensing/blob/main/explainer.md
Stars: ✭ 47 (-32.86%)
Mutual labels:  webxr
a-game
Essential game components for A-Frame!
Stars: ✭ 30 (-57.14%)
Mutual labels:  webxr
apate-ar
Framwork for environment aware AR with occlusion, lighting PBR rendering, physics support (cannon.js), based on three.js
Stars: ✭ 77 (+10%)
Mutual labels:  webxr
awesome-webxr
All things WebXR.
Stars: ✭ 117 (+67.14%)
Mutual labels:  webxr
360WebPlayer
The easiest way to stream 360 videos and pictures on your website or blog.
Stars: ✭ 31 (-55.71%)
Mutual labels:  webxr
Model Viewer
Easily display interactive 3D models on the web and in AR!
Stars: ✭ 3,751 (+5258.57%)
Mutual labels:  webxr
webvrrocks
Your guide to Virtual Reality in the browser.
Stars: ✭ 116 (+65.71%)
Mutual labels:  webxr
XREngine
Immersive infrastructure for everyone. Everything you need to build and deploy scalable realtime 3D social apps and more. 🤖 🚀 👓 🚀 🕹️ 🚀 🧑🏿‍🚀
Stars: ✭ 423 (+504.29%)
Mutual labels:  webxr
immersive-ar-emulation
A sort-of polyfill to emulate a fake AR environment which can be hit-tested against.
Stars: ✭ 26 (-62.86%)
Mutual labels:  webxr
geo-alignment
For work toward a feature in WebXR to geo-align coordinate systems. Feature lead: Blair MacIntyre
Stars: ✭ 32 (-54.29%)
Mutual labels:  webxr

Rhodonite

Rhodonite

Rhodonite is a WebGL library written in TypeScript.

npm license

Feature

  • Entity Component System
  • Blittable Memory Architecture (Original GPU data storage system with floating point texture)
  • Physically based Rendering with Image Based Lighting
  • Support loading the following 3D model files: glTF2, glTF1, VRM
  • Support Draco compression, Basis Universal and KTX2, etc

What's the "Blittable Memory Architecture"

With the Blittable Memory Architecture, Rhodonite stores almost all of its data in a large pre-allocated ArrayBuffer. Data storage for matrix or vector classes in Rhodonite's component classes and materials are assigned from the memory pool, which means most of the data are on that memory pool, transferred to the GPU every frame as a floating-point texture. This architecture allows all shaders always to access a vast amount of data.

For example, Rhodonite can handle and blend all morph targets (38 targets) of VRM characters simultaneously in the shader.

Viewer

You can try our library via https://editor.librn.com/ . This viewer supports glTF/VRM files Drag & Drop to display. (Drag & Drop all files if glTF data is consists of multiple files.)

poly

Supported Browsers

Google Chrome, Firefox, Safari, Microsoft Edge (chromium-based), and other modern browsers are supported. IE11 is not supported.

Install

You can install the esm version of Rhodonite easily.

$ yarn add rhodonite

You can install yarn as following,

$ npm install -g yarn

You can use npm of course, but we recommend yarn because we use it usually.

$ npm install rhodonite

Note

If you get an error like "webxr-input-profiles not found" when building a project using Rhodonite, Try "npm install" or "yarn install again.

Coding with Rhodonite

In JavaScript

<body>
  <canvas id="world"></canvas>
  <script src="../../../dist/rhodonite.min.js"></script>
  <script>
  async function load() {
    // All Rhodonite classes you need are in window.Rn object.
    const system = Rn.System.getInstance();
    const gl = Rn.System.init({
      approach: Rn.ProcessApproach.UniformWebGL2,
      canvas: document.getElementById('world')
    });
    const entityRepository = Rn.EntityRepository.getInstance();
    ...
    (After that, please refer to the sample codes.)
    ...
  }
  </script>
</body>

In TypeScript

There are two package versions of Rhodonite: esm (ESModule wrapped in CommonJS) and umd.

Using esm package

You need a bundler like Webpack to import the Rhodonite esm package directly.

import Rn from 'rhodonite'; // All Rhodonite Objects in this

async function load() {
  const gl = Rn.System.init({
    approach: Rn.ProcessApproach.UniformWebGL2,
    canvas: document.getElementById('world') as HTMLCanvasElement
  });

  // Camera
  const cameraEntity = Rn.EntityHelper.createCameraControllerEntity();
  const cameraComponent: Rn.CameraComponent = cameraEntity.getCamera();

  ...
  (After that, please refer to the sample codes.)
  ...
}

Using umd version for actual object and esm version for type only

You can also use dist/umd/rhodonite.js or dist/umd/rhodonite.min.js for the actual Rhodonite object by script tag in HTML file. Then, import types from the rhodonite esm package.

import _Rn from 'rhodonite'; // Use this for adding type annotations to window.Rn in this sample
import { CameraComponent, RenderPass } from 'rhodonite'; // for type annotations for umd usage

declare const window: any;
declare const Rn: typeof _Rn; // Use the window.Rn as Rn


async function load() {
  const gl = Rn.System.init({
    approach: Rn.ProcessApproach.UniformWebGL2,
    canvas: document.getElementById('world') as HTMLCanvasElement
  });

  // Camera
  const cameraEntity = Rn.EntityHelper.createCameraControllerEntity();
  const cameraComponent: CameraComponent = cameraEntity.getCamera();

  ...
  (After that, please refer to the sample codes.)
  ...

In this approach, you don't need any bundler. just compile it by:

$ npx tsc ./main.ts --lib es2015,dom --target es2015 --module umd --moduleResolution node

For detail, See the typescript-based samples like ./samples/simple/VideoTexture/main.ts .

Building Rhodonite

Prerequisites

  • Node.js 14.15.5 or later

Setup Project

$ yarn install

You can use yarn instead.

Build command for Rhodonite library

$ yarn build

Build command for samples

$ yarn build-samples

Try Samples

After building Rhodonite, try:

$ yarn watch-samples

Then, access http://localhost:8082/ with your web browser. When you are finished, press ctrl + c.

Build command for API documents

$ yarn doc

Testing Rhodonite

$ yarn test

You can execute a part of tests like this.

For unit test

$ yarn test-unit-part -- ./src/foundation/core
$ yarn test-unit-part -- ./src/foundation/core/Entity.test.ts

For E2E (visual) test

$ yarn test-e2e-part -- ./samples/test_e2e/FastestInstancedDrawingWebGL1

For M1 Mac in E2E test

If you have trouble with the E2E test in your M1 Mac, Try to install Chromium.

$ brew install chromium

Then try these environment variables.

export PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true
export PUPPETEER_EXECUTABLE_PATH=`which chromium`

See https://stackoverflow.com/questions/65928783/puppeteer5-5-0-install-node-install-js-on-m1 for more detail.

And you can try to uncomment the "executablePath" line.

// config/test/jest-puppeteer.config.js
module.exports = {

  ...

  launch: {
    headless: true,
    devtools: false,
    // executablePath: "/Applications/Chromium.app/Contents/MacOS/Chromium", // Try to uncomment this line if you got error in M1 Mac

    args: ["--start-maximized", "--no-sandbox", "--disable-gpu"],
  },
};

Development using VSCode devcontainer

This project supports the VSCode devcontainer for any docker-installed OS.

Input the following command in the VSCode command palette.

> Remote-Containers: Reopen in Container

After a new dev container window opens, You can work in the Debian Linux container environment. All dependencies (node, npm, yarn, typescript, and all packages for Rhodonite) are already set up.

Debugging inside VSCode (Step execution in VSCode Debug tab)

  1. Install the "Debugger for Chrome" VSCode Extension.
  2. Start the local server with $ yarn start.
  3. Push the run icon by choosing "Launch Chrome to debug Rhodonite samples" in the RUN tab of VSCode's left pane to start debugging.

If you use the VSCode devcontainer environment, You should open the another RhodoniteTS VSCode window locally and do debug ops on it instead of the devcontainer VSCode window.

License

MIT License

Acknowledgements

Libraries & Tools

Our library uses the following libraries and tools and more. Thank you.

Check the complete list on package.json.

Contributors

GitHub Contributors Image

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].