You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I created a custom shader that uses compressed normals and position data into a u32 . Meaning I only needed my custom attribute in my shader layout so I removed the rest of the standard layout items like POSITION and NORMAL
This is my code:
pubconstATTRIBUTE_VOXEL_DATA:MeshVertexAttribute =
MeshVertexAttribute::new("VoxelTypeId",988540917,VertexFormat::Uint32x2);#[derive(Asset,TypePath,AsBindGroup,Debug,Clone,Default)]pubstructChunkMaterial{#[texture(1, dimension = "2d_array")]#[sampler(2)]pubtexture:Handle<Image>,}implMaterialforChunkMaterial{fnvertex_shader() -> ShaderRef{"shaders/chunk_shader_new.wgsl".into()}fnfragment_shader() -> ShaderRef{"shaders/chunk_shader_new.wgsl".into()}fnalpha_mode(&self) -> AlphaMode{AlphaMode::Opaque}fnspecialize(_pipeline:&bevy::pbr::MaterialPipeline<Self>,descriptor:&mut bevy::render::render_resource::RenderPipelineDescriptor,layout:&bevy::render::mesh::MeshVertexBufferLayout,_key: bevy::pbr::MaterialPipelineKey<Self>,) -> Result<(), bevy::render::render_resource::SpecializedMeshPipelineError>{// The shader location needs to match the one in the prepass_io// https://github.com/bevyengine/bevy/blob/main/crates/bevy_pbr/src/prepass/prepass_io.wgsllet vertex_layout = layout.get_layout(&[ATTRIBUTE_VOXEL_DATA.at_shader_location(30),])?;
descriptor.vertex.buffers = vec![vertex_layout];// descriptor.primitive.cull_mode = None;Ok(())}fnprepass_vertex_shader() -> ShaderRef{"shaders/chunk_prepass.wgsl".into()}fnprepass_fragment_shader() -> ShaderRef{"shaders/chunk_prepass.wgsl".into()}}
What went wrong
I get the following error from bevy: Mesh is missing requested attribute: Vertex_Normal (MeshVertexAttributeId(1), pipeline type: Some("bevy_pbr::prepass::PrepassPipeline<bevy_voxel::voxel_engine::rendering::ChunkMaterial>"))
Bevy version
0.13.1
[Optional] Relevant system information
If your bug is rendering-related, copy the adapter info that appears when you run Bevy.
What you did
I created a custom shader that uses compressed normals and position data into a
u32
. Meaning I only needed my custom attribute in my shader layout so I removed the rest of the standard layout items likePOSITION
andNORMAL
This is my code:
What went wrong
I get the following error from bevy:
Mesh is missing requested attribute: Vertex_Normal (MeshVertexAttributeId(1), pipeline type: Some("bevy_pbr::prepass::PrepassPipeline<bevy_voxel::voxel_engine::rendering::ChunkMaterial>"))
Additional information
More info can be checked by reading this message and the conversation that lead to it and after:
https://discord.com/channels/691052431525675048/866787577687310356/1231657933490753666
It contains a possible explanation from Jasmine on what is the problem.
I used a workaround to add the
Normal
attribute in my layout and then supply dummy data to make it happy.The text was updated successfully, but these errors were encountered: