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

Wireframe for 2D meshes #5881

Closed
wrnrlr opened this issue Sep 4, 2022 · 1 comment · Fixed by #12135
Closed

Wireframe for 2D meshes #5881

wrnrlr opened this issue Sep 4, 2022 · 1 comment · Fixed by #12135
Labels
A-Rendering Drawing game state to the screen C-Enhancement A new feature

Comments

@wrnrlr
Copy link

wrnrlr commented Sep 4, 2022

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

It could be useful to debug the mesh generation for 2D objects.

What solution would you like?

Support the same interface as 3D.

What alternative(s) have you considered?

Just draw the triangles yourself with bevy_prototype_lyon or some other vector framework.

Additional context

I've been looking over the code of the wireframe plugin, and yolo replaced the Opaque3D with Transparent2d but that just crashes with a long error. My knowledge of the rendering framework is very limited so don't know what else to try.

@wrnrlr wrnrlr added C-Enhancement A new feature S-Needs-Triage This issue needs to be labelled labels Sep 4, 2022
@alice-i-cecile alice-i-cecile added A-Rendering Drawing game state to the screen and removed S-Needs-Triage This issue needs to be labelled labels Sep 8, 2022
@SludgePhD
Copy link
Contributor

I've had a working implementation of this since last year, here's a gist: https://gist.github.com/SludgePhD/e26753b9fbcb9b9d274f5dad3e3f662a

github-merge-queue bot pushed a commit that referenced this issue Nov 25, 2023
# Objective

It is currently impossible to control the relative ordering of two 2D
materials at the same depth. This is required to implement wireframes
for 2D meshes correctly
(#5881).

## Solution

Add a `Material2d::depth_bias` function that mirrors the existing 3D
`Material::depth_bias` function.

(this is pulled out of #10489)

---

## Changelog

### Added

- Added `Material2d::depth_bias`

## Migration Guide

`PreparedMaterial2d` has a new `depth_bias` field. A value of 0.0 can be
used to get the previous behavior.
github-merge-queue bot pushed a commit that referenced this issue Mar 29, 2024
# Objective

Wireframes are currently supported for 3D meshes using the
`WireframePlugin` in `bevy_pbr`. This PR adds the same functionality for
2D meshes.

Closes #5881.

## Solution

Since there's no easy way to share material implementations between 2D,
3D, and UI, this is mostly a straight copy and rename from the original
plugin into `bevy_sprite`.

<img width="1392" alt="image"
src="https://github.com/bevyengine/bevy/assets/3961616/7aca156f-448a-4c7e-89b8-0a72c5919769">

---

## Changelog

- Added `Wireframe2dPlugin` and related types to support 2D wireframes.
- Added an example to demonstrate how to use 2D wireframes

---------

Co-authored-by: IceSentry <IceSentry@users.noreply.github.com>
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-Enhancement A new feature
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants