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

Move Msaa to a component, instead of a resource #7194

Closed
JMS55 opened this issue Jan 14, 2023 · 6 comments · Fixed by #14273
Closed

Move Msaa to a component, instead of a resource #7194

JMS55 opened this issue Jan 14, 2023 · 6 comments · Fixed by #14273
Labels
A-Rendering Drawing game state to the screen C-Usability A targeted quality-of-life change that makes Bevy easier to use

Comments

@JMS55
Copy link
Contributor

JMS55 commented Jan 14, 2023

No description provided.

@JMS55 JMS55 added C-Feature A new feature, making something new possible S-Needs-Triage This issue needs to be labelled labels Jan 14, 2023
@alice-i-cecile alice-i-cecile added A-Rendering Drawing game state to the screen C-Usability A targeted quality-of-life change that makes Bevy easier to use and removed S-Needs-Triage This issue needs to be labelled C-Feature A new feature, making something new possible labels Jan 14, 2023
@alice-i-cecile
Copy link
Member

I take it this should be a component on individual cameras?

@JMS55
Copy link
Contributor Author

JMS55 commented Jan 14, 2023

Yes, aligning with how all the other rendering stuff is now per-camera.

@mockersf
Copy link
Member

from #7215, msaa configuration should not be on the camera but on the window

@Aceeri
Copy link
Member

Aceeri commented Jan 19, 2023

Also ideally it shouldn't be another component, but just added to the Window component here:

pub struct Window {
/// The cursor of this window.
pub cursor: Cursor,
/// What presentation mode to give the window.
pub present_mode: PresentMode,
/// Which fullscreen or windowing mode should be used?
pub mode: WindowMode,
/// Where the window should be placed.
pub position: WindowPosition,
/// What resolution the window should have.
pub resolution: WindowResolution,
/// Stores the title of the window.
pub title: String,
/// How the alpha channel of textures should be handled while compositing.
pub composite_alpha_mode: CompositeAlphaMode,
/// Which size limits to give the window.
pub resize_constraints: WindowResizeConstraints,
/// Should the window be resizable?
///
/// Note: This does not stop the program from fullscreening/setting
/// the size programmatically.
pub resizable: bool,
/// Should the window have decorations enabled?
///
/// (Decorations are the minimize, maximize, and close buttons on desktop apps)
///
// ## Platform-specific
//
// **`iOS`**, **`Android`**, and the **`Web`** do not have decorations.
pub decorations: bool,
/// Should the window be transparent?
///
/// Defines whether the background of the window should be transparent.
///
/// ## Platform-specific
/// - iOS / Android / Web: Unsupported.
/// - macOS X: Not working as expected.
/// - Windows 11: Not working as expected
/// macOS X transparent works with winit out of the box, so this issue might be related to: <https://github.com/gfx-rs/wgpu/issues/687>
/// Windows 11 is related to <https://github.com/rust-windowing/winit/issues/2082>
pub transparent: bool,
/// Should the window start focused?
pub focused: bool,
/// Should the window always be on top of other windows?
///
/// ## Platform-specific
///
/// - iOS / Android / Web / Wayland: Unsupported.
pub always_on_top: bool,
/// The "html canvas" element selector.
///
/// If set, this selector will be used to find a matching html canvas element,
/// rather than creating a new one.
/// Uses the [CSS selector format](https://developer.mozilla.org/en-US/docs/Web/API/Document/querySelector).
///
/// This value has no effect on non-web platforms.
pub canvas: Option<String>,
/// Whether or not to fit the canvas element's size to its parent element's size.
///
/// **Warning**: this will not behave as expected for parents that set their size according to the size of their
/// children. This creates a "feedback loop" that will result in the canvas growing on each resize. When using this
/// feature, ensure the parent's size is not affected by its children.
///
/// This value has no effect on non-web platforms.
pub fit_canvas_to_parent: bool,
/// Stores internal state that isn't directly accessible.
pub internal: InternalWindowState,
}

@alice-i-cecile alice-i-cecile removed the D-Trivial Nice and easy! A great choice to get started with Bevy label Jan 19, 2023
@lain-dono
Copy link
Contributor

A real world example where MSAA can be used in the camera, but not in the whole window:

ss_8945ebb46c719d5f8377bfea5b0ec572c9231b33 1920x1080

The portraits at the top left are a separate realtime scene. Sometimes you may want a better quality for them than the world map.

Using separate MSAA settings for each camera makes it easier to reimplement something like this in bevy.

@alice-i-cecile
Copy link
Member

@JMS55 can you polish up the description and migration guide for this?

tychedelia added a commit to tychedelia/bevy that referenced this issue Jul 10, 2024
Switches `Msaa` from being a globally configured resource to a per camera view
component.

Closes bevyengine#7194
github-merge-queue bot pushed a commit that referenced this issue Jul 22, 2024
Switches `Msaa` from being a globally configured resource to a per
camera view component.

Closes #7194

# Objective

Allow individual views to describe their own MSAA settings. For example,
when rendering to different windows or to different parts of the same
view.

## Solution

Make `Msaa` a component that is required on all camera bundles.

## Testing

Ran a variety of examples to ensure that nothing broke.

TODO:
- [ ] Make sure android still works per previous comment in
`extract_windows`.

---

## Migration Guide

`Msaa` is no longer configured as a global resource, and should be
specified on each spawned camera if a non-default setting is desired.

---------

Co-authored-by: Alice Cecile <[email protected]>
Co-authored-by: François Mockers <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Rendering Drawing game state to the screen C-Usability A targeted quality-of-life change that makes Bevy easier to use
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants