Is CesiumAir's texcoord correct?

Hi everyone.

I tried CesiumAir glTF model using my WebGL library.

But, I found a little bit strange part in texcoord.

“Geometry-mesh090”: {

“name”: “Cesium_Air”,

“primitives”: [

{

“attributes”: {

“NORMAL”: “accessor_33”,

“POSITION”: “accessor_31”,

“TEXCOORD_0”: “accessor_35”

},

“indices”: “accessor_29”,

“material”: “Effect-cesium_air”,

“mode”: 4

}

]

}

``

“accessor_35”: {

“bufferView”: “bufferView_132”,

“byteOffset”: 60584,

“byteStride”: 6,

“componentType”: 5122, <---- why short?

“count”: 4180,

“max”: [

32733,

32733,

-32766

],

“min”: [

0,

0,

-32766

],

“type”: “VEC3” <----- why VEC3?

},

``

Finally, I succeeded displaying texture after tweaking my shader code as following.

varying vec3 texcoord;

gl_FragColor = texture2D(uTexture, texcoord.xy/32767.0);\n`;

``

But, I think this texcoord data is not proper.

Would you please check this thing?

The normals and texture coodinates are encoded to reduce the size of the model. If you look at the shader you'll see that it is decoded before doing the texture read.

Thank you for your advice.
I pretty much got it. but in the texcoord, why VEC3? I feel enough with VEC2 (Because This model uses 2D Texture).

The max and min of texcoord.z is -32766. What is the point of this?

Hi

Texture coordinates don't have to be between 0 and 1, which is why you can specify a texture wrap parameter. If you divide by z you'll get the actual texture coordinate.

--Tom

Thank you.

I wonder why wrap parameters have to be specified for each texcoord.z.
If texcoord is VEC2, and a wrap parameter is somewhere (probably under “accessor_35”), which is more compact.

The wrap parameter isn’t stored in z. The x and y values are scaled by z. 3 shorts take up less memory than 2 floats. It reduces memory usage by 25%.

Why does your loader care what the attributes are? It shouldn’t matter because the model contains the shaders that should be used to render.

The wrap parameter isn’t stored in z. The x and y values are scaled by z. 3 shorts take up less memory than 2 floats. It reduces memory usage by 25%.

I misunderstood and got it at last.

Thank you!