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

GLTFExporter: Add support for 4 UV channels. #26909

Merged
merged 1 commit into from Oct 7, 2023

Conversation

bhouston
Copy link
Contributor

@bhouston bhouston commented Oct 7, 2023

Description

Three.js now supports multiple UV channels per mesh, up to 4:

const HAS_ATTRIBUTE_UV1 = !! geometry.attributes.uv1;
const HAS_ATTRIBUTE_UV2 = !! geometry.attributes.uv2;
const HAS_ATTRIBUTE_UV3 = !! geometry.attributes.uv3;

parameters.vertexUv1s ? '#define USE_UV1' : '',
parameters.vertexUv2s ? '#define USE_UV2' : '',
parameters.vertexUv3s ? '#define USE_UV3' : '',

The GLTFImporter supports 4 channels per mesh of UVs:

https://github.com/mrdoob/three.js/blob/dev/examples/jsm/loaders/GLTFLoader.js#L2116-L2118

But the GLTFExporter only support 2 channels per mesh:

uv: 'TEXCOORD_0',
uv1: 'TEXCOORD_1',
color: 'COLOR_0',
skinWeight: 'WEIGHTS_0',

This PR fixes that discrepancy.

This contribution is funded by Threekit

@mrdoob mrdoob added this to the r158 milestone Oct 7, 2023
@mrdoob mrdoob merged commit af8349b into mrdoob:dev Oct 7, 2023
18 checks passed
@Mugen87 Mugen87 changed the title add support for 4 UV channels in GLTFExporter, to match GLTFImporter. GLTFExporter: Add support for 4 UV channels. Oct 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants