Saturday, February 9, 2019

three.js - Merging geometry/mesh without losing benefits


In three.js we can simply merge geometry to limit the amount of draw calls and thus increase performance. In a simple test with one material, I could draw 50.000 cubes + shadows @ 60fps on my GTX660 GPU. Without geometry merging, 5.000 cubes already caused a problem.


I wonder how to preserve the benefits of rendering each cube mesh on it's own. For example, how to pick a cube mesh when everything is merged into one geometry? By default that's not possible of course.


Is there any common technique for this problem? After all I do have all the unmerged mesh objects even after merging. So there must be some way to utilize them for picking?



What I want to do in a nutshell



  • SimCity like game for learning purposes

  • Each house is a cube mesh

  • Want to render 50.000 houses and be able to add & remove houses

  • House-selection via mouse-cursor (picking) must be possible




No comments:

Post a Comment

Simple past, Present perfect Past perfect

Can you tell me which form of the following sentences is the correct one please? Imagine two friends discussing the gym... I was in a good s...