ianmackenzie / elm-3d-scene

A high-level 3D rendering engine for Elm, with support for lighting, shadows, and realistic materials.
https://package.elm-lang.org/packages/ianmackenzie/elm-3d-scene/latest/
Mozilla Public License 2.0
207 stars 27 forks source link

Allow custom near/far clip depth when using toWebGLEntities #109

Open ianmackenzie opened 11 months ago

ianmackenzie commented 11 months ago

When using toWebGLEntities to interop with other WebGL code, the automatic computation of near and far clip depth from scene bounds makes it very difficult to ensure the same near/far clip depths are used by both elm-3d-scene and custom WebGL code, meaning that depth sorting between elm-3d-scene and custom WebGL entities may end up being incorrect.

One possible fix would be to do the automatic computation of near/far clip depth in composite instead of in toWebGLEntities, and then pass those values in to toWebGLEntities; this would then mean that any code that called toWebGLEntities could pass its own custom near/far clip depths instead.