{"repo":"gsimone/diet-sprite","free":true,"listed":false,"github":"https://github.com/gsimone/diet-sprite","clone":"git clone https://github.com/gsimone/diet-sprite.git","description":"🥤 Max Taste, Min Waste. Generate tight geometries around sprites and flipbooks 🫧","language":"TypeScript","stars":28,"topics":["2d","gamedev","sprites","threejs"],"license":"MIT","category":"game-templates","readme_excerpt":"🧋 A utility toolkit to reduce overdraw when drawing transparent textures & flipbooks in Three.js Features - Given a simple transparent image and an alpha threshold, generates a tight mesh around the non-transparent pixels. Depending on how big the texture is being drawn on screen, this will result in notable performance gains. - For flipbooks or atlases you can generate the geometry for every step and consume it as a vertex attribute - TBD - or a data texture. Usage 🥤 Single Sprite The geometry can be easily generated at runtime from an image: Note: - 📐 This version doesn't need a specific material since the geometry includes every necessary attribute. - 💡 The utility is fast enough that you can use it at runtime for most purposes. Consider generating the geometry offline for intensive usage - eg. big images, large quantities of sprites, etc. 💥 Flipbook (WIP) The flipbook version is a bit more complex. Since we are dealing with a larger number of sprites, we need to generate valid positions for each step in the flipbook. The data is then fed to a data texture of size [number of vertices, number of flipbook steps] and can be used in the vertex shader using gl vertexID to draw the sprites. Alternatively, the vertex positions can be generated as an array of vertices and consumed as a vertex attribute. Note that the generated geometry only holds the correct amount of vertices and the necessary index. TODO - [ ] Contain mode: This would be useful for those cases where you mig","default_branch":null,"files":null,"tree":[],"storefront":"/r/gsimone","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/gsimone/diet-sprite/request-supported","requests":0},"note":"indexed from public GitHub; nothing is for sale on this page. Clone it from GitHub. Paid listings live at /search."}