-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Setting a Negative Scale for a Sprite Makes it Invisible #1385
Comments
I think backface culling is enabled. |
Ah, that would make sense. It looks like |
I think that this may be a regression from 81809c7. I am seeing the same behavior with what I believe was the "official way" to flip a sprite (rotating 180 deg over y) after that commit. |
It looks like sprites lost their |
I am just about to start tryout out a |
I tested out giving |
I think under the hood our options are:
I think (1) is the easiest fix and preferable in the short term. (2) reduces our ability to batch draws (as we need to rebind the mesh). (3) might be good, but would require more investigation. I'd rather tackle that question when we implement batching. (4) is a complete non-starter. |
Just merged #1399. I'll close this for now, but feel free to keep discussing impls here if you're interested. |
I've flipped textures trivially in my tile map renderer by flipping the UV. That way it doesn't have to change the geometry at all, and all the logic goes in the fragment shader. I think that would be easily possible here, too. I think I'll get a chance to try that out tomorrow. |
Ah yeah thats definitely an important one to call out. When drawing a single image, you can just negate the x or y value and (provided the sampler repeats), it will flip. However for sprite sheets things get a little more interesting. Wouldn't you'd need to pass in additional information to the shader (current sprite dimensions and start point) to do the flip? That would be more expensive and less batchable. |
Bevy version
4796ea8
Operating system & version
Pop!_OS ( Ubuntu ) 20.04
What you did
Spawn a sprite in a Bevy game with an X scale of
-1.0
:What you expected to happen
The sprite should be displayed flipped along the X axis. At least that is the behavior I observed recently. The most recent commit I know of exhibiting the flipped behavior is bff44f7. Maybe it is not intended behavior to flip sprites by setting a negative scale?
What actually happened
The sprite was completely invisible.
The text was updated successfully, but these errors were encountered: