AVGP / three-software-renderer

Universal, in-memory Three.js renderer based on the original THREE.SoftwareRenderer
60 stars 16 forks source link

Texture with image #2

Closed atroy closed 8 years ago

atroy commented 8 years ago

First I want to say thanks, for this lib. I tried with a few samples and it worked well, but at the moment I stuck at adding/loading textures with images.

I know use DataTexture -> I did, but without succuess. To load the images I used the a custom loader with fs.readFileSync.

So at the moment the mesh loads fine, but without texture.

AVGP commented 8 years ago

Thanks for opening an issue!

I'm pretty swamped with work right now, but I'll do my best to come back to you with an answer as soon as possible, thanks for your patience!

atroy commented 8 years ago

Seems that I got a working solution. I used https://github.com/scijs/get-pixels to read the local image files and pushed this to a DataTexture.

suroots commented 7 years ago

@atroy Hey, I am stuck in the exact same place. Is there any way you could share your code on how you got it working?

AVGP commented 7 years ago

Here's an example on how to use PNG as a texture: https://github.com/AVGP/three-software-renderer/blob/master/example/texture.js

The trick is to use a library (here PNG.js) to parse the pixel data from the image file and then transform that into a UInt8Array to create a THREE.DataTexture.