Culling between different instances of thin instances

Hello,
I’m using thin instances to render a lot of boxes.
I need these instances to have opacity against a plane that contains a texture.
But I want these instances to be opaque one to the other.

Currently, I have backface culling enabled, but it doesn’t affect other instances.

Is it possible to do this? How I should do it?

All thin instances share the material of the underlying mesh, you can’t have a transparent material for some instances and an opaque for others.

But maybe I misunderstand your problem? If you can setup a playground that demonstrates the problem, it will be easier for us to help.

1 Like

Thank you for your answer and sorry for my late reply.

This is not what I was trying to do. I didn’t explained my problem properly.

I created an example: https://playground.babylonjs.com/#8L50Q3#239

What I want to achieve is that, thought cubes I want to see the black box called wall by adding a transparent property. But I don’t want to see other thin instances (other cubes).

Cubes must block 100% one to each other even if they are transparent.

I’m not sure if this is posible and if it is, how to do it.

I don’t see how to do it. Thin instances of a mesh will be either opaque or transparent, you can’t have some of them transparent and some others that are not.

All of them have the same level of transparency (let’s say 0.8), but portion of instances that are behind another instance must be full transparent. Some kind of backface culling, but instead, back instance culling.

One way of doing it would be using a pixel shader, I guess,
so that all instances are opaque and if there is the wall box behind the current element the color resultant is a mix of both, instance and wall box. As it seems that there is not a more direct solution.