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

Add support for normal maps #49

Open ianmackenzie opened 4 years ago

ianmackenzie commented 4 years ago

Much of the necessary functionality for supporting normal maps is already present inside elm-3d-scene, but there's a bit more thought to do on exactly how to expose it and make sure that all corner cases are correctly handled.

For example, some work remains on how exactly normal map textures should be represented/handled - try to fit it into the existing Texture framework as a Texture Direction3d or similar, or have a specialized NormalMap type? The latter is likely better since it would then be easier to support custom options such as whether normal map texture should be assumed to be in OpenGL or DirectX format.

In addition, normal mapping often involves a sign flag - proper support for this sign flag needs to be added and tested.

ianmackenzie commented 4 years ago

Looks like a good test case for normal mapping: https://cc0textures.com/view?id=Wood027