I got a problem with flickering in my Babylon.js application, The lines of the basketball court are especially noticeable when the camera is zoomed in/out。But if I drag this model file to sanbox，everything is fine，I checked the source code of sanbox, but I didn’t find any special settings.
I can see your lines flickering in the PG. I’m gonna make a 99something% guess for it. zOffset is fighting there. You can fix either through the camera or the material depending on how it’s done. I can give it a closer look if needed. It would be faster and easier 4me if you could give me the name of the meshes and materials… Thanks,
Edit: Too slow Here’s your PG with a fix through option 1 (material zOffset):
Other options are: Fix through mesh position, fix through camera.
Have a great day
Edit2: Forgot to mention that if you don’t want to see the volume of your offseted material, you just need to push the emissiveColor to plain white (since your lines are white).
Hope this helps,
thank your answer, zOffset works fine, bu I’m still curious:
- Why the sandbox can work fine.
- This glb is generated by gltfpack, the original gltf file, in the same code, does not have flicking.
I don’t know what gltfpack does just exactly. You would need to ask someone part of the team @bghgary
As for the sandbox, it’s also using its own camera and light settings by default. And, as I said, the zOffset fighting can also be worked through camera settings.
OMG, so you actually took the time to browse through all these meshes. I’d luv to have your patience On the other hand, if you remove this plane then the terrain would not have its color anymore (as per this design/build).
I just picked the mesh with meshpicker from Inspector, it takes not more than a second
I think the best way is to correct the texture so it would have the right color.
LoL, completely forgot about that. I never use it though it can be very helpful. I’ll try to keep this in mind
Absolutely. But then, not mine to tell others how to make their design, can I?
Have a great day
The sandbox calls
scene.createDefaultCamera which calculates the minZ and maxZ of the camera based on the bounding box of the object. This will make the depth more precise for the model and reduce z fighting. You can do the same by calling this method or compute the minZ and maxZ like this code.
One of the things that gltfpack does is quantize the mesh attributes, including the positions. This can result in positions being closer to each other than before (or perhaps equal) as the precision is maybe not as high.
Thank you very much for your answer, I learned a lot.I am a beginner of babylonjs, thanks for the help of the community.