BatchedMesh uniform per instance

Hi guys, I’ve developed a small library to be able to set custom uniform for each instance of BatchedMesh, if anyone is interested:

Any uniform of the material, can be overwritten.
The uniforms texture supports the partial texture update.

I will add more utilities to the library shortly :slight_smile:

Repository:

6 Likes

This is awesome! Can’t wait to try it with a texture atlas.

1 Like

Thanks!

I have a demo with InstancedMesh2, it’s really similar :slight_smile:

1 Like

Got it working with InstanceMesh, but couldn’t with BatchedMesh, they have different structures. I believe BatchedMesh uses DataTexture instead of array buffers, which got me quickly discouraged!

1 Like

InstancedMesh2 is more similar to BatchedMesh than InstancedMesh.

I quickly converted the example, what do you think? :slight_smile:

2 Likes

Dude, the timing couldn’t be better! I’m actually working on a three.js Wave Function Collapse right now. It’s already crazy fast, but I’m still squeezing out a bit more performance. I haven’t gotten to the 3D rendering part yet, and I was kinda stressed about how to draw all the tiles. Using a bunch of InstancedMesh was pretty much the only plan. But now, with your extension and a texture atlas, I can render everything with a single draw call, as long as the tiles share a relatively similar material.

3 Likes

I’m glad this can help you :smiley:

My work is based on Garrett’s work:

In case you need help, feel free to write to me!

4 Likes

You guys are awesome, we’re super lucky to have you around. Give me a moment to clean things up a bit and I’ll send over the repo.

3 Likes