kachamaka

ThreeJS Texture example

Nov 1st, 2021 (edited)
211
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. let image = 'some base64 string';
  2. //like
  3. //data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgAQMAAABJtOi3AAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAAEnQAABJ0Ad5mH3gAAAAGUExURcPDw/////joICQAAAASSURBVAjXY2AAgfr///8PTgIAnnZsBQ0uHE0AAAAASUVORK5CYII=
  4. let geometry = new THREE.SphereGeometry( 0.4, 32, 16 );
  5. let texture = new THREE.TextureLoader().load( image );
  6. let material = new THREE.MeshPhongMaterial({
  7.     map: texture,
  8. });
  9. let mesh = new THREE.Mesh( geometry, material );
Add Comment
Please, Sign In to add comment