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

Ability to draw meshes in 2d with the new renderer #3326

Closed
Ixentus opened this issue Dec 14, 2021 · 5 comments
Closed

Ability to draw meshes in 2d with the new renderer #3326

Ixentus opened this issue Dec 14, 2021 · 5 comments
Labels
A-Rendering Drawing game state to the screen C-Feature A new feature, making something new possible P-Regression Functionality that used to work but no longer does. Add a test for this!
Milestone

Comments

@Ixentus
Copy link
Contributor

Ixentus commented Dec 14, 2021

What problem does this solve or what need does it fill?

Using the old renderer it was possible to draw shapes using meshes with SpriteBundles. However with the new renderer SpriteBundles no longer have Meshes and Materials. I've tried to convert them to PbrBundles instead, but nothing gets drawn. This might be because there is no lighting. François said on Discord that custom meshes in 2d are not supported by default anymore.

What solution would you like?

I'm not sure what the best solution to fix this would be since I'm very new to rendering, but one of the following might do:

  • Automatic lighting for 2d
  • A new bundle for 2d meshes
  • A modified pipeline for 2d

Additional context

Alternative ways to draw custom shapes also exist. However both bevy_lyon and bevy_svg also use meshes in their implementations and haven't been updated yet.

@Ixentus Ixentus added C-Feature A new feature, making something new possible S-Needs-Triage This issue needs to be labelled labels Dec 14, 2021
@Nilirad
Copy link
Contributor

Nilirad commented Dec 14, 2021

It may be possible that you don't see nothing because of backface culling. In PBR pipeline, the vertex order for a front face is counterclockwise. If you draw shapes clockwise (e.g. using Lyon) you won't see nothing despite the data being present in the GPU.

@Ixentus
Copy link
Contributor Author

Ixentus commented Dec 14, 2021

It may be possible that you don't see nothing because of backface culling. In PBR pipeline, the vertex order for a front face is counterclockwise. If you draw shapes clockwise (e.g. using Lyon) you won't see nothing despite the data being present in the GPU.

I tried flipping a mesh a 180 degrees around X, no effect.

@Weasy666
Copy link
Contributor

PbrBundles only work with a 3D camera, because a Mesh only registers a draw function to DrawFunctions<Transparent3d>. At least that is what i have seen so far.

@alice-i-cecile alice-i-cecile added P-Regression Functionality that used to work but no longer does. Add a test for this! A-Rendering Drawing game state to the screen and removed S-Needs-Triage This issue needs to be labelled labels Dec 14, 2021
@cart
Copy link
Member

cart commented Dec 14, 2021

I think a new Mesh2dBundle is probably the move here. The biggest challenge will be ensuring that it interacts with sprite batches properly (which in practice just means that we need to split sprite batches at the z-index of every non-batched 2d entity ... shouldn't be too hard).

@cart
Copy link
Member

cart commented Jan 8, 2022

Fixed by #3460

@cart cart closed this as completed Jan 8, 2022
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-Feature A new feature, making something new possible P-Regression Functionality that used to work but no longer does. Add a test for this!
Projects
None yet
Development

No branches or pull requests

5 participants