Mid-Level Rendering w/ ShaderModel
#980
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
ShaderModel
based renderingThe fourth major refactor of how we're approaching rendering with bevy. To recap:
bevy-refactor
, we used bevy mesh-material API to avoid needing much custom rendering code.While the material approach was great, it introduced a few problems, namely that it leaked a lot of details of the bevy pbr pipeline into nannou. While this was cool in some cases (emissives!), it also was potentially confusing to users. Additionally, it prevented us from having a simple way to implement additional render commands, i.e. explicit instancing or indirect draw, as bevy's material system doesn't support these.
This PR returns to a solution that is largely based around the mid-level APIs. The intention here is to decouple nannou from bevy's material system, while still using a similar kind of pattern.
As such, we want to lean on the
ShaderModel
trait, and use that as the core "material" for our rendering, and avoid exposing users to any details about bevy's pbr shaders.Implementation
Much of the new rendering code is similar to code found in bevy's material pipeline, with a few primary differences:
InstancedMesh
, as managed by our draw render commands.How to review
The bulk of the changes are located in
bevy_nannou_draw
, but likely require familiarity with bevy's mid-level. Pay attention to the ways in which indirect and instanced drawing are implemented now.