I have a simple glTF model for testing UV2 morphing. When opening it with the sandbox, a morph target is created. When changing the target weight to anything but 0, a GL_INVALID_OPERATION is fired with the message “Two textures of different types use the same sampler location”, and the mesh cannot be rendered.
The test model can be found on GitHub chubei-urus/Assets/blob/uv2-morph/meshes/UV2Morph
. The forum won’t let me to post links.
With the current sandbox, the UV2 morphing would be ignored and the morph target would have no attribute. I’ve tried to change the morphed attribute from TEXCOORD_1 to TEXCOORD_0 so the morph target has one attribute, and the result is the same.
Attaching the Python script used to generate the buffer data here for easier debugging.
from PIL import Image
import numpy as np
import struct
gradient = np.zeros((256, 256, 3), dtype=np.uint8)
for i in range(256):
gradient[:, i, :] = i
Image.fromarray(gradient).save('gradient.png')
positions = [-0.5, -0.5, -1, 0.5, -0.5, -1, 0, 0.5, -1]
texcoords1 = [0, 0, 0, 0, 0, 0]
texcoords2 = [0, 0, 1, 0, 0.5, 0]
indices = [0, 1, 2]
texcoord_offsets = [1, 0, -1, 0, 0, 0]
positions = struct.pack(f'{len(positions)}f', *positions)
texcoords1 = struct.pack(f'{len(texcoords1)}f', *texcoords1)
texcoords2 = struct.pack(f'{len(texcoords2)}f', *texcoords2)
indices = struct.pack(f'{len(indices)}I', *indices)
texcoord_offsets = struct.pack(f'{len(texcoord_offsets)}f', *texcoord_offsets)
with open('uv2.bin', 'wb') as f:
f.write(positions + texcoords1 + texcoords2 + indices + texcoord_offsets)