Hello Will,
I progress with creating ‘procedural’ holes in the wall. Everything works fine except one thing:
When I look through window, every meshes with blending materials are not visible ( glass, another wall ). At least I think that is due to blending materials.
Do you have any idea/solution how improve this ?
Here is my project:
https://playcanvas.com/editor/scene/681120
for MASK I use (plane mesh used as marks for window)
// code here
var meshInstance = this.entity.model.model.meshInstances[0];
var mat = meshInstance.material;
mat.stencilFront = mat.stencilBack = new pc.StencilParameters({
ref: this.maskId,
});
mat.redWrite = mat.greenWrite = mat.blueWrite = mat.alphaWrite = false; // don't write to color, only to stencil
mat.update();
and for MASKED ( wall )
var meshInstance = this.entity.model.model.meshInstances[0];
var mat = meshInstance.material.clone();
meshInstance.layer = pc.LAYER_WORLD - 1; // draw after all stencil masks are drawn
//
mat.update();
this.entity.model.model.meshInstances[0].material = mat;