Comments (11)
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.
Something like the canvas element in web browsers?
from xilem.
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.
Conceptually, this isn't too difficult, because Vello does support using images.
There are however a few challenges:
- Knowing when to redraw the scene/getting control into your draw function, ideally without losing all power efficiency
- Wiring up support for
wgpu
Texture
s 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.
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.
I assume that this also applies to drawing any custom scene with vello? Eg. if I want to draw a chart
from xilem.
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.
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.
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.
Sure. I'm unfamiliar with GPU rendering, so I might just be overestimating how hard this is to do.
from xilem.
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)
- Scale issue on iOS HOT 1
- Xilem's to_do_mvc enters an apparent infinite loop (depends on specifics of IME, blocked on rework of pass order) HOT 6
- xilem_web: Setting fill color on SVG stroke fails to compile HOT 4
- Fix / remove warnings in Masonry documentation HOT 1
- Calculator example: jumpy relayout and panic when changing window size on macOS HOT 8
- xilem_web: Error running `counter` example: Unable to preventDefault inside passive event listener inovcation HOT 2
- xilem_web: An example using AnyDomView would be super helpful HOT 6
- xilem_web: Is it possible for a update function to return two dom nodes without a parent contianer? HOT 9
- xilem_web: Should helper functions for known attributes be added to elements? HOT 1
- Consider renaming `app_logic` to something else HOT 2
- xilem_web: Possible bug when using `.boxed` and changing type of HTML node HOT 2
- masonry: support for PinchGesture input events HOT 1
- Masonry unit tests fail in release mode HOT 3
- Regression in calc example HOT 2
- Run doctests in CI HOT 2
- Automating screenshots for documentation HOT 3
- Text selection panics in edge cases HOT 1
- xilem_web: iframe `src` attribute not set after update HOT 2
- xilem_web: Testing HOT 1
- Reserve scene at the beginning of the paint pass HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
š Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ā¤ļø Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from xilem.