Skip to content

Conversation

@halx99
Copy link
Collaborator

@halx99 halx99 commented Oct 31, 2025

Describe your changes

Label: separate text and outline passes in SDF shader

  • Renamed shader uniform u_effectType => u_labelPass to better reflect its role as a rendering pass selector (0 = text, 1 = outline, 2 = shadow).
  • Split text and outline into distinct branches:
    • Text pass draws solid glyph core without outline interference.
    • Outline pass draws only the outer ring, excluding the text core.
    • Shadow pass remains unchanged as pure color fill.
  • Introduced u_distanceSpread uniform (default 6.0) for flexible spread control.
  • Added outlineScale empirical factor (0.75) to visually match SDF outline thickness
    with non-SDF text rendering.

This change ensures SDF rendering matches non-SDF behavior: text core is never
overwritten by outline, and passes are explicitly separated for clarity.

Before this PR

image

After this PR

image

Issue ticket number and link

Checklist before requesting a review

For each PR

  • Add Copyright if it missed:
    - "Copyright (c) 2019-present Axmol Engine contributors (see AUTHORS.md)."

  • I have performed a self-review of my code.

    Optional:

    • I have checked readme and add important infos to this PR.
    • I have added/adapted some tests too.

For core/new feature PR

  • I have checked readme and add important infos to this PR.
  • I have added thorough tests.

Axmol 3.x ------------------------------------------------------------

For each 3.x PR

  • Check the '#include "axmol.h"' and replace it with the needed headers.

@halx99 halx99 added this to the 2.9.1 milestone Oct 31, 2025
@halx99 halx99 changed the title Improve SDF outline rendering Improve SDF text outline rendering Oct 31, 2025
@halx99 halx99 self-assigned this Oct 31, 2025
@halx99 halx99 added the enhancement New feature or request label Oct 31, 2025
@halx99 halx99 merged commit 693f149 into release/2.x Nov 1, 2025
15 checks passed
@halx99 halx99 deleted the improve-sdf-outline branch November 1, 2025 05:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants