Giter Site home page Giter Site logo

Comments (8)

EvanBacon avatar EvanBacon commented on May 4, 2024 2

Base64 is not supported in EXGL texture rendering at the moment. The ImagePicker returns a uri that is formatted differently than other things, this will be fixed with a new version of expo-asset-utils. This issue tracks that: expo/expo-asset-utils#1

from expo-three.

szymonkaliski avatar szymonkaliski commented on May 4, 2024

Great! Thanks so much :)

from expo-three.

cwervo avatar cwervo commented on May 4, 2024

expo/expo-asset-utils#1 has since been merged — any word on whether this works with the most up-to-date Expo @szymonkaliski ?

from expo-three.

EvanBacon avatar EvanBacon commented on May 4, 2024

@andrescuervo sorry, forgot to close. This works now.

from expo-three.

cwervo avatar cwervo commented on May 4, 2024

@EvanBacon Thanks for the quick response! Unfortunately I was asking because I can't get it to work.

A reduced test case for this:

const pickedImage = await Expo.ImagePicker.launchImageLibraryAsync({
    base64: true,
    allowsEditing: false
});

if (!pickedImage.cancelled) {
    const base64 = "data:image/jpeg;base64," + pickedImage.base64;
    const texture = THREE.ImageUtils.loadTexture(base64); // white mesh
    console.log("texture: ", texture);
    const geometry = new THREE.PlaneGeometry(0.1, 0.1);
    const material = new THREE.MeshLambertMaterial({
        map: texture // 1..5
    });

    const mesh = new THREE.Mesh(geometry, material);
    mesh.position.z = -0.1;
    scene.add(mesh);
}

And console.log("texture: ", texture); yields:

texture:  Object {
  "anisotropy": 1,
  "center": Array [
    0,
    0,
  ],
  "flipY": true,
  "magFilter": 1006,
  "mapping": 300,
  "metadata": Object {
    "generator": "Texture.toJSON",
    "type": "Texture",
    "version": 4.5,
  },
  "minFilter": 1008,
  "name": "",
  "offset": Array [
    0,
    0,
  ],
  "repeat": Array [
    1,
    1,
  ],
  "rotation": 0,
  "uuid": "99191947-F6BD-4B1F-A6D6-47C90347A0A1",
  "wrap": Array [
    1001,
    1001,
  ],
}

Any insight into what might be going wrong? Thanks!

from expo-three.

EvanBacon avatar EvanBacon commented on May 4, 2024

Sorry, I saw this issue as "get an image from camera roll to load". The problem you are experiencing is related to the fact that EXGL doesn't load base64 textures

from expo-three.

cwervo avatar cwervo commented on May 4, 2024

Gotcha - does this gesture work w/o base64 textures then? Loading via the uri strategy outlined above also yields a white texture, so I wouldn't consider this issue closed yet, right?

from expo-three.

EvanBacon avatar EvanBacon commented on May 4, 2024

I would just recommend not using Base64. It's really pricey to move over the bridge and there are ways to convert it to a localUri that would be just as expensive as incorporating it directly into the method. Let me know if I'm missing something here.

from expo-three.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.