Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rendering to a surface and transparency #549

Open
waywardmonkeys opened this issue Apr 12, 2024 · 2 comments
Open

Rendering to a surface and transparency #549

waywardmonkeys opened this issue Apr 12, 2024 · 2 comments

Comments

@waywardmonkeys
Copy link
Contributor

It would be nice if the render_to_surface function would respect a transparent base_color and then show whatever is already rendered to the surface.

The main issue here is that BlendState::ALPHA_BLENDING would need to be set in the ColorTargetState in the BlitPipeline, but that's set for the Renderer and the background color is set in the RenderParams which is passed at each invocation of render_to_surface.

This also demonstrates that Renderer should perhaps be two different types, with a SurfaceRendener wrapping Renderer and storing the BlitPipeline and TargetTexture members, since they aren't used when rendering to a texture.

There are other issues with the current code, like if you're rendering to multiple surfaces and they're different sizes, then you'd be constantly creating and re-creating the TargetTexture.

Alternatively, maybe the render_to_surface should just be somewhere else and not part of the core library ...

@waywardmonkeys
Copy link
Contributor Author

This would also impact using xilem in the current form if you have other content behind the UI (like a 3D application or game).

@waywardmonkeys waywardmonkeys added this to the Vello 0.2 release milestone May 3, 2024
@waywardmonkeys waywardmonkeys removed this from the Vello 0.2 release milestone May 14, 2024
@cfagot
Copy link
Contributor

cfagot commented Jul 2, 2024

I've been playing with integrating xilem rendering with the rest of my rendering pipeline. What I'm finding is that, as you suggest, render_to_surface isn't that useful outside of vello only rendering.

Instead I'm using render_to_texture and after making a couple things in vello public (BlitPipeline and TextureTarget) and adding a couple tweaks (blend mode added to the blit pipeline being key) it integrates pretty cleanly with a standard wgpu pipeline, either as a new render pass or embedded within another render pass.

@waywardmonkeys waywardmonkeys added this to the Vello 0.3 release milestone Aug 1, 2024
@waywardmonkeys waywardmonkeys removed this from the Vello 0.3 release milestone Sep 20, 2024
@DJMcNab DJMcNab added this to the Vello 0.4 Release milestone Oct 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants