Giter Site home page Giter Site logo

gkjohnson / batched-material-properties-demo Goto Github PK

View Code? Open in Web Editor NEW
19.0 19.0 2.0 436 KB

Demonstration of rendering three.js' BatchedMesh with different material properties in one draw call.

Home Page: https://gkjohnson.github.io/batched-material-properties-demo/

License: MIT License

JavaScript 99.93% HTML 0.07%

batched-material-properties-demo's Introduction

Graphics enthusiast, three.js collaborator, open source maintainer, former Mars helicopter operator & rover tool designer. If you like my work consider becoming a Github Sponsor. Open for contract work for robotics and data visualization, shader development, interactive 3d graphics, and contributions to any of the following projects!

โœจ Project Highlights

๐Ÿช Robotics & NASA JPL

๐ŸŒฑ Miscellaneous

batched-material-properties-demo's People

Contributors

gkjohnson avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

batched-material-properties-demo's Issues

amazing

just wanted to say I love you work on batched meshes

Found this, dunno if its any help/can give ideas
https://www.khronos.org/assets/uploads/developers/presentations/Philip-Taylor---Leveraging-multi-draw-to-improve-performance.pdf

btw, had a a little bit fund with threejs and batchedmesh and its really cool what performance boost it gives..

msedge_XhSzH36S4F.mp4

Some info whats its doing.. (yes its not a box.. but it was in the beginning ๐Ÿ˜‚ )

This is 5700xt and some amd 8 core cpu a few years old..


const material = new MeshStandardMaterial({ color: 0x00ff00 });

const boxes = 1000;
const box = new SphereGeometry( 5, 50, 50 );
const maxIndexCount = (box.getIndex()?.count || 1) * boxes;
const maxVertexCount = box.getAttribute("position").count * boxes;

for (let y = 0; y < 40; y++) {
  const mesh = new BatchedMesh(boxes, maxVertexCount, maxIndexCount, material);
  mesh.sortObjects = false;
  mesh.perObjectFrustumCulled = false;

  for (let i = 0; i < boxes; i++) {
    const id = mesh.addGeometry(box);
    mesh.setMatrixAt(id, randomizeMatrix(matrix));
  }
  scene.add(mesh);
}

animate();

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.