Possible to have instanced objects with different UV coordinates?

Hi everyone!

I’m wondering if it’s possible to have instanced geometry with different UV coordinates, using the Babylon 3Ds Max exporter?

My situation is this -
I have a city with instanced buildings (instanced to keep the file size down).
I’m now looking to bake the lighting into the model.
However the instanced models all appear to use the same UV coordinates of 1 model.

In 3Ds Max, you can have instances, and references, where the base object is instanced, but then modifiers above the reference line are unique to that object, in this case the UV Unwrap would be above the reference line and unique to each object, but they share the same geomerty instance.

If I have to make each building unique it will make the file size larger, and also it’s not great for workflow in Max during production.

Any ideas?

Cheers,
Dean

1 Like

You can probably have several UV sets and use a custom/nme material with a dedicated instance value to select which set to use at runtime but besides this it might be faster if you have only 2 different sets to batch the instances per uvs

1 Like

Maybe using Custom Buffers? Instances | Babylon.js Documentation (babylonjs.com)

2 Likes

Yup this would be a custom buffer, but you d also need a custom shader to swap both the uvs and the texture you fetch from if they are different as well depending on the uv set :slight_smile:

3 Likes

OK thanks guys, it’s well beyond me to go down this route right now, but good to know that it is technically possible.

I’ve changed my approach now, so not needed right now.

Cheers!

1 Like