#How can I use 2D sprites in a 3D world?
10 messages · Page 1 of 1 (latest)
You can spawn a plane with sprite as a texture
Maybe "Billboarding" is what you are looking for? This is when a 2d sprite in a 3d world always faces the camera. (Like the enemies in DOOM)
checkout
https://github.com/kulkalkul/bevy_mod_billboard it does sprites and text.
Also maybe this package -> https://github.com/FraserLee/bevy_sprite3d
Thank you both, gonna try the plane solution
Hey @vale shard im interested in this as well. Could you share what you tried and how it went? Id love to achieve this without a dependency, if possible.
Basic billboarding can be done with something like
let camera_transform = camera_query.single();
for mut billboard_transform in billboards.iter_mut() {
billboard_transform.rotation = camera_transform.rotation;
}
but performance is a concern, bevy_mod_billboard has shader work for this which I think helps if ur gonna have alot of this going on
Just noticed this. You should @ ppl next time, haha (but ty 🙂 ).
Yeah I see what ur doing here, but like, why is this not performant? ur just changing a single f32. Ur not even doing any math. I dont see how it can be faster lol. On second thought, I think shaders is a GPU thing so I suppose that makes sense. Doing this stuff a bunch of times is almost a waste of CPU resources, when u think about it. Although, if u were to do this in a more multithreaded way, I wonder if thats enough to eliminate the performance gap.
it just feels like shaders would be best if possible, I think things like particle systems usually get billboarded so, the marginal gains would add up when you have thousands of lil dots?
but yeh, doing it basic for just a few entities is probably fine.
(I have noticed threads getting lost, still learning the norms of this discord!)