Skip to content

Having issue trying to generate a convincing atlas #6

@ExtraBinoss

Description

@ExtraBinoss

Overview

First, I would like to thank you for your work on porting the MSDF generator and atlas library. The implementation is generally excellent and has been very helpful.

However, I am currently encountering significant visual artifacts when using the provided "Demo" for atlas generation. When comparing the output of SharpMSDF against other implementations (specifically the msdf-bmfont-xml logic used by MSDFTron), there are noticeable discrepancies in the generated signed distance fields, particularly on rounded glyphs.

Technical Details

  • Font Used: Roboto-Regular
  • Padding Configured: 5, 5, 5, 5 (Applied to prevent sampling bleed)
  • Tooling: Comparisons were made using MSDFTron as a baseline for expected output.
  • TightAtlasPacker packer = new();
  • setDimensions or setDimensionsConstraint to find the best value
  • packer.SetDimensionsConstraint(DimensionsConstraint.Square);
  • packer.SetMinimumScale(64.0f);
  • packer.SetPixelRange(new DoubleRange(6.0f));
  • packer.SetMiterLimit(1.0f);
  • packer.SetOuterPixelPadding(new Padding(5, 5, 5, 5)); // 5px padding around each glyph
  • packer.SetOriginPixelAlignment(false, true);
  • packer.Pack(ref glyphs);
  • packer.GetDimensions(out int width, out int height);

Observed Behavior

The Multi-channel Signed Distance Field (MSDF) generated by SharpMSDF appears to handle edge coloring and distance calculations differently than the reference implementation. This is most evident in characters such as '0' (zero), 'O', and 'o'.

  • Artifacting: When these textures are loaded into the rendering engine (Tixl), the SharpMSDF output produces visible noise or "glitches" at specific scale factors.
  • Visual Discrepancy: Comparing the two atlas outputs (attached below), the SharpMSDF version shows distinct color-channel transitions that do not align with the smoother results produced by MSDFTron/msdf-bmfont-xml.

Rendering artefact on Barbarian font : (visible on V,y, u, X...)
Image

Rendering artefact in Arial font (and also rounded corners everywhere) :

Image

This is the IceLand ttf, atlas generated via MSDFTron :
As you can see it's spotless when rendered in Tixl.
Image

Comparison
SharpMSDF atlas : (font Roboto-Regular)

Image

MSDFTron :

Image

Is this something you guys ran into ?

Thanks in advance !

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions