Skip to content

fix(fill-style): correct pattern orientation by flipping texture y-axis (Fixes #10548) - #10550

Open
waterWang wants to merge 2 commits into
visgl:masterfrom
waterWang:fix/fill-style-extension-pattern-flip
Open

fix(fill-style): correct pattern orientation by flipping texture y-axis (Fixes #10548)#10550
waterWang wants to merge 2 commits into
visgl:masterfrom
waterWang:fix/fill-style-extension-pattern-flip

Conversation

@waterWang

Copy link
Copy Markdown

Fix pattern orientation in FillStyleExtension

Problem

FillStyleExtension renders patterns flipped vertically (top-to-bottom) compared to the original asset. A line pattern going from bottom-left to top-right (/) appears as bottom-right to top-left (\).

Root cause

The texture coordinate system has y=0 at the bottom (OpenGL convention), but the geometry coordinates have y increasing upward. When computing texCoords from patternUV (which is derived from geometry coordinates), the y-axis was not flipped, causing the pattern to appear inverted.

Fix

Flip the y-axis of patternUV when computing texture coordinates:
```glsl
// Before
vec2 texCoords = fill_patternBounds.xy + fill_patternBounds.zw * patternUV;

// After
vec2 texCoords = fill_patternBounds.xy + fill_patternBounds.zw * vec2(patternUV.x, 1.0 - patternUV.y);
```

Breaking change

This fix changes the visual output of FillStyleExtension for all users who rely on the current (incorrect) pattern orientation. The issue author noted this is a breaking change, but the fix aligns the rendering with the principle of least surprise — patterns should render in the same orientation as the original asset.

Closes #10548

@chrisgervang

Copy link
Copy Markdown
Collaborator

Thanks. Please include unit tests and a screenshot from the website example to validate this addresses the issue.

@chrisgervang

Copy link
Copy Markdown
Collaborator

Hey @Pessimistress, this is a breaking change so my recommendation is approving but waiting for v10. Wdyt? #10548 seems valid

@chrisgervang chrisgervang added this to the v10 milestone Aug 19, 2026
@coveralls

Copy link
Copy Markdown

Coverage Status

coverage: 84.119%. remained the same — waterWang:fix/fill-style-extension-pattern-flip into visgl:master

@Pessimistress

Copy link
Copy Markdown
Collaborator

@chrisgervang I think it's acceptable to make a breaking change if it's correcting wrong behavior.

@waterWang have you tested OrthographicView with flipY:true (top-left y)? Both configurations should render to the same orientation.

@Pessimistress

Copy link
Copy Markdown
Collaborator

Please add a note to docs/upgrade-guide.md

@greptile-apps

greptile-apps Bot commented Aug 21, 2026

Copy link
Copy Markdown

Greptile Summary

This PR corrects vertically mirrored FillStyleExtension patterns by reversing the pattern-space y coordinate before sampling the texture atlas.

  • Changes texture-coordinate calculation from patternUV to vec2(patternUV.x, 1.0 - patternUV.y).
  • Leaves atlas bounds, placement, opacity, masking, and texture upload behavior unchanged.

Confidence Score: 5/5

The PR appears safe to merge, with no concrete functional, security, or repository-rule issues identified.

The atlas uses top-origin frame coordinates, and neither bounds generation nor texture upload performs a y-axis inversion, so applying the flip at sampling time consistently corrects the rendered pattern orientation.

Important Files Changed

Filename Overview
modules/extensions/src/fill-style/shader-module.ts Correctly flips the pattern-local y coordinate during atlas sampling, with no conflicting flip elsewhere in the established texture path.

Reviews (1): Last reviewed commit: "Merge branch 'master' into fix/fill-styl..." | Re-trigger Greptile

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.

[Bug] FillStyleExtension flips patterns top-to-bottom

4 participants