bkaradzic / bgfx

Cross-platform, graphics API agnostic, "Bring Your Own Engine/Framework" style rendering library.
https://bkaradzic.github.io/bgfx/overview.html
BSD 2-Clause "Simplified" License
15.12k stars 1.95k forks source link

Geometryc Error: Unsupported file type *.obj #3373

Closed JtePerson closed 2 weeks ago

JtePerson commented 2 weeks ago

Geometryc Error: Unsupported file type .obj* So I finally successfully built bgfx osx-arm64 but when I went to try and convert a .obj file to a .bin using geometryc it threw an error saying that the input file was of an unsupported type even though the documentation and help command explicitly say that .obj files are supported. Also I don't think it's an error with the build because I built and ran the examples and my own main.cpp file and everything ran just fine with no problems

All I did to cause error Steps to reproduce the error:

  1. build bgfx for osx-arm64
  2. run geometryc with input file .obj and an output file .bin "./ExtLib/bgfx/.build/osx-arm64/bin/geometrycRelease -f ./meshes/.obj -o ./meshes/.bin"
  3. then this was the entire output "Unsupported input file format './meshes/*.obj'"

Expected behavior To have geometryc generate a *.bin file for use in main.cpp

Additional context I am running everything on macOS with the bgfx build "osx-arm64" attempting run "geometrycRelease" with only input and output file flags. Sorry for the limited info but this is all the info I received when trying to run geometryc

bkaradzic commented 2 weeks ago

You need to specify file name...

For example this should work: geometryc -f examples/assets/meshes/bunny.obj -o test.bin

JtePerson commented 2 weeks ago

Sorry for the misconception I was just being discreet about my file names, this was the exact command I typed to cause the error, "./ExtLib/bgfx/.build/osx-arm64/bin/geometrycRelease -f ./meshes/plane.obj -o ./meshes/plane.bin" and this was the only error message I got, "Unsupported input file format './meshes/plane.obj'"

Maybe its still something I'm doing though, is it maybe a problem with how blender generates .obj or .glb files?

bkaradzic commented 2 weeks ago

Attach .obj file you have problem with.

JtePerson commented 2 weeks ago

plane.zip

bkaradzic commented 2 weeks ago
$ geometryc -f plane.obj -o plane.bin
obj parser # 1140
size: 45864
parse 0.000380 [s]
tri reorder 0.000028 [s]
convert 0.041583 [s]
g 7, p 4, v 1265, i 1944

Produces this file: plane.bin.zip

mosra commented 2 weeks ago

Looks like the . in the file path is what causes the problem, because it seems to treat everything after the first period as an extension.

bkaradzic commented 2 weeks ago

Looks like the . in the file path is what causes the problem, because it seems to treat everything after the first period as an extension.

Where do you see multiple dots?

And yes, bx treats everything after first dot as extension: https://github.com/bkaradzic/bx/blob/2cebc558eb314e324f01ef05735551f234f5ea13/tests/filepath_test.cpp#L85

If you have /tmp/archive.tar.gz, path is /tmp/, filename is archive.tar.gz basename is archive, extension is .tar.gz

JtePerson commented 2 weeks ago
$ geometryc -f plane.obj -o plane.bin
obj parser # 1140
size: 45864
parse 0.000380 [s]
tri reorder 0.000028 [s]
convert 0.041583 [s]
g 7, p 4, v 1265, i 1944

Produces this file: plane.bin.zip

Ok thanks, for future reference though how might I go about solving this issue on my own and do you mind explaining what these different commands do?

bkaradzic commented 2 weeks ago

Ah I just realized maybe dot before slash causes the issue?!

bkaradzic commented 2 weeks ago

Nope, both work as expected:

geometryc -f examples/assets/meshes/bunny.obj -o test.bin

geometryc -f ./examples/assets/meshes/bunny.obj -o ./test.bin

Ok thanks, for future reference though how might I go about solving this issue on my own and do you mind explaining what these different commands do?

Can't really answer I still don't understand what's wrong with your command line.

Can you point out what fixed the issue for you?

JtePerson commented 2 weeks ago

Uh... not really, I attempted to run the command you said worked but it failed. Well it gave me a different error message but it was still the same "Unsupported file format" problem

JtePerson commented 2 weeks ago

Again sorry for the limited info, everything else compiles and runs including shaderc and geometryv so I don't fully understand why geometryc doesn't work

JtePerson commented 2 weeks ago
$ geometryc -f plane.obj -o plane.bin
obj parser # 1140
size: 45864
parse 0.000380 [s]
tri reorder 0.000028 [s]
convert 0.041583 [s]
g 7, p 4, v 1265, i 1944

Wait sorry I think I misread this, just to clarify the first line is the command and the following is the output?

bkaradzic commented 2 weeks ago

Yes, this is command line:

geometryc -f plane.obj -o plane.bin