Skip to content

Rendering Scenes, Text, SVGs and Lotties with bevy_ui coordinates and bevy_core_2d coordinates #135

Open
@RobertBrewitz

Description

@RobertBrewitz

There are a few cases that are not supported in the current extract/prepare/render "pipeline".

  1. Render VelloScenes/SVG/Lottie in bevy_ui coordinates without a bevy_ui Node component

Why is it needed? To render anything derived from transforms computed by bevy_ui, e.g. animating a VelloScene between two UI Nodes.

What is needed? A non-transposed ndc_to_pixel_matrix for VelloScene if it is supposed to render in bevy_ui coordinate space.

  1. Render VelloTextSection in "UI space" with a bevy_ui Node component

Why is it needed? To render text in and on bevy_ui Nodes

What is needed? If a VelloTextSection has a Node component it should not apply a "vello_matrix", simply:

            let transform: [f32; 16] = world_transform.compute_matrix().to_cols_array();

            // | a c e |
            // | b d f |
            // | 0 0 1 |
            let transform: [f64; 6] = [
                transform[0] as f64,  // a
                -transform[1] as f64, // b
                -transform[4] as f64, // c
                transform[5] as f64,  // d
                transform[12] as f64, // e
                transform[13] as f64, // f
            ];

How the component composition would be handled I am not sure, personally I am using two separate master vello scenes, one for "UI space" and one for "2d/world space" rendering and then have VelloUiText, VelloWorldText, VelloUiScene, VelloWorldScene, VelloUiSvg and VelloWorldSvg.

Visual example of what I mean, here I render a VelloScene and VelloSvg in UI space without a Node, based on transforms set by bevy_ui, I also render VelloTextSection based on bevy_ui calculated transforms.

Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions