Smart camera parameters to optimize depth accuracy.
We often see z-fighting issue(rendering is flicking) for many models if camera NEAR-FAR range is not minimum (minimum to cover all geometry)
When using OrbitControl or other controls or camera animation, this NEAR-FAR range should be dynamically updated to avoid rendering issue.
It is the user's responsibility to avoid small values of the near plane.
Are you not able to do that for some reason?
NEAR-FAR range should be dynamically updated to avoid rendering issue.
I've never seen that a 3D or game engine does this. Can you name an example if possible?
I just think it is an enhancement for the dynamic(moving) camera.
The camera needs to understand the situation of the scene to update NEAR plane with optimal value, not by human manually.
As a result, render always render with the best accuracy.
There is no way for the library to know what is optimal for your use case. Your feature will have to be implemented in the application layer.
I've never seen that a 3D or game engine does this. Can you name an example if possible?
@Mugen87
My engine does that :)
I'm not very sure if that's a good idea overall or not, as you end up with a bit of flickering when clipping planes are adjusted. For me the results have been great so far, but your mileage may vary.
I do a search query on scene BVH to determine depth clipping planes before rendering takes place.
@Usnul It would be interesting for @whatisor if you can share a link to your code :+1:
@whatisor You can also have a look at certain model viewers. They also perform such an adjustment based on the size of the model's bounding box:
Thank @Usnul, in fact, I am considering if we ought to make it as renderer feature to make it work in the best accuracy with any camera parameters and scene.
Just a suggestion! :)
Closing, as @WestLangley said this needs to be implemented in the app layer.
Most helpful comment
It is the user's responsibility to avoid small values of the near plane.
Are you not able to do that for some reason?