Skip to content

Commit

Permalink
Fix rendering smoothstep function in new version of Dawn
Browse files Browse the repository at this point in the history
  • Loading branch information
Chris Lewin committed Oct 17, 2024
1 parent e0536f8 commit 61749b6
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions shaders/particleRender.wgsl
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ const s_quadVertices = array(
vec2f(-1, 1)
);

const s_antialiasingWidth = 2000.0;
const s_antialiasingWidth = 500.0;

@vertex
fn vertexMain(@builtin(vertex_index) vertexId: u32, @builtin(instance_index) instanceId : u32) -> VertexOutput {
Expand Down Expand Up @@ -95,7 +95,7 @@ fn fragmentMain(input: VertexOutput) -> @location(0) vec4f {
let fragOffsetFromCenter = fragmentPosition - input.particlePosition;
let distanceFromCenter = length(fragOffsetFromCenter);

let alpha = smoothstep(1.0, 0.0, (distanceFromCenter-particleRadius)/(onePixel*s_antialiasingWidth*particleRadius) );
let alpha = smoothstep(0.0, 1.0, 1-(distanceFromCenter-particleRadius)/(onePixel*s_antialiasingWidth*particleRadius) );

return vec4f(input.particleColor,alpha);
}

0 comments on commit 61749b6

Please sign in to comment.