Vertex Animation Textures

It won’t work because the texture has float components and .png files only use 8-bits per component: the file saved by the inspector is only an approximation of the real texture.

You will need to save yourself the instancedBaker.rawPixels data (as well as the instancedBaker.imageWidth and instancedBaker.imageHeight values) in a custom file, making sure to save floats. Then you can reload it and use the same call to recreate the texture:

const boneTexture = BABYLON.RawTexture.CreateRGBATexture(savedPixels, savedWidth, 
  savedHeight, scene, false, false, BABYLON.Texture.NEAREST_NEAREST, 
  BABYLON.Constants.TEXTURETYPE_FLOAT);

Note that Texture won’t let you create textures with float components, you must use a raw texture for that.

3 Likes

You’ll need a format that supports full-float or half-float precision. EXR supports both 32bit and 16bit, but you’ll need an encoder/importer/exporter. The way I use the created texture is simply to serialize it to json and load it that way, like mentioned above.

4 Likes