Custom material always requires vertex position, normal and UV
- Dominant language
- Rust
- Stars
- 48.2k
- Forks
- 4.8k
- Avg merge
- 3d 22h
- Merged PRs (30d)
- 161
Description
## Bevy version
0.7
## What you did
Created a custom material without using `Vertex_UV` attribute
## What went wrong
The custom material requires vertex `POSITION`, `NORMAL` and `UV` attributes to be set on Mesh even if the custom material layout doesn't specifies so. This seems to be a requirement of the mesh pipeline.
## Additional information
This was first reported and discussed [here](https://discord.com/channels/691052431525675048/991030391378964481)
**superdump**
> This passes the mesh layout into the mesh pipeline specialization function: https://github.com/bevyengine/bevy/blob/9eb69282efe57b9e3922e66ade887e6239bff175/crates/bevy_pbr/src/material.rs#L263
Which requires these attributes: https://github.com/bevyengine/bevy/blob/9eb69282efe57b9e3922e66ade887e6239bff175/crates/bevy_pbr/src/render/mesh.rs#L576
So even if you want to override the vertex attributes and layout, that code already required them and if your mesh doesn’t have them, it will fail
**cart**
> Gotcha that makes sense. Fixing that will probably require some design work. Ex: do we build an api to let people override vertex layouts (specifically), or add a lifecycle hook that allows people to specialize the mesh pipeline. Do we add another generic to MeshPipeline that lets users plug their custom logic in or take a more retroactive approach?
Contributor guide
Assessment
This issue has not been assessed yet.