writeColor: false doesn't work with some GLTF models

In my application I used a cylinder with colorWrite: false to occlude parts of GLTF models and it worked fine until I started experimenting with different GLTF models. I bumped into one model that is “resistant” to occluding. When I use my occluder generation function:

    getOccluder() {
        const geometry = new THREE.CylinderGeometry( 0.035, 0.035, 0.1, 64 );
        const material = new THREE.MeshBasicMaterial( { colorWrite: false, color: 0x00FFFF });
        const occluder = new THREE.Mesh( geometry, material );
        occluder.rotateY(Math.PI/2);
        occluder.scale.set(0.7, 1, 1);
        
        occluder.renderOrder = 0;
        return occluder;
    }

It simply doesn’t work, I mean the resulting cylinder is just transparent and doesn’t occlude any parts of the model, while working perfectly with other models. When I remove “colorWrite: false” and create occluder’s material like this:

        const material = new THREE.MeshBasicMaterial( { color: 0x00FFFF });

It works as expected, but obviously the occluder is visible.
How can I fix it to ensure consistent behaviour?
Thank you in advance!

Since the default value of renderOrder is zero, this line has no effect. Try it with - Infinity like so:

@Mugen87 Thanks for the response! Unfortunately in didn’t work either. :frowning:
When I render GLTF I set renderOrder to 1:

gltf.renderOrder = 1;

So, theoretically it had to work and it actually does work, but not always. As I mentioned, it worked well with all other models I have and it works as expected when I set colorWrite=true, but doesn’t work with colorWrite=false for some reason.

It seems I have found a problem. For some reason my occluder was shifted to the side and I somehow didn’t even notice it.