-
-
Notifications
You must be signed in to change notification settings - Fork 306
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
#954 Bevy render PoC #960
#954 Bevy render PoC #960
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this isn't necessary long term but is a convenient way to run things for now
This diff is pretty hard to review, but I wanted to give @mitchmindtree and @JoshuaBatty a chance to review or comment prior to merging this into our The main file I would look at is |
..default() | ||
}); | ||
|
||
commands.spawn( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we should probably spawn the camera for the user since we need to manage something like the orthographic settings and the clear color.
brightness: 1.0, | ||
}); | ||
commands.spawn(PbrBundle { | ||
mesh: meshes.add(Mesh::from(Torus { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this was just to test that we draw correctly over bevy meshes (we do)
@@ -7,3 +7,4 @@ target/ | |||
**/*.rs.bk | |||
.DS_Store | |||
.idea/ | |||
result/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mitchmindtree I ignored this but it's also accidentally checked in. What's the best practice here for nix? Was surprised to see this not already checked in since you use nix, do you have this in your global .gitignore
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you've done the right thing here! I'm just in the habit of clearing result
I think and forgot to add it 😅
Awesome work @tychedelia ! so cool to see this and encouraged by how much of stuff we can offload to bevy so far. I'm happy with the approach taken here, i'm sure there will be some more changes as you go along so don't want to hold this PR and the flow up. I'll wait for @mitchmindtree to have a look and give the final approval but looks good from my end. |
(Note for self) Right now we're using a |
Waiting on this NixOS/nixpkgs#289940. |
This reverts commit 23714ac.
Initial Render/Draw PoC
This pull request implements the port of our existing rendering pipeline for #954 as well as an initial port of the draw api for #955. The goal has been mostly fidelity to the original code, and while the draw API works, significant features provided by
App
andFrame
are currently missing. I.e., you can issue draw commands but not much else.General Description
At a high level,
bevy_nannou_draw
creates instances ofDraw
which exist in the main ECS game world. On every frame, thatDraw
is extracted bybevy_nannou_render
into the render world and written into aViewMesh
component, which is eventually rendered by ourNannouViewNode
in the bevy render graph.There's a bunch more fiddly details that I worked through here, but the goal was, in all places, to use the bevy equivalent, which means primarily we are using:
A general outline of the bevy systems that wire this together:
spawn_draw
system, for each newAdded<Camera>
, we insert aDraw
component on theCamera
entity. This will allow later rendering code to tie aDraw
to a specific view. ACamera
can have a few different types of render targets, but mainly (and the only thing we support right now) this is a window. So without getting into more complicated multi-camera setups think camera = view = window.nannou::draw
module into the newbevy_nannou_draw
crate #955).Draw
into the render world, where our mainprepare_view_mesh
system, which populates aViewMesh
component and list of render commands that are stored inViewRenderCommands
. Both of these are inserted as components on aExtractedView
, which is the render world equivalent of theCamera
we insertedDraw
on.NannouViewNode
in the render graph at the end of the core 3d pass, which executes our nannou shader and writes to the texture provided by bevy. This means that: (a). we can draw on top of things rendered in the bevy pbr mesh pipeline and (b). we hook into stuff like MSAA for free.How to review this pull request
Most of the files that have been copy/pasted from the existing code base into the bevy crates have been relatively lightly modified and should be mostly 1:1 copies and likely do not need super close review. I went back and forth whether these should just be modified in place to provide a better diff, but this would break the build on our branch and so I think the cost of ruining the diff history is worth it.
The primary changes were:
Rc<RefCell<T>>
indraw
withArc<RwLock<T>>
Point2
withVec2
, etcHandle<Image>
instead ofwgpu::TextureView
TODO:
ViewMesh
to render world in prep for draw work.