Giter Site home page Giter Site logo

ex3d / aframe-instancing Goto Github PK

View Code? Open in Web Editor NEW

This project forked from takahirox/aframe-instancing

0.0 0.0 0.0 54 KB

A-Frame instancing component

Home Page: https://cdn.rawgit.com/takahirox/aframe-instancing/153e6d9b128b807ebe606b1c65a3f43c09f7af61/index.html

License: MIT License

JavaScript 89.62% HTML 10.38%

aframe-instancing's Introduction

A-Frame instancing component

This is an example component for A-Frame to take advantage of three.js instanced rendering support. This is useful if you have to render a large number of objects with the same geometry and material but with different world transformations. This will help you to reduce the number of draw calls and thus improve the overall rendering performance in your application.

This is a proof of concept that replicates a large number of spheres with random colors and transformations in just one draw call.

Component API

Property Description Default Value
count The number of geometries to instance 10000
frustumCulled Attempt to hide the instances when out of view of the camera frustum to improve performance. Setting to true doesn't work well at the moment because the camera frustum doesn't "know" where the instanced geometries are located. false

Installation and Usage

Browser

Install and use by directly including the browser files:

<head>
  <title>My A-Frame Scene</title>
  <script src="https://aframe.io/releases/1.0.4/aframe.min.js"></script>
  <script src="[update this URL when takahirox accepts PR and pushes to npm]"></script>
</head>

<body>
  <a-scene>
    <a-entity instancing="count:40000; frustumCulled: false;"></a-entity>
  </a-scene>
</body>

Work in progress

This is a work in progress and could be improved in the future, for example:

  • Allow other primitive geometries to be instanced in addition to the default sphere geometry
  • Provide support for more advanced materials
  • Provide support for imported glTF models to be instanced
  • Provide improved support for frustumCulling (further research on frustum culling with instancing)

aframe-instancing's People

Contributors

takahirox avatar kfarr avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.