Babylon.js icon indicating copy to clipboard operation
Babylon.js copied to clipboard

Add UV2 morph support and load UV and UV2 morph targets from glTF

Open chubei-urus opened this issue 1 year ago • 16 comments

I'm opening this PR following the suggestion in https://forum.babylonjs.com/t/morph-uv2-and-import-the-morph-target-from-gltf/53558/2.

The PR adds uv2 morphing to the built-in materials as well as the morph target block in the node material. It also modifies the glTF loader to load the TEXCOORD_0 and TEXCOORD_1 morph target attributes.

chubei-urus avatar Sep 19 '24 19:09 chubei-urus

To reviewer: I'm not sure how to test the code changes. I only know it works because I have a downstream application that uses node material. Haven't tested other materials at all.

chubei-urus avatar Sep 19 '24 19:09 chubei-urus

Please make sure to label your PR with "bug", "new feature" or "breaking change" label(s). To prevent this PR from going to the changelog marked it with the "skip changelog" label.

bjsplat avatar Sep 19 '24 19:09 bjsplat

Please make sure to label your PR with "bug", "new feature" or "breaking change" label(s). To prevent this PR from going to the changelog marked it with the "skip changelog" label.

bjsplat avatar Sep 19 '24 19:09 bjsplat

Snapshot stored with reference name: refs/pull/15602/merge

Test environment: https://snapshots-cvgtc2eugrd3cgfd.z01.azurefd.net/refs/pull/15602/merge/index.html

To test a playground add it to the URL, for example:

https://snapshots-cvgtc2eugrd3cgfd.z01.azurefd.net/refs/pull/15602/merge/index.html#WGZLGJ#4600

Links to test babylon tools with this snapshot:

https://playground.babylonjs.com/?snapshot=refs/pull/15602/merge https://sandbox.babylonjs.com/?snapshot=refs/pull/15602/merge https://gui.babylonjs.com/?snapshot=refs/pull/15602/merge https://nme.babylonjs.com/?snapshot=refs/pull/15602/merge

To test the snapshot in the playground with a playground ID add it after the snapshot query string:

https://playground.babylonjs.com/?snapshot=refs/pull/15602/merge#BCU1XR#0

bjsplat avatar Sep 19 '24 19:09 bjsplat

@chubei-urus can you add a gltf visualization test ? so it would not experience nme but already a big part of the code.

sebavan avatar Sep 19 '24 19:09 sebavan

@chubei-urus can you add a gltf visualization test ? so it would not experience nme but already a big part of the code.

Sure @sebavan! Do you have any pointers on where to add that?

chubei-urus avatar Sep 19 '24 19:09 chubei-urus

Visualization tests for WebGPU (Experimental)

https://snapshots-cvgtc2eugrd3cgfd.z01.azurefd.net/refs/pull/15602/merge/testResults/webgpuplaywright/index.html

bjsplat avatar Sep 19 '24 19:09 bjsplat

@chubei-urus can you add a gltf visualization test ? so it would not experience nme but already a big part of the code.

Sure @sebavan! Do you have any pointers on where to add that?

you can add a test model in https://github.com/BabylonJS/Assets and then follow the contributing doc here to add the new test https://doc.babylonjs.com/contribute/toBabylon/HowToContribute#visualization-tests Do not hesitate to provide doc feedback so we can improve it if needed :-)

sebavan avatar Sep 19 '24 19:09 sebavan

WebGL2 visualization test reporter:

https://snapshots-cvgtc2eugrd3cgfd.z01.azurefd.net/refs/pull/15602/merge/testResults/webgl2playwright/index.html

bjsplat avatar Sep 19 '24 19:09 bjsplat

Visualization tests for WebGL 1 have failed. If some tests failed because the snapshots do not match, the report can be found at

https://snapshots-cvgtc2eugrd3cgfd.z01.azurefd.net/refs/pull/15602/merge/testResults/webgl1/index.html

If tests were successful afterwards, this report might not be available anymore.

bjsplat avatar Sep 19 '24 19:09 bjsplat

Seems like some WGSL shader updates are missing, is this PR still a draft?

noname0310 avatar Sep 19 '24 20:09 noname0310

Seems like some WGSL shader updates are missing, is this PR still a draft?

I didn't know how to run the vis tests locally. I'll convert to draft and fix the errors before requesting review again.

chubei-urus avatar Sep 19 '24 20:09 chubei-urus

The code looks really solid at a first glance, I ll let @deltakosh validate and @bghgary for the gltf part

Looks good from the glTF perspective. The spec says this FYI:

Client implementations SHOULD support at least three attributes — POSITION, NORMAL, and TANGENT — for morphing. Client implementations MAY optionally support morphed TEXCOORD_n and/or COLOR_n attributes.

bghgary avatar Sep 20 '24 16:09 bghgary

Seems like some WGSL shader updates are missing, is this PR still a draft?

I didn't know how to run the vis tests locally. I'll convert to draft and fix the errors before requesting review again.

@chubei-urus This might help you to create the visualization tests if you you didn't create the tests yet: https://forum.babylonjs.com/t/visualization-tests/41753

RolandCsibrei avatar Sep 28 '24 16:09 RolandCsibrei

Hey there! any update?

deltakosh avatar Oct 08 '24 17:10 deltakosh

Hi! I haven't found time to work on this PR yet.

chubei-urus avatar Oct 08 '24 22:10 chubei-urus

This pull request has been marked as stale because it has been inactive for more than 14 days. Please update to "unstale".

github-actions[bot] avatar Nov 06 '24 00:11 github-actions[bot]

Visualization tests for WebGPU (Experimental)

https://snapshots-cvgtc2eugrd3cgfd.z01.azurefd.net/refs/pull/15602/merge/testResults/webgpuplaywright/index.html

bjsplat avatar Nov 07 '24 03:11 bjsplat

@sebavan @Popov72 Thank you for the review! I addressed the comments but still haven't got time to add the visualization test yet. Let's keep this PR in draft state?

chubei-urus avatar Nov 28 '24 02:11 chubei-urus

Yes, we can keep the PR in draft until you add a proper visu test.

Popov72 avatar Nov 28 '24 10:11 Popov72

@chubei-urus Do you think you can add the visualization test, as we are waiting for this PR to be merged so we can make another one related to morph targets? Thanks in advance.

Popov72 avatar Dec 09 '24 10:12 Popov72

Thanks for the heads up. I'll try to do that within this week.

chubei-urus avatar Dec 09 '24 10:12 chubei-urus

I think I hit an existing bug that's blocking me from adding the vis test. See https://forum.babylonjs.com/t/uv-morphing-results-in-two-textures-of-different-types-use-the-same-sampler-location/55346

chubei-urus avatar Dec 13 '24 04:12 chubei-urus

Hi @Popov72, I added the test model in https://github.com/BabylonJS/Assets/pull/86. Will update this PR after it's merged.

chubei-urus avatar Dec 16 '24 16:12 chubei-urus