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

OBJ import missing textures #36173

Closed
zzador opened this issue Feb 13, 2020 · 14 comments
Closed

OBJ import missing textures #36173

zzador opened this issue Feb 13, 2020 · 14 comments

Comments

@zzador
Copy link

zzador commented Feb 13, 2020

Im using Godot 3.2 and I have made a little One-Room-Test-Map in GZDoomBuilder with 3 different textures and exported the map to an OBJ file. When importing the OBJ file into Godot it loads 2 of the 3 textures and assigns them to the corresponding walls/floors/ceilings but the third texture (WALLS.PNG) is not loaded. The walls that use this texture stay grey and Godot-Output says:

Couldn't open MTL file 'MAP01_MAP01.mtl', it may not exist or not be readable.

No loader found for resource: res://MAP01/WALL1.PNG

The MTL-File exists and the two other textures are successfully loaded from there, so the first error message makes absolutely no sense.
The texture WALL1.PNG is loaded correctly afterwards as I can edit, see and even manually assign the texture. The textures location is the same as the other two textures and it gets references the same way in the "mtl" file as the other two textures.

I have uploaded the generated OBJ-File and Textures to file-upload:

https://www.file-upload.net/download-13901101/MAP01.zip.html (bugsquad edit: mirror)

@Calinou
Copy link
Member

Calinou commented Feb 13, 2020

Can you reproduce this with OBJ files created with another program (such as Blender)?

@zzador
Copy link
Author

zzador commented Feb 13, 2020

Can you reproduce this with OBJ files created with another program (such as Blender)?

Yes. Now I made two obj files in Wings3D. Both have a cube with 3 different materials. The first file has a mesh-group for every material and the second file has only one mesh-group with 3 material assigns. Both files won't import correctly. It is even worse than the obj file from GZDoomBuilder. Now NO texture is loaded and assigned at all. The same error messages as before.

Files can be downloaded here:
https://www.file-upload.net/download-13901411/meshes.zip.html (bugsquad edit: mirror)

@zzador
Copy link
Author

zzador commented Mar 18, 2020

Made a few more tests. Sometimes Godot will import the OBJ files without an error, and the materials are correctly applied and sometimes they are missing and the error messages make absolutely no sense at all. The OBJ-Import seems still very buggy which is really surprising as the OBJ Format is the simplest of all 3D-content formats.

@Calinou
Copy link
Member

Calinou commented Mar 18, 2020

@zzador Can you post the full error log here?

Also, it would be interesting to try loading the OBJ file at run-time using gd-obj.

@git2013vb
Copy link

git2013vb commented Mar 21, 2020

I have same problem. It is related to godot import I guess:
Godot wireframe:
image
rendered:
image

Same obj imported in blender (wireframe):
image

rendered:
image

To many differences if I can say..
Also in Godot there are additional wirefame connection that aren't in obj.

Also error for each mtl file. (false errors?)

Couldn't open MTL file 'roadTile_001.mtl', it may not exist or not be readable.
editor/import/resource_importer_obj.cpp:66 - OBJ: Ambient light for material 'Water' is ignored in PB

@zzador
Copy link
Author

zzador commented Mar 25, 2020

I have same problem. It is related to godot import I guess:
Godot wireframe:
image
rendered:
image

Same obj imported in blender (wireframe):
image

rendered:
image

To many differences if I can say..
Also in Godot there are additional wirefame connection that aren't in obj.

Also error for each mtl file. (false errors?)

Couldn't open MTL file 'roadTile_001.mtl', it may not exist or not be readable.
editor/import/resource_importer_obj.cpp:66 - OBJ: Ambient light for material 'Water' is ignored in PB

Without knowing details I would hardly guess the difference in wireframe is completely normal and the result of triangularization. Godot needs triangles only but Blender works with arbitrary polygons that can have any number of vertices. The Material error however seems to be the same.

@Calinou
Copy link
Member

Calinou commented Mar 25, 2020

@zzador To alleviate issues related to automatic triangulation, it's recommended to use the Triangulate modifier and check Apply Modifiers in Blender's export dialog. This way, you can preview how triangulation will look directly from Blender.

@zzador
Copy link
Author

zzador commented Mar 25, 2020

@zzador Can you post the full error log here?

Also, it would be interesting to try loading the OBJ file at run-time using gd-obj.

Godot's Output:

ERROR: No loader found for resource: res://MAP01/WALL1.PNG.
At: core/io/resource_loader.cpp:285
ERROR: No loader found for resource: res://MAP01/WALL2.JPG.
At: core/io/resource_loader.cpp:285
ERROR: Couldn't open MTL file 'test.mtl', it may not exist or not be readable.
At: editor/import/resource_importer_obj.cpp:48
WARNING: _parse_material_library: OBJ: Ambient light for material 'material01' is ignored in PBR
At: editor/import/resource_importer_obj.cpp:66
WARNING: _parse_material_library: OBJ: Ambient light for material 'material02' is ignored in PBR
At: editor/import/resource_importer_obj.cpp:66

@MHillier98
Copy link

Found the same error - I'm not applying any materials in blender, just exporting some text that's been extruded.
Here's what shows when I import:

Godot Engine v3.2.2.stable.official
OpenGL ES 3.0 Renderer: GeForce RTX 2080/PCIe/SSE2
 
 Couldn't open MTL file 'Font-7.mtl', it may not exist or not be readable.
 editor/import/resource_importer_obj.cpp:66 - OBJ: Ambient light for material 'None' is ignored in PBR

The file is there:
image

@aario
Copy link

aario commented Mar 8, 2022

Any hope this gets fixed?
I also have this issue.
3.4.2 stable
FBX import does nothing.
Obj import gives me a white object with no skin
image

@Calinou
Copy link
Member

Calinou commented Mar 8, 2022

@aario Please upload a minimal reproduction project so we can make sure this is actually the same issue.

We don't know the exact cause of this bug yet, so I don't know how this can be fixed.

@aario
Copy link

aario commented Mar 8, 2022

I would like to. But the problem is I'm quite new to this 3d technology altogether (Although having years of experience in web development). So I have bought and downloaded this:
https://syntystore.com/products/polygon-city-pack
And tried to import it to godot 3.4.2 and godot 4 alpha 4
Since the assets are proprietary I cannot upload them somewhere.

@aario
Copy link

aario commented Mar 9, 2022

My problem was with the source file. I used https://github.com/Plattar/gltf-exporter to export Unity assets from inside unity to gltf and now gltf is correctly imported. Althugh those fbx assets which I could not import to godot propely, I wasn't able to import into unity as well.

@and-rad
Copy link
Contributor

and-rad commented Apr 27, 2023

Regarding the original bug, this seems to be happening because of the order in which the assets are imported. WALL1 appears after MAP01 alphabetically, which means that the texture hasn't been imported yet when the material file is being imported. I successfully tested this by renaming various files:

WALL1.png -> LALL01.png: Import works
WALL1.png -> NALL1.png: Import doesn't work
FLOOR1.png -> NLOOR1.png: Import doesn't work
MAP01_MAP01.mtl -> XAP01_MAP01.mtl: Import works

Which would make this issue a duplicate of #28203.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants