message: Fix material index lookup.
diff: @@ -94,14 +94,19 @@ const computeMaterialParams = `
  `;
  const getUniformMaterialParams = `vec3 getMaterialParams() { return u_materialParams; }`;
  +// The 8-bit material index is stored with the 24-bit feature index, in the high byte.
  +// ###TODO: This executes *before* g_featureIndexCoords is computed.
  +// ###TODO: Defer this, don't re-sample feature index if already sampled.
  const readMaterialAtlas = `
  void readMaterialAtlas() {
  - float materialIndex = floor(TEXTURE(u_vertLUT, g_featureIndexCoords) * 255.0 + 0.5).w;
  - materialIndex += u_numColors;
  + float materialAtlasStart = u_vertParams.z * u_vertParams.w + u_numColors;
  + vec2 tc = g_vertexBaseCoords;
  + tc.x += g_vert_stepX * 2.0;
  + float materialIndex = floor(TEXTURE(u_vertLUT, tc).w * 255.0 + 0.5);
  materialIndex *= 4.0;
  - materialIndex += u_vertParams.z * u_vertParams.w;
  + materialIndex += materialAtlasStart;
  - vec2 tc = computeLUTCoords(materialIndex, u_vertParams.xy, g_vert_center, 1.0);
  + tc = computeLUTCoords(materialIndex, u_vertParams.xy, g_vert_center, 1.0);
  vec4 rgba = TEXTURE(u_vertLUT, tc);
  tc = computeLUTCoords(materialIndex + 1.0, u_vertParams.xy, g_vert_center, 1.0);
  