examples(shaders/glsl): Update GLSL Shader Example Camera View uniform#15865
Conversation
|
Welcome, new contributor! Please make sure you've read our contributing guide and we look forward to reviewing your pull request shortly ✨ |
e83ebc1 to
e4f2393
Compare
The Custom Material GLSL shader example had what seemed to be an old version of the camera view uniform. I was running into issues using camera world position and someone in discord pointed me to the source of truth. crates/bevy_render/src/view/view.wgsl Since this was helpful to me I've updated the shader example to have the latest view uniform structure converted to GLSL. I tested it with: ```bash cargo run --features shader_format_glsl --example shader_material_glsl ```
e4f2393 to
3fa4092
Compare
|
I wonder if it would be better to just have the layout(set = 0, binding = 0) uniform CameraViewProj {
mat4 clip_from_world;
// Other attributes exist that can be described here.
// See full definition in: crates/bevy_render/src/view/view.wgsl
} camera_view; |
cart
left a comment
There was a problem hiding this comment.
I made the change specified by @BorisBoutillier and expanded the comment to describe the constraints.
Objective
The Custom Material GLSL shader example has an old version of the camera view uniform structure.
This PR updates the example GLSL custom material shader to have the latest structure.
Solution
I was running into issues using the camera world position (it wasn't changing) and someone in discord pointed me to the source of truth.
crates/bevy_render/src/view/view.wgslAfter using this latest uniform structure in my project I'm now able to work with the camera position in my shader.
Testing
I tested this change by running the example with: