Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Document how to use and customize Obj in detail #39

Open
dbrgn opened this issue Nov 10, 2019 · 5 comments
Open

Document how to use and customize Obj in detail #39

dbrgn opened this issue Nov 10, 2019 · 5 comments

Comments

@dbrgn
Copy link

dbrgn commented Nov 10, 2019

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
Copy link
Author

dbrgn commented Nov 10, 2019

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

@sisso
Copy link

sisso commented May 7, 2020

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

@sisso
Copy link

sisso commented May 7, 2020

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

ojhunt@fe7b3c7

@simnalamburt
Copy link
Owner

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

@simnalamburt
Copy link
Owner

simnalamburt commented May 9, 2020

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

let input = BufReader::new(File::open("tests/fixtures/dome.obj")?);
// NOTE: This will fail since dome.obj does not have normal data
// let obj: Obj = load_obj(input)?;
let obj: Obj<Position> = load_obj(input)?;

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

@simnalamburt simnalamburt changed the title Missing normals in model Document how to use and customize Obj in detail May 9, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants