Skip to content

Commit

Permalink
Fix black borders around alpha cutoff textures
Browse files Browse the repository at this point in the history
  • Loading branch information
FredrikNoren committed Oct 20, 2023
1 parent 56cd706 commit ce04dc5
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion crates/renderer/src/renderer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,19 @@ impl Renderer {
"forward",
TreeRendererConfig {
renderer_config: config.clone(),
targets: vec![Some(gpu.swapchain_format().into()), Some(normals_format)],
targets: vec![
Some(wgpu::ColorTargetState {
format: gpu.swapchain_format(),
blend: None,
// NOTE: We had problems where the solid renderer would output alpha values like
// 0.8, because it was using alpha cutoff, and then just outputing the alpha value
// of the texture. This lead to black borders around the edges of the texture when
// it was blended with the background. A better solution _might_ be to update the
// shaders to output either 1 or 0 for alpha when it's the solids pass.
write_mask: wgpu::ColorWrites::COLOR,
}),
Some(normals_format),
],
filter: ArchetypeFilter::new().incl(config.scene),
renderer_resources: renderer_resources.clone(),
fs_main: FSMain::Forward,
Expand Down

0 comments on commit ce04dc5

Please sign in to comment.