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

Custom Render Phase Example #9126

Closed
wants to merge 2 commits into from

Conversation

IceSentry
Copy link
Contributor

@IceSentry IceSentry commented Jul 12, 2023

Objective

  • Making a custom render phase is not very documented and you need to jump around deep in the bevy internals to understand what is going on.

Solution

  • Add an example that shows a self-contained custom render phase and draw command

Note

There's some overlap with the shader_instancing and post_processing examples but this one is intended to really document the full pipeline while the other ones are more about a specific part of it. It might also be worth it to remove some redundant comments in the post_processing example and point to this one instead.

It will also be useful to have everything in one place for anyone that wants to work on reducing the boilerplate.

@IceSentry IceSentry added A-Rendering Drawing game state to the screen C-Examples An addition or correction to our examples labels Jul 12, 2023
@IceSentry IceSentry force-pushed the custom-render-phase branch 2 times, most recently from 568754f to b8911a3 Compare January 13, 2024 22:11
return Ok(());
}

println!("node running");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is done in other examples too, but why are we using println instead of tracing's info?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a very work in progress PR and this was just used for debugging. It will definitely not be in the final PR.

Comment on lines +377 to +359
desc.vertex.shader = self.shader.clone();
desc.fragment.as_mut().unwrap().shader = self.shader.clone();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why does one require as_mut().unwrap() and the other not?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The fragment shader is optional but the vertex shader is required. I don't remember what happens if you don't provide a fragment shader but it isn't required

@IceSentry
Copy link
Contributor Author

The specialized_mesh_pipeline and custom_phase_item cover most of the important bits of this example. I might revisit this in the future but I'll do that in a new PR if I ever get to it.

@IceSentry IceSentry closed this Aug 8, 2024
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-Examples An addition or correction to our examples
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants