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

Add example showing how to use SpecializedMeshPipeline #14370

Merged

Conversation

IceSentry
Copy link
Contributor

Objective

  • A lot of mid-level rendering apis are hard to figure out because they don't have any examples
  • SpecializedMeshPipeline can be really useful in some cases when you want more flexibility than a Material without having to go to low level apis.

Solution

  • Add an example showing how to make a custom SpecializedMeshPipeline.

Testing

  • Did you test these changes? If so, how?
  • Are there any parts that need more testing?
  • How can other people (reviewers) test your changes? Is there anything specific they need to know?
  • If relevant, what platforms did you test these changes on, and are there any important ones you can't test?

Showcase

The examples just spawns 3 triangles in a triangle pattern.

image

@IceSentry IceSentry added C-Docs An addition or correction to our documentation A-Rendering Drawing game state to the screen C-Examples An addition or correction to our examples S-Needs-Review Needs reviewer attention (from anyone!) to move forward labels Jul 17, 2024
Copy link
Contributor

@tychedelia tychedelia left a comment

Choose a reason for hiding this comment

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

ty!! so helpful to have more of these mid-level examples


@fragment
fn fragment(in: VertexOutput) -> @location(0) vec4<f32> {
return vec4(in.color, 1.0);
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: could this use world position? even if a bit silly like dividing the color by the position or smth

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'd like to keep the shader as simple as possible. I think people using that level of api are able to figure that out. I could maybe rotate the camera a bit to show that it's all already correctly placed in the world.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I should probably add a few comments about the world position and instance_index though.

examples/shader/specialized_mesh_pipeline.rs Show resolved Hide resolved
@IceSentry IceSentry added the S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it label Jul 18, 2024
@NotAFile
Copy link
Contributor

NotAFile commented Jul 19, 2024

This seems very helpful, I did not know this functionality existed! However, based on the comments in the example I'm still slightly confused what the use cases and limitations are and when to use it.

@IceSentry
Copy link
Contributor Author

IceSentry commented Jul 19, 2024

I'm still slightly confused what the use cases and limitations are and when to use it

It's a bit hard to explain if, for example, using the material apis was enough for your use case. This api is useful when you want to have more control over how a mesh is rendered than is possible with the material api.

And I guess the limitations are that's it's very verbose? It's also still made with rendering meshes in mind, if you want to make other effects that don't necessarily work with meshes directly then this isn't for you.

@NotAFile
Copy link
Contributor

Ah yep, that seems useful information to add to the example! They're often a bit short on information as to why to do things, I find.

@alice-i-cecile alice-i-cecile removed the S-Needs-Review Needs reviewer attention (from anyone!) to move forward label Jul 22, 2024
@alice-i-cecile alice-i-cecile added this pull request to the merge queue Jul 22, 2024
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Jul 22, 2024
@alice-i-cecile
Copy link
Member

This has subtle merge conflicts with #14273 that need to be fixed manually <3

@alice-i-cecile alice-i-cecile added the S-Waiting-on-Author The author needs to make changes or address concerns before this can be merged label Jul 29, 2024
@alice-i-cecile alice-i-cecile removed the S-Waiting-on-Author The author needs to make changes or address concerns before this can be merged label Jul 31, 2024
@alice-i-cecile alice-i-cecile added this pull request to the merge queue Jul 31, 2024
Merged via the queue into bevyengine:main with commit bfcb19a Jul 31, 2024
30 checks passed
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-Docs An addition or correction to our documentation C-Examples An addition or correction to our examples S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants