Skip to content

fix(layers): WebGPU derivative-based normal calculation - #10547

Merged
Pessimistress merged 1 commit into
masterfrom
x/normal-fix
Aug 12, 2026
Merged

fix(layers): WebGPU derivative-based normal calculation#10547
Pessimistress merged 1 commit into
masterfrom
x/normal-fix

Conversation

@Pessimistress

Copy link
Copy Markdown
Collaborator

Background

WebGL and WebGPU use opposite screen-space Y-axis orientations, which reverses the direction of the Y derivative. In GLSL, cross(dFdx(position), dFdy(position)) reconstructs the expected outward-facing surface normal, but applying the same operand order to WGSL’s dpdx and dpdy produces its inverse. Reversing the operands to cross(dpdy(position), dpdx(position)) compensates for that coordinate-system difference, restoring outward-facing normals and therefore the correct diffuse and specular lighting. Geometry with supplied normals is unaffected; this only corrects normals reconstructed from screen-space derivatives.

Change List

  • ColumnLayer
  • SimpleMeshLayer

@coveralls

Copy link
Copy Markdown

Coverage Status

coverage: 84.084% (-0.003%) from 84.087% — x/normal-fix into master

@Pessimistress
Pessimistress merged commit 6ecc396 into master Aug 12, 2026
5 checks passed
@Pessimistress
Pessimistress deleted the x/normal-fix branch August 12, 2026 15:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants