Hi there. So i have a model that has a transparent part, but the transparency is not working right. The transparency somehow only works with special camera position.
To me this looks like your model has some issues with face orientation not being consistent. I’d suggest to temporarily add a NormalsHelper() to find out.
import { VertexNormalsHelper } from "../examples/jsm/helpers/VertexNormalsHelper.js";
...
scene.add(boxMesh);
let helper = new VertexNormalsHelper( boxMesh, 1.0, 0xff0000, 1 );
boxMesh.add( helper );
I might be wrong but when you draw transparent objects, threejs sorts the objects for their drawing order from further to closer to camera based on their distance between their position and the camera’s position. If the position of the box and the ground are the same then it makes an ambiguity for threejs to determine which object should be draw first so that they could be properly alpha blended. See the link I shared for the details.
If the ground is always drawn underneeth the every objects, I think one easiest solution that you can try is to use custom rendering order.
Please describe in detail, which effect you’re trying to achieve.
To interpret the descriptions you’ve given so far:
Your “ground” comprises two objects:
1 PlaneGeometry() which receives shadows
1 GridHelper()at the same(!) y-coordinate, which you assign some transparency.
It puzzles me why one would want to make a transparent grid in the first place, because the space between the grid lines is void and has optimum transparency by design already. If you assign the grid lines some transparency to overcome z-fighting with the plane at the same y-coordinate, you’d probably be better off by raising the grid slightly above the ground plane and forget about making the grid transparent.
In your last post you also mention that you want the box to also be transparent. In order ro receive better answers please don’t keep us guessing about your intentions.
Than i realised that some of the models change the transparency depending on the angle you look on the model. So i tried identify the problem. In my opinion the transparency bug has something to do with the ground / grid. So i hope than someone can provide a good ground + grid solution to test. Because my ground + grid is far from good.
P.S. When i change the transparency of the grid i get this results:
Can someone please share a glb model that has real transparency like glass or water. I am not sure the model i am using is good for testing, because even the Windows 3D-Viewer doesn’t show the transparency right. So it maybe ONE of the problems.
OK it seems that the first model i used was somehow not really transparent. Something was wrong with that model. I tried now a few other models and 90% of them worked perfect. So its more like a model problem.