Hi, i’m trying to see inside a cube occluding a part of a wall with other cube.
In the fiddle below is the basic scene set up, and what im trying to do is make the blue cube transparent and occlude that part of the wall of the grey cube to se inside of it there. I tried to do it with mesh.material.colorWrite property but i couldn’t do it.
So you set colorWrite to false for the smaller cube. Then you have to ensure that the bigger cube is rendered last. You can enforce this by setting Object3D.renderOrder to a higher value than 0.
However, this is still a hack and does not produce your intended result since you can’t see the back faces of the cube (so it’s not possible to look “inside” the cube, just through it). Because of this, a better solution is to make a hole in the geometry of the big cube. You can do this in a tool like Blender or dynamically by manipulating the geometry data in your code.
Thanks for the quick response, with the colorWrite and renderOrder I managed to achieve what you are saying but as you said it doesnt produce the result I’m looking for.
The thing is that making a hole in blender or a similar app does not produce what I’m looking for because te real project is to add windows to a cube, so with the window you can see inside like a real window of a house.
That been said, this could be a good option “dynamically by manipulating the geometry data in your code.”. Is there a way to add a object on the cube and make a hole like the geometry that is been adding ?