Skip to content

Instantly share code, notes, and snippets.

@emilio-martinez
Created November 20, 2017 08:57
Show Gist options
  • Save emilio-martinez/d293ad7e6794cd2c954ee3c414e90173 to your computer and use it in GitHub Desktop.
Save emilio-martinez/d293ad7e6794cd2c954ee3c414e90173 to your computer and use it in GitHub Desktop.
Base64 Image Data as Texture in ThreeJS
// Create an image
const image = new Image(); // or document.createElement('img' );
// Create texture
var texture = new THREE.Texture(image);
// On image load, update texture
image.onload = () => { texture.needsUpdate = true };
// Set image source
image.src = 'data:image/png;base64,XXXXX';
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment