I use ‘png’ image for texture.
But when i move the camera i can see the object inside the wall.Just like the wall become ransparent.
I dont know why.
Could you include your code and a demo, e.g. using Codepen, Glitch, Neocities, etc.? Doing so makes it much easier for others to help you, otherwise we’re just guessing.
oh! sorry, here is my code
var mtlLoader = new THREE.MTLLoader();
var objLoader = new THREE.OBJLoader()
mtlLoader.setPath('model/shenliang1/');
mtlLoader.load('shenliang.mtl',function(mat){
mat.side = 2;
mat.preload();
objLoader.setMaterials(mat);
objLoader.setPath('model/shenliang1/');
objLoader.load('shenliang.obj',function(obj){
obj.children.forEach(function(mesh){
var name = mesh.name;
if (name.indexOf('_') !== -1) {
mesh.material.transparent = true;
mesh.material.side = 2;
} else {
var matArray = mesh.material;
matArray.forEach(function (mat) {
mat.transparent = true;
mat.side = 2;
})
mesh.castShadow = true;
mesh.receiveShadow = true;
};
})
scene.add(obj)
})
});
i can see the object inside the wall.Just like the wall become transparent.
I dont know why.
I’m not sure I understand the issue — your code is setting material.transparent = true
. I can’t see your model (this is why a demo is ideal) but it seems like this is exactly what your code should do?
this is my model file.Please take a look at the model.
check this link http://skyinfor.cn/threejs/sl/sl.html
Can you share the model, mtl, and all textures?
You could try setting mat.depthTest = false
ofcourse , but how to share my model to you?
i upload the model but nothing at all.