I’m trying to create a sprite atlas from a set of meshes in a scene. The plane shows what looks like a row of two tiles (what we expect), but they are blank. My first thought was that the sprite_cam position is wrong, or the image doesn’t fill up the whole scene. But no matter what camera positions and distances I try, the render target texture still only captures the scene clear color. What am I doing wrong?
Yup, right about both! I was adding the mesh to the render list at one point, but somehow I managed to delete it. Interestingly, that empty render list caused the RTT to always report it was ready for rendering, so I didn’t bother to handle the failure case.
Now I just have to figure out why the sprites are upside down, but that’s a different issue. Thanks!
That flips the whole image, reversing the order of rows. Instead, I need to flip each tile.
I just learned that Textures store data upside down. This can be disabled by setting the invertY arg in the constructor, which produces the same effect as setting vScale to -1.
But I’m not un-inverting, yet the tiles appear in the correct place, i.e. 0,0 places the first tile at the top. So… this means the pixel data is the right side up, but the texture coordinate system is inverted.
This uninverts the atlas texture, and the rendering loop draws the tiles in “reverse” vertical order compensate. Hope this makes sense.
Also, the atlas was too dark, so I switched to emissiveTexture, and disabled lighting.