Giter VIP home page Giter VIP logo

bevy_mod_billboard's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

bevy_mod_billboard's Issues

Upstream into bevy

I (and other bevy developers) would love to have this functionality in bevy itself. If you're up to it, please do open a PR!

Text rendering is dramatically slower than equivalent billboard sprites

When experimenting with this crate for information visualization, I found that recomputing text was incredibly slow. Actually rendering it was fine, but changing it crashed my performance from 100 FPS to 10 FPS.

Swapping to icons (using this crate as well) in Leafwing-Studios/Emergence#756 resolved the performance problems completely.

A reader had a suggestion for better optimization:

[Is the gold standard not still to render the font to an atlas texture and draw with that?] ( https://elk.zone/tech.lgbt/@[email protected]/110259520099233824)

Use prelude module instead of reexposing

Even though basic, this is a breaking change from API standpoint (breaks imports). So I'll keep this around as a reminder until I implement it with another breaking change.

BillboardTextBundle crashes when sharing a font with bevy's TextBundle

when i used a BillboardTextBundle together with a bevy-builtin TextBundle i get :

thread 'Compute Task Pool (7)' panicked at 'wgpu error: Validation Error

Caused by:
    In Device::create_bind_group
      note: label = `ui_material_bind_group`
    texture usage is COPY_SRC | COPY_DST which does not contain required usage TEXTURE_BINDING

i can replicate this by adding the line :

commands.spawn(TextBundle::from_section("ui text", TextStyle { font: fira_sans_regular_handle.clone(), font_size: 60.0, color: Color::BLACK }));

to the text.rs example at the end of the setup function.

it only occurs when the TextStyle matches exactly on font and size (so my easy workaround for now is to use a billboard font size that isn't used by my ui).

windows / nvidia / vulkan / bevy 0.10.1/ bevy_mod_billboard 0.3.0

thanks!

Rotating camera around y-axis causes unexpected behavior

Billboard textures seem to have weird behavior when the camera is rotated on the y-axis. The weirdness happens after a sprite is scaled. (Scaling translation.x when the bullet hits the hitbox)

Initialing camera with Y rotation

let mut camera_transform = Transform::from_translation(Vec3::new(3.3, 1.0, 9.5));
camera_transform.rotate_axis(Vec3::X, deg_to_rad(-45.0));
camera_transform.rotate_axis(Vec3::Y, deg_to_rad(-45.0));

// main camera
commands.spawn((
    Camera3dBundle {
        transform: camera_transform,
        projection: OrthographicProjection {
            far: 100.0,
            near: -100.0,
            // this is how far the camera is away from the focus
            scale: 6.0,
            scaling_mode: ScalingMode::FixedVertical(2.0),
            ..default()
        }.into(),
        ..default()
    },
    MainCamera,
));

Spawning Billboard Sprite

commands
    .spawn(BillboardTextureBundle {
        texture: BillboardTextureHandle(scene_assets.health_bar.clone()),
        mesh: BillboardMeshHandle(meshes.add(Quad::new(value_shape_size * 2.0).into())),
        transform: Transform::from_xyz(0.0, npc_info.info.height / 2., 0.0),
        ..default()
    })
    .insert(HealthBar)
    .insert(NpcIdentification {
        id: npc_info.identification.id.clone(),
    })
    .id();

Weird behavior (video)

bad.mp4

Feature request: Possibility for interaction

I need a possibility to track hover and press events on a billboard.

I tried to achieve it using bevy_mod_picking crate and exposing the meshes like this:

fn add_billboard_mesh(
    mut commands: Commands,
    billboards: Query<(Entity, &BillboardMeshHandle), Added<BillboardMeshHandle>>,
) {
    for (entity, mesh_handle) in billboards.iter() {
        let handle = mesh_handle.0.clone();
        commands.entity(entity).insert(handle);
    }
}

but meshes from BillboardMeshHandle are positioned on screen differently from where the billboard would be rendered, and raycasting triggers in a wrong screen area:

image

Texture Atlas and Sprite sheet Billboarding

Hello!

Expected

I would like to know if there is a way to do sprite animation on billboarded texture or if it's not possible at the moment.

What you did

let layout = TextureAtlas::from_grid(
     goblin_sheet.clone(),
     Vec2::new(33., 36.),
     4,
     1,
     None,
     None,
);

let atlas_handle = texture_atlases.add(layout);
let sprite = TextureAtlasSprite::new(0);

commands.spawn(monster_bundle).with_children(|b| {
     b.spawn(BillboardTextureBundle {
          transform: Transform::from_translation(Vec3::Y * 2.),
          texture: BillboardTextureHandle(goblin_sheet.clone()),
          mesh: BillboardMeshHandle(
                meshes.add(shape::Quad::new(Vec2::new(2., 2.)).into()),
          ),
          ..default()
     })
     .insert((sprite, atlas_handle));
 });

What went wrong

If I understand correctly, the crate is only for Texture and not for Sprite so the above code only render the whole atlas instead of the cropped sprite.

Thanks for the hardwork!

Memory leak

When working on Leafwing-Studios/Emergence#613, I encountered a memory leak, which ultimately led to a panic due to my GPU running out of memory.

This was the commit in question: Leafwing-Studios/Emergence@0f60c50

Here's what my system monitor looked like, before and after toggling on the billboarded text via the F2 key.

image

The drop is when the game crashed ๐Ÿ˜…

I'm using this in a simple immediate mode way for now, as seen here, but I am being careful to reuse assets and despawn my entities each frame.

Billboards no longer spawn with transform of parent entity

Hi,
Has there been some change to the way billboards are spawned and their translation is set? It used to be that if you do commands.entity(parent_entity).push_children(&[billboard_entity]) the billboard transform would be the same as that of the parent object, i.e. if you gave it a translation, that would be relative to the parent. But what I see now is that the child billboard spawns at 0/0/0 world coordinates and is no longer following the parent.

Is that on purpose or an unintentional change?

bevy 0.10 support

This requires changes on text mesh building logic because of the changes to the bevy (mainly Anchor component). I'll tackle this same time I upgrade my own game into 0.10, which is blocked by some crates I use right now.

Converting from Handle<Image> requires duplicate asset tracking

I want to reuse a png for both UI icons and a billboarded status display. Because this plugin requires Handle<BillBoardTexture> rather than a Handle<Image>, I have to store two separate collections.

Options:

  1. Just use Handle<Image> everywhere (and do the same for Mesh).
  2. impl From<Handle<Image>> for Handle<BillboardTexture>

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.