create texture from camera roll dynamically
See original GitHub issueNot sure how to approach this, tried:
const pickedImage = await ImagePicker.launchImageLibraryAsync({
base64: true,
allowsEditing: false
});
if (pickedImage.cancelled) { return; }
const base64 = "data:image/jpeg;base64," + pickedImage.base64;
const uri = pickedImage.uri.replace("file://", "");
const file = pickedImage.uri;
const texture1 = await ExpoTHREE.createTextureAsync(base64); // error
const texture2 = await ExpoTHREE.createTextureAsync(uri); // error
const texture3 = await ExpoTHREE.createTextureAsync(file); // error
const texture4 = THREE.ImageUtils.loadTexture(base64); // white mesh
const texture5 = THREE.ImageUtils.loadTexture(uri); // white mesh
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;
this.scene.add(mesh);
Nothing seems to work 😃
Issue Analytics
- State:
- Created 6 years ago
- Comments:8 (4 by maintainers)
Top Results From Across the Web
Create Texture Dynamically From Camera View... Possible?
I want to map what a camera in my scene is seeing onto the surface of an object that my main camera is...
Read more >How To Create Dynamic Textures with CCRenderTexture in ...
Learn how to create dynamic textures similar to the hills in Tiny Wings using CCRenderTexture in this Cocos2D 2.X Tutorial.
Read more >Creating RenderTexture at runtime
Hi all, I'm testing a 360° screen view with 10 cameras. All cams are build from one with 'Instantiate' function and it works...
Read more >Gallery Texture and Gallery Picker - Spark AR
The gallery picker lets people add an image from their phone's camera roll to an effect, like a green screen. To create an...
Read more >UE4 Material Tricks you didn't know - YouTube
I had an issue on the Face Camera part that I've already figured out ... UV Clamping 0:17:26 - Texture Projection - Screen...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
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 ofexpo-asset-utils
. This issue tracks that: https://github.com/expo/expo-asset-utils/issues/1I 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.