BabylonJS / Editor

Community managed visual editor for Babylon.js
http://editor.babylonjs.com/
813 stars 232 forks source link

[SOLVED] Viewer is not loading glb files correctly #53

Closed rodrix385 closed 6 years ago

rodrix385 commented 6 years ago

Glb and babylon files exported from 3ds Studio Max are not imported correctly. Faces are "flipped". Lighting is happening on interior faces of mesh. Exterior faces are being "back culled". Very strange.

Related to this issue: https://github.com/BabylonJS/Exporters/issues/132#issuecomment-378817573 The issue is twice (once here and once on the exporter) since there are actually 2 issues (or mulitple concurring bugs).

ThreeJS importer can read the non-working GLB file just fine, so that confirms there is a bug on the Editor.

@deltakosh

julien-moreau commented 6 years ago

Thanks for reporting! Just fixed by updating the loaders with file https://www.dropbox.com/s/ybtkxp3ia9xb5tj/test2.glb?dl=0 @deltakosh

Deploying asap on editor.babylonjs.com

julien-moreau commented 6 years ago

Deployed! Can you confirm that it now works ? Thanks!

rodrix385 commented 6 years ago

Thank you so much! I have tested the same file, and I think I see a change, but I can still "see-through" the object.

It seems there is a bug ALSO on the 3ds Max Babylon exporter too since it seems to be exporting with BLEND as I can see through the object when it should be solid. image

What do you think the issue is? Thanks so much. On the other hand, ThreeJS displays the SAME model perfectly: https://gltf-viewer.donmccurdy.com/

So I am not sure. I guess still not fixed?

rodrix385 commented 6 years ago

Even with this OBJ file I am getting the same issue: image

OBJ file (800kb) https://www.dropbox.com/s/uvutme8yc2vpcy5/test.obj?dl=0

I guess there is still an issue with the editor?

julien-moreau commented 6 years ago

According to your obj file, if you set a standard material and disable back face culling on it, you get the good result: you cannot see through the object.

Still digging into the problem

julien-moreau commented 6 years ago

Can you also provide the MTL file ? Thanks!

rodrix385 commented 6 years ago

test.mtl.txt Sure! Here you.

That's actually the problem, the faces are "flipped". Disabling back face culling shouldn't be necessary. To begin, faces should not be flipped in the first place...

julien-moreau commented 6 years ago

Just exported cubes from 3ds Max by unchecking only "Relative numbers" and it works Did you use the gw::OBJ-Exporter ?

rodrix385 commented 6 years ago

Did you use the gw::OBJ-Exporter ? What is that?

I am on 3ds Max 2018. Export selected-> OBJ Relative Numbers is unchecked.

julien-moreau commented 6 years ago

Just imported your obj file into 3ds Max and tried to export as .babylon, obj, gltf and glb All result the same :(

Are you sure that your model is 100% correct? I’m not an artist and a 3ds Max user :)

rodrix385 commented 6 years ago

Yes, I am pretty sure the model is correct... I can tell you one thing, with my recents tests, if I export via gltf, and then delete manually BLEND from the gltf the file gets loaded correctly (and thus it works well on Editor)

The conclusion I get from the other thread (https://github.com/BabylonJS/Exporters/issues/132#issuecomment-378817573) is the following.

There are 2 bugs: Bug 1) The Exporter has a bug. It sometimes exports the gltf with BLEND when it shouldn't. BUg 2) The Editor has a bug. If the gltf has BLEND it doesn't detect it. If detected, depth pre-pass should be enabled by default - or have an option to manually enable it.

@deltakosh, I suggest you confirm my conclusion (or ping who you consider necessary), just in case.

deltakosh commented 6 years ago

bug 1: I'll check with @noalak bug2: not a bug as I mentioned earlier: Depth pre-pass msut not be by default. It depends on the mesh.

deltakosh commented 6 years ago

Cam you share the original max file to help us detect why we export with Blend enabled

rodrix385 commented 6 years ago

bug2: not a bug as I mentioned earlier: Depth pre-pass must not be by default. It depends on the mesh.

Then I suggest that the Editor has an option to manually enable depth pre-pass, and if that solves the issue, this thread should be closed on the Editor end and continue open on the export end.

About the original Max file, here you go: Piano Frame.zip

Thanks!

deltakosh commented 6 years ago

Agree for the option!

julien-moreau commented 6 years ago

Adding the option :)

rodrix385 commented 6 years ago

Awesome :+1: :)

julien-moreau commented 6 years ago

Adding the option and deploying ASAP :)

julien-moreau commented 6 years ago

Deployed! I suggest that you use the V2 of the editor here: http://editor.babylonjs.com/v2/ Once you edit a material, go to the "Options" folder and check "Need Depth Pre Pass"

rodrix385 commented 6 years ago

Amazing! @julien-moreau , I also wanted to take the time to tell you that the V2 version of the editor is looking absolutely STUNNING! Thanks so much for putting so much work into this. It is looking absolutely fantastic!!! :)

P.S. This issue should be marked as solved. (I cannot find how to do that myself)

julien-moreau commented 6 years ago

Thanks ! Happy that you like it ! Will release a new update soon with new layout features

Closing the issue :)