New .obj importer fails to import faces that refer to non-existing normal indices #98782

Closed
opened 2022-06-11 02:38:58 +02:00 by Amy Moo · 10 comments

Short Description

New obj importer fails to import faces one of my test files. It imports the vertices only.

old python .obj importer can import same file without issue.

The test file:
test.obj

At the console, there are some messages:

Invalid normal index 0 (valid range [0, 0)), ignoring face
Invalid normal index 1 (valid range [0, 0)), ignoring face
Invalid normal index 4 (valid range [0, 0)), ignoring face
Invalid normal index 1 (valid range [0, 0)), ignoring face
Invalid normal index 6 (valid range [0, 0)), ignoring face
Invalid normal index 7 (valid range [0, 0)), ignoring face
Invalid normal index 8 (valid range [0, 0)), ignoring face
Invalid normal index 9 (valid range [0, 0)), ignoring face
Invalid normal index 2 (valid range [0, 0)), ignoring face
Invalid normal index 12 (valid range [0, 0)), ignoring face
Invalid normal index 13 (valid range [0, 0)), ignoring face
Invalid normal index 12 (valid range [0, 0)), ignoring face
Invalid normal index 14 (valid range [0, 0)), ignoring face
Invalid normal index 15 (valid range [0, 0)), ignoring face
Invalid normal index 18 (valid range [0, 0)), ignoring face
Invalid normal index 17 (valid range [0, 0)), ignoring face
Invalid normal index 19 (valid range [0, 0)), ignoring face
Invalid normal index 20 (valid range [0, 0)), ignoring face
Invalid normal index 22 (valid range [0, 0)), ignoring face
Invalid normal index 23 (valid range [0, 0)), ignoring face
Invalid normal index 26 (valid range [0, 0)), ignoring face
Invalid normal index 25 (valid range [0, 0)), ignoring face
Invalid normal index 14 (valid range [0, 0)), ignoring face
Invalid normal index 28 (valid range [0, 0)), ignoring face
Invalid normal index 26 (valid range [0, 0)), ignoring face
Invalid normal index 27 (valid range [0, 0)), ignoring face
Invalid normal index 30 (valid range [0, 0)), ignoring face
Invalid normal index 31 (valid range [0, 0)), ignoring face
Invalid normal index 34 (valid range [0, 0)), ignoring face
Invalid normal index 33 (valid range [0, 0)), ignoring face
Invalid normal index 22 (valid range [0, 0)), ignoring face
Invalid normal index 36 (valid range [0, 0)), ignoring face
Invalid normal index 34 (valid range [0, 0)), ignoring face
Invalid normal index 35 (valid range [0, 0)), ignoring face
Invalid normal index 38 (valid range [0, 0)), ignoring face
Invalid normal index 39 (valid range [0, 0)), ignoring face
Invalid normal index 30 (valid range [0, 0)), ignoring face
Invalid normal index 42 (valid range [0, 0)), ignoring face
Invalid normal index 38 (valid range [0, 0)), ignoring face
Invalid normal index 41 (valid range [0, 0)), ignoring face
Timer 'OBJ_import' took 770.496 ms
**Short Description** New obj importer fails to import faces one of my test files. It imports the vertices only. old python .obj importer can import same file without issue. The test file: [test.obj](https://archive.blender.org/developer/F13144370/test.obj) At the console, there are some messages: ```lines=10 Invalid normal index 0 (valid range [0, 0)), ignoring face Invalid normal index 1 (valid range [0, 0)), ignoring face Invalid normal index 4 (valid range [0, 0)), ignoring face Invalid normal index 1 (valid range [0, 0)), ignoring face Invalid normal index 6 (valid range [0, 0)), ignoring face Invalid normal index 7 (valid range [0, 0)), ignoring face Invalid normal index 8 (valid range [0, 0)), ignoring face Invalid normal index 9 (valid range [0, 0)), ignoring face Invalid normal index 2 (valid range [0, 0)), ignoring face Invalid normal index 12 (valid range [0, 0)), ignoring face Invalid normal index 13 (valid range [0, 0)), ignoring face Invalid normal index 12 (valid range [0, 0)), ignoring face Invalid normal index 14 (valid range [0, 0)), ignoring face Invalid normal index 15 (valid range [0, 0)), ignoring face Invalid normal index 18 (valid range [0, 0)), ignoring face Invalid normal index 17 (valid range [0, 0)), ignoring face Invalid normal index 19 (valid range [0, 0)), ignoring face Invalid normal index 20 (valid range [0, 0)), ignoring face Invalid normal index 22 (valid range [0, 0)), ignoring face Invalid normal index 23 (valid range [0, 0)), ignoring face Invalid normal index 26 (valid range [0, 0)), ignoring face Invalid normal index 25 (valid range [0, 0)), ignoring face Invalid normal index 14 (valid range [0, 0)), ignoring face Invalid normal index 28 (valid range [0, 0)), ignoring face Invalid normal index 26 (valid range [0, 0)), ignoring face Invalid normal index 27 (valid range [0, 0)), ignoring face Invalid normal index 30 (valid range [0, 0)), ignoring face Invalid normal index 31 (valid range [0, 0)), ignoring face Invalid normal index 34 (valid range [0, 0)), ignoring face Invalid normal index 33 (valid range [0, 0)), ignoring face Invalid normal index 22 (valid range [0, 0)), ignoring face Invalid normal index 36 (valid range [0, 0)), ignoring face Invalid normal index 34 (valid range [0, 0)), ignoring face Invalid normal index 35 (valid range [0, 0)), ignoring face Invalid normal index 38 (valid range [0, 0)), ignoring face Invalid normal index 39 (valid range [0, 0)), ignoring face Invalid normal index 30 (valid range [0, 0)), ignoring face Invalid normal index 42 (valid range [0, 0)), ignoring face Invalid normal index 38 (valid range [0, 0)), ignoring face Invalid normal index 41 (valid range [0, 0)), ignoring face Timer 'OBJ_import' took 770.496 ms ```
Author

Added subscriber: @amy_aimei

Added subscriber: @amy_aimei
Pratik Borhade changed title from Wavefront (.obj) (Experimental) fails to import faces to New .obj importer fails to import faces 2022-06-11 12:28:41 +02:00
Member

Changed status from 'Needs Triage' to: 'Confirmed'

Changed status from 'Needs Triage' to: 'Confirmed'
Member

Added subscribers: @PratikPB2123, @aras_p

Added subscribers: @PratikPB2123, @aras_p
Aras Pranckevicius self-assigned this 2022-06-11 21:44:36 +02:00

@amy_aimei the issue seems to be that the .obj file face definitions try to refer to the vertex normals, but there are no vertex normals present in the file at all. So the code as is written now goes "whelp, invalid data, I'm gonna ignore this face". You could say that is a "correct" approach, but given that the old importer was apparently silently ignoring vertex normal indices, when no normals were present, then I'll try to fix this, to accept the invalid normal indices as well.

Which software did you use to produce this obj file?

@amy_aimei the issue seems to be that the .obj file face definitions try to refer to the vertex normals, but there are no vertex normals present in the file at all. So the code as is written now goes "whelp, invalid data, I'm gonna ignore this face". You could say that is a "correct" approach, but given that the old importer was apparently silently ignoring vertex normal indices, when no normals were present, then I'll try to fix this, to accept the invalid normal indices as well. Which software did you use to produce this obj file?
Aras Pranckevicius changed title from New .obj importer fails to import faces to New .obj importer fails to import faces that refer to non-existing normal indices 2022-06-13 10:13:48 +02:00
Author

@aras_p I think it is related to the normals too. But I have tried to import another file exported by the new OBJ exporter with Normals checkbox unchecked, which creates an OBJ without vn. That works.
That OBJ file is generated by my own program that writes vertices and faces data into an OBJ file.

@aras_p I think it is related to the normals too. But I have tried to import another file exported by the new OBJ exporter with Normals checkbox unchecked, which creates an OBJ without vn. That works. That OBJ file is generated by my own program that writes vertices and faces data into an OBJ file.

@amy_aimei so ideally your own program, if it does not output normals, should not write normal indices in f lines, i.e. it should output things like f 1/1 2/2 instead of f 1/1/1 2/2/2

@amy_aimei so ideally your own program, if it does not output normals, should not write normal indices in `f` lines, i.e. it should output things like `f 1/1 2/2` instead of `f 1/1/1 2/2/2`

This issue was referenced by b6c5763b8e

This issue was referenced by b6c5763b8eaec697a714a070409cdc5109a67ba5

This issue was referenced by e1f15e3b32

This issue was referenced by e1f15e3b323e9e0dd4a2514395934ec44969ecfb

Changed status from 'Confirmed' to: 'Resolved'

Changed status from 'Confirmed' to: 'Resolved'
Author

@aras_p Thanks. I also modified my code to output the f lines in the format f 1/1 2/2 instead of f 1/1/1 2/2/2. It works.

@aras_p Thanks. I also modified my code to output the f lines in the format f 1/1 2/2 instead of f 1/1/1 2/2/2. It works.
Bastien Montagne added this to the Pipeline, Assets & IO project 2023-02-09 15:40:48 +01:00
Bastien Montagne removed this from the Pipeline, Assets & IO project 2023-02-10 12:49:18 +01:00
Sign in to join this conversation.
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset Browser
Interest
Asset Browser Project Overview
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
Interest
EEVEE & Viewport
Interest
Freestyle
Interest
Geometry Nodes
Interest
Grease Pencil
Interest
ID Management
Interest
Images & Movies
Interest
Import Export
Interest
Line Art
Interest
Masking
Interest
Metal
Interest
Modeling
Interest
Modifiers
Interest
Motion Tracking
Interest
Nodes & Physics
Interest
OpenGL
Interest
Overlay
Interest
Overrides
Interest
Performance
Interest
Physics
Interest
Pipeline, Assets & IO
Interest
Platforms, Builds & Tests
Interest
Python API
Interest
Render & Cycles
Interest
Render Pipeline
Interest
Sculpt, Paint & Texture
Interest
Text Editor
Interest
Translations
Interest
Triaging
Interest
Undo
Interest
USD
Interest
User Interface
Interest
UV Editing
Interest
VFX & Video
Interest
Video Sequencer
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Blender 2.8 Project
Legacy
Milestone 1: Basic, Local Asset Browser
Legacy
OpenGL Error
Meta
Good First Issue
Meta
Papercut
Meta
Retrospective
Meta
Security
Module
Animation & Rigging
Module
Core
Module
Development Management
Module
EEVEE & Viewport
Module
Grease Pencil
Module
Modeling
Module
Nodes & Physics
Module
Pipeline, Assets & IO
Module
Platforms, Builds & Tests
Module
Python API
Module
Render & Cycles
Module
Sculpt, Paint & Texture
Module
Triaging
Module
User Interface
Module
VFX & Video
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Priority
High
Priority
Low
Priority
Normal
Priority
Unbreak Now!
Status
Archived
Status
Confirmed
Status
Duplicate
Status
Needs Info from Developers
Status
Needs Information from User
Status
Needs Triage
Status
Resolved
Type
Bug
Type
Design
Type
Known Issue
Type
Patch
Type
Report
Type
To Do
No Milestone
No project
4 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: blender/blender#98782
No description provided.