declension / elm-obj-loader

An elm library for importing wavefront .obj files into your WebGL application.

Home Page:http://package.elm-lang.org/packages/declension/elm-obj-loader/latest

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Compute normals if not specified in OBJ file

declension opened this issue · comments

Currently OBJ files without vector normals fail parsing (and somewhat hard to debug this as the parser output isn't always easy to interpret)

Example: this cow.

I'm not sure how hard this is, but I imagine you can just take the right vectors, calculate the cross product and use that?

It's surprisingly difficult to calculate them properly, I don't think this package should do it.

To do it properly, you would also have to respect the smooth groups. However, calculating normals inside a smooth group is also not easy and can in fact be done in several ways (e.g. how much weight do you give to a single surface?). In short, it adds a lot of complexity and I don't think it's worth it.

Also, the README explicitly mentions that this is not supported.

I see, thanks for the info. I'll shut this then.