Skip to content

[Fix] Change the default semantic to a different slot which does not map to tangents #7849

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

Merged
merged 1 commit into from
Jul 22, 2025

Conversation

mvaligursky
Copy link
Contributor

@mvaligursky mvaligursky commented Jul 22, 2025

Fixes #7824

use slot 11 (SEMANTIC_TEXCOORD6) instead of slot 13 (SEMANTIC_TANGENT), which is less likely to be used.

@mvaligursky mvaligursky self-assigned this Jul 22, 2025
@mvaligursky mvaligursky added bug area: graphics Graphics related issue labels Jul 22, 2025
@mvaligursky mvaligursky requested a review from a team July 22, 2025 15:30
@mvaligursky mvaligursky merged commit 2cc809e into main Jul 22, 2025
7 checks passed
@mvaligursky mvaligursky deleted the mv-instancing-semantic branch July 22, 2025 15:42
@MAG-AdrianMeredith
Copy link
Contributor

Thanks Martin! (this came up today again, been playing with rendering the amazon lumberyard bistro)

@LeXXik
Copy link
Contributor

LeXXik commented Jul 23, 2025

If we use some of the slots for instancing, is there a way to tell which are used by the engine and which are free?

@mvaligursky
Copy link
Contributor Author

If we use some of the slots for instancing, is there a way to tell which are used by the engine and which are free?

These are the default attributes engine uses for standard material (not all of them all the time, depends on material / mesh properties):

const builtinAttributes = {
vertex_normal: SEMANTIC_NORMAL,
vertex_tangent: SEMANTIC_TANGENT,
vertex_texCoord0: SEMANTIC_TEXCOORD0,
vertex_texCoord1: SEMANTIC_TEXCOORD1,
vertex_color: SEMANTIC_COLOR,
vertex_boneWeights: SEMANTIC_BLENDWEIGHT,
vertex_boneIndices: SEMANTIC_BLENDINDICES
};

and you can see the fixed mapping of semantic names to slots here:

semanticToLocation[SEMANTIC_POSITION] = 0;
semanticToLocation[SEMANTIC_NORMAL] = 1;
semanticToLocation[SEMANTIC_BLENDWEIGHT] = 2;
semanticToLocation[SEMANTIC_BLENDINDICES] = 3;
semanticToLocation[SEMANTIC_COLOR] = 4;
semanticToLocation[SEMANTIC_TEXCOORD0] = 5;
semanticToLocation[SEMANTIC_TEXCOORD1] = 6;
semanticToLocation[SEMANTIC_TEXCOORD2] = 7;
semanticToLocation[SEMANTIC_TEXCOORD3] = 8;
semanticToLocation[SEMANTIC_TEXCOORD4] = 9;
semanticToLocation[SEMANTIC_TEXCOORD5] = 10;
semanticToLocation[SEMANTIC_TEXCOORD6] = 11;
semanticToLocation[SEMANTIC_TEXCOORD7] = 12;
semanticToLocation[SEMANTIC_TANGENT] = 13;
semanticToLocation[SEMANTIC_ATTR0] = 0;
semanticToLocation[SEMANTIC_ATTR1] = 1;
semanticToLocation[SEMANTIC_ATTR2] = 2;
semanticToLocation[SEMANTIC_ATTR3] = 3;
semanticToLocation[SEMANTIC_ATTR4] = 4;
semanticToLocation[SEMANTIC_ATTR5] = 5;
semanticToLocation[SEMANTIC_ATTR6] = 6;
semanticToLocation[SEMANTIC_ATTR7] = 7;
semanticToLocation[SEMANTIC_ATTR8] = 8;
semanticToLocation[SEMANTIC_ATTR9] = 9;
semanticToLocation[SEMANTIC_ATTR10] = 10;
semanticToLocation[SEMANTIC_ATTR11] = 11;
semanticToLocation[SEMANTIC_ATTR12] = 12;
semanticToLocation[SEMANTIC_ATTR13] = 13;
semanticToLocation[SEMANTIC_ATTR14] = 14;
semanticToLocation[SEMANTIC_ATTR15] = 15;

You could enable tracing for shader creation as well, and each created shader attributes it uses here:

attributes = new Map();

@LeXXik
Copy link
Contributor

LeXXik commented Jul 23, 2025

Great info, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: graphics Graphics related issue bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Error thrown when using GLTF file with TANGENT and EXT_gpu_mesh_instancing
4 participants