Hey, everybody!
Faced with this effect:
On mobile devices (mostly Android devices) below 850px, when the camera zooms in on a gltf model, parts of it start to disappear, as if it is being cut by something, or parts of the polygons start to disappear from the renderer.
Also semi-transparent figures appear in front of the camera.
How they manifest themselves:
First video:
Second video:
Third video:
Actions I applied:
-
Optimisation of the model, it was compressed by the number of polygons, as well as compressed textures (as a result, performance improved, but glitches did not go away).
-
I thought that the problem may be in the settings and display methods of PerspectiveCamera, and applied different parameters such as:
const camera1 = new THREE.PerspectiveCamera(75, window.innerWidth / window.innerHeight, 0.1, 450);
camera1.updateProjectionMatrix();
camera1.zoom
camera1.filmGauge
camera1.filmOffset
camera1.focus
(This didn’t get rid of the bugs either).
-
I can also set any mesh in the gltf model its own materials and properties to them, but switching to different types of materials, also does not solve the problem, as well as switching the parameters transparent and depthWrite in different positions.
(performance changes, but bugs don’t go away) -
I also thought that there might be a problem with the settings and positions of the light sources, because the black translucent formations look like RectAreaLightHelper, but after I removed them or moved them further away from the visibility area, the bugs did not go away.
(Also the reflection of the SpotLight in the windscreen has gone black, can’t figure out the reason why. It’s evident in the video)
My assumptions:
- Object collision can occur. (the camera crashes into the model, but then it would cut it with an even layer, not quite suitable, but still)
- Camera occlusion can occur.
As if the renderer can’t render the gltf parts of the model, or render them in a chaotic order.
My render settings right now:
const renderer = new THREE.WebGLRenderer({
antialias: AA, // is changed dynamically from the variable
precision: "lowp",
physicallyCorrectLights: true,
});
renderer.setSize(window.innerWidth, window.innerHeight);
renderer.toneMapping = THREE.ACESFilmicToneMapping;
renderer.toneMappingExposure = 0.1;
renderer.shadowMap.enabled = ShadowSwitch;
renderer.shadowMap.type = THREE.PCFSoftShadowMap;
renderer.setPixelRatio( window.devicePixelRatio * 0.9 );
renderer.localClippingEnabled = true;
If anyone has encountered similar effects, and knows how to solve them or what to pay attention to, please help in understanding this problem)))
Thank you very much!)))