GithubHelp home page GithubHelp logo

Comments (11)

PoignardAzur avatar PoignardAzur commented on August 22, 2024 1

I assume that this also applies to drawing any custom scene with vello?

You can do so with a custom widget, eg any type implementing the Widget trait. Basically you choose what to paint in your paint() method, and Vello works its magic with the Scene you built.

(Yes, there talks of limiting custom widgets, but people were a lot more opposed to the idea than I assumed.)

Directly using wgpu APIs is another beast, though. I haven't sketched up a design, but I think it would require us to hook into the compositor and handle composition layers; there would be many good reasons to do that (performance, power efficiency, the embedded video use-case), but it's not on our immediate roadmap.

from xilem.

PoignardAzur avatar PoignardAzur commented on August 22, 2024

Something like the canvas element in web browsers?

from xilem.

AdrianEddy avatar AdrianEddy commented on August 22, 2024

yes, something like canvas, I'm also interested in this feature. For example to create a video player, we'd need a widget that we can draw anything on (in this case pixels of the video), or a widget where we can draw some 3D scene with wgpu, etc

from xilem.

DJMcNab avatar DJMcNab commented on August 22, 2024

Conceptually, this isn't too difficult, because Vello does support using images.
There are however a few challenges:

  1. Knowing when to redraw the scene/getting control into your draw function, ideally without losing all power efficiency
  2. Wiring up support for wgpu Textures into Vello - currently I think its API only supports images with provided data, as far as I know. I don't think there's anything conceptually challenging for this.

Another note:

For example to create a video player

So yes, this widget could be used to support a video player. However, the "correct" way to create a video player is to connect with the compositor (see #xilem>Compositor).

Overall, I'd encourage contributions towards this direction, but I can't prioritise working on this myself.

from xilem.

PoignardAzur avatar PoignardAzur commented on August 22, 2024

Same. The concept is interesting, but it's going to be pretty low on the priority list this year. Next year may be different.

from xilem.

AdrianEddy avatar AdrianEddy commented on August 22, 2024

I assume that this also applies to drawing any custom scene with vello? Eg. if I want to draw a chart

from xilem.

gfxenjoyer avatar gfxenjoyer commented on August 22, 2024

Raph mentioned two-way interoperability with bevy in his RustLab Vello talk. My goal is to make a Xilem app that can embed various small bevy applets for 3D features. I'm curious if using the compositor would still be the best practice for embedding a bevy scene?

Also, Iced has a widget that exposes a wgpu texture called shader (example).

from xilem.

PoignardAzur avatar PoignardAzur commented on August 22, 2024

Raph mentioned two-way interoperability with bevy in his RustLab Vello talk. My goal is to make a Xilem app that can embed various small bevy applets for 3D features. I'm curious if using the compositor would still be the best practice for embedding a bevy scene?

Probably.

Other options are:

  • Rendering to a texture, reading that texture back to CPU memory, and using it as an image widget (horribly inefficient).
  • Rendering the Bevy side to a GPU texture and doing some winit manipulations to render that texture inside the Xilem render, at which point we're pretty close to using the compositor, I think. (Don't quote me on this.)

Also, Iced has a widget that exposes a wgpu texture called shader (example).

Interesting. I'll look into it.

from xilem.

DJMcNab avatar DJMcNab commented on August 22, 2024

Rendering the Bevy side to a GPU texture and doing some winit manipulations to render that texture inside the Xilem render, at which point we're pretty close to using the compositor, I think. (Don't quote me on this.)

I don't see why you have to go from one extreme to directly using the compositor? I really don't understand the aversion to passing the wgpu Texture produced from the Bevy render to Vello, for it to render.
Now obviously, using the compositor would be better, but that's a lot of work. But with the upcoming pass order work, I hope we can make these mostly orthogonal.

The main challenge here is scheduling when your Bevy widget gets control, as well as exposing the right APIs on the Vello side for using wgpu textures in a render.

from xilem.

PoignardAzur avatar PoignardAzur commented on August 22, 2024

Sure. I'm unfamiliar with GPU rendering, so I might just be overestimating how hard this is to do.

from xilem.

AdrianEddy avatar AdrianEddy commented on August 22, 2024

As for the "scheduling when your Bevy widget gets control" question, Qt has beforeRendering signal & friends, they are pretty nice, may give you some ideas: https://doc.qt.io/qt-6/qquickwindow.html#integration-with-accelerated-3d-graphics-apis

from xilem.

Related Issues (20)

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.