BABYLON.OBJExport.OBJ - mesh serialization BUG

Hi friends!

This playground, using a .glb where meshes have vertex colors attribute,
works correctly with 4.2.1 and 5.71.1
but not with 6.49.0 and latest (7.8.2), with these errors in browser console:
image

This playground, using a .glb where the same meshes have NOT vertex colors attribute, works correctly for all versions.

It seems that, in 6.49.0 and latest versions, when some (or all) meshes have vertex colors attribute, something goes wrong in mesh serialization when exporting in .obj

Furthermore, test.obj file produced from these playground, when opened with sandbox.babylonjs.com:

correct when produced with 4.2.1 and 5.71.1

all normals inverted when produced with 6.49.0 and 7.8.2

Can you help?
Many thanks in advance

Let me blame @bghgary LOL

Blame GIFs - Find & Share on GIPHY

I think you would need Add legacy behavior flag to obj loader by bghgary · Pull Request #14920 · BabylonJS/Babylon.js · GitHub

I think these are two separate issues. I’ll investigate in a bit.

1 Like

Sorry for the delay. I will try to investigate tomorrow.

1 Like

I’ve fixed the first problem (where the OBJ export was throwing an exception) in this PR: Fix VertexData.ExtractFrom functions to support 3-component colors by bghgary · Pull Request #15162 · BabylonJS/Babylon.js (github.com)

Will investigate the handedness issue next.

3 Likes

Inside out issue should be fixed with this PR: Fix incorrect OBJ flip faces check by bghgary · Pull Request #15167 · BabylonJS/Babylon.js (github.com)

@paoloz Sorry for the troubles and thanks for reporting the issues!

Many thanks @bghgary for solutions!
I believe these solutions will be merged into an upcoming version 7 release. Right?
Can I hope that it will also be merged into a version 6 update, like 6.49.1?

The next minor release in 7.x.x will have these fixes. We do not patch older versions. Is there a reason why you can’t move to 7.x.x?

My project is currently based on version 5.57.1, which for my purposes I consider stable and tested.
The problems I reported in this post emerged during the hundreds of tests carried out in an attempt to move to version 6.49.0, which I currently will not be able to implement without this fix.
To switch to version 7 I would have to redo all the tests (several hundred cases), which is why I was hoping for the fix in version 6.
I use the current version 7 as a test but I find it unstable for production, I would have to redo the tests with each new release.
I would have to freeze an upcoming version 7 containing the fixes to be able to use it in production, but still I would have to retest everything.
Can you show me the way to apply the fixes to a self-hosted 6.49.0 version myself?

PS.: playground.babylonjs.com refers to version 5.71.1 which I believe does not exist, the latest released should be 5.57.1

Can you elaborate on why it’s unstable?

I don’t know what you mean by self-hosted. Are you using UMD or ES6?

@RaananW?

This is really concerning and should not be happening, please share with us in which area you have issues ?

I’ll check what happened here

First of all I apologize for my poor English.
Calling the preview version “unstable” is not a criticism and I don’t want to alarm anyone.
In the 5 years that I have been using babylon, problems with the preview version have been very rare, one is the one I reported to you in this post and it was promptly resolved.
Only a couple of times did it happen to me that the preview version had problems with scripts that previously worked. These other cases have always been resolved in subsequent releases.
So, calling the preview version “unstable” is a mistake, and is probably just my problem, due to the potential risk of something that worked no longer working temporarily, combined with my slow and weak ability to detect and fix it.
Hence my preference to use a frozen, tested version for production (currently 5.57.1) and the fear of using the weekly updated preview version.

In my project I use babylon.js and related files taken from the 5.57.1 ​​CDNsnapshot and hosted on my server.

How can I use the files taken from the 6.49.0 CDNsnapshot, and apply to them the fix?

I think the versions are too far off to be able to retrofit the change easily :frowning:

I managed to retrofit the changes by surgically taking them from CDNsnapshot of 7.10.0 and applying them to the affected files of 6.49.0 used in my project (babylon.js and serializers/babylon.serializers.min.js)
Once again, many thanks

3 Likes