Defold roadmap H1-2019

Yeah, there have been many moments when I needed localized UV space. I would just send the center of the sprite as a uniform and compare the vertex positions with that to determine which corner is which.

@jhonny.goransson You don’t need all that information. Just a vertex attribute that is (0,0) in the bottom-left corner of the sprite and (1,1) in the top-right corner of the sprite, regardless of the actual UV coordinates in the atlas. The rest can be inferred from these values, if needed.

Usage example: Masking or gradient-ing a texture for a HP bar

2 Likes

Yeah, you’re right, you wouldn’t use those coordinates to sample the texture anyway.

I think, what we’d really like (and we’re also getting closer to) is custom vertex formats.
I think it’s better we work towards that, instead of adding another specialised solution?

We’d have to discuss it of course, maybe the two features doesn’t collide codewise, but we also have to consider our bandwidth.

4 Likes

I’ve been thinking… :thinking: Now that we have local vertex space support, you can get that number that I mentioned by dividing the vertex positions by the sprite’s size, then adding 0.5.

Worth mentioning is that local space is currently only available for models, iirc! (And it will break batching!) :wink:

1 Like