firtoz / react-three-renderer

Render into a three.js canvas using React.
https://toxicfork.github.com/react-three-renderer-example/
MIT License
1.49k stars 155 forks source link

Example for Sprite #216

Open nickpolet opened 6 years ago

nickpolet commented 6 years ago

Hey,

I don't really like using this place for help and not bugs etc... but I'm really struggling get a sprite to display. Does someone have an example of working with a simple sprite?

Currently I have something similar to:

<sprite visible={true} position={new THREE.Vector3(0, 0, 0)} key={"sprite_" + index}>
    <spriteMaterial side={THREE.DoubleSide} color={0xffffff}>
        <texture url={element.image} />
    </spriteMaterial>
</sprite>

I don't get any errors, but the sprite doesn't appear at all. The url is a valid url and works fine on a meshBasicMaterial on a plane.

Any help would be great.

------- EDIT -------

I get an error in chrome console that mentions:

THREE.WebGLRenderer: Texture marked for update but image is incomplete

image

Not sure if that is related at all?

supromikali commented 5 years ago

There is an example of sprite use with react-three-renderer in this stackoverflow question, maybe it could be helpful somehow

https://stackoverflow.com/questions/39236107/sprite-labels-with-react-three-renderer-mvce-included