obj-rs icon indicating copy to clipboard operation
obj-rs copied to clipboard

Document how to use and customize `Obj` in detail

Open dbrgn opened this issue 5 years ago • 5 comments

I'm trying to load an OBJ file that has been exported from FreeCAD. When doing so, I get the following error message:

LoadError { kind: InsufficientData, desc: "Tried to extract normal data which are not contained in the model" }

What does that mean? FreeCAD can open those files fine, are these normals required to load the file?

(Note: I'm only getting started with the OBJ format and don't have a lot of knowledge about it yet.)

dbrgn avatar Nov 10 '19 01:11 dbrgn

The same thing happens when loading the file tests/fixtures/pot.obj in the repository from the glium example.

dbrgn avatar Nov 10 '19 01:11 dbrgn

Same happens with own cube.obj in the fixutres tests: https://github.com/simnalamburt/obj-rs/blob/master/tests/fixtures/cube.obj

sisso avatar May 07 '20 20:05 sisso

Looks like some fork has a patch to have optional normals.

https://github.com/ojhunt/obj-rs/commit/fe7b3c71a22ec531ce995f077385a7439bb34f2d

sisso avatar May 07 '20 20:05 sisso

I think making a new type like VertexWithoutNormal would be better, since Option type in Vertex struct is hard to handle with GPU.

simnalamburt avatar May 09 '20 06:05 simnalamburt

Wait, a type called Position already exists. If your Obj file does not contains normal data, this will work:

https://github.com/simnalamburt/obj-rs/blob/a9213b00794641a003456c3cbb77228d99f26ee5/examples/no-normal.rs#L15-L20

I do understand that this is not documented very well. Let's change the title of this issue to state the problem clearer!

simnalamburt avatar May 09 '20 06:05 simnalamburt