Button to Upload Image to Scene Model

Hello all,
I’ve been working on a proof-of-concept demo. We want to add decals, logos, vinyl wraps to our van in as many ways as possible.
I’d like the user to be able to click the “Choose File” button, select and image from their machine, and upload it so it applies directly onto the van. Does anyone have any ideas how to achieve this? Here is a link to the van demo:

Van Demo

When you click the blue buttons, the “Acme” logos appear on a transparent material that’s hovering slightly above the van model. This material is named “Ghost”.

Thank you kindly,

You can use the File API.

Here’s a sample: How to open a local disk file with JavaScript? - Stack Overflow

Instead of readAsText, use readAsArrayBuffer. When creating the texture, pass this buffer in the appropriate parameter (8th parameter) of the constructor. Also, you will need to pass the corresponding mime type (10th parameter): image/png for png files, image/jpeg for jpeg etc.

1 Like

Great thank you! I will look into this today.
Thanks for your help!