Skip to content

Commit 03d61c2

Browse files
committed
msdf.hlsl changes
1 parent 3b2a705 commit 03d61c2

File tree

1 file changed

+2
-2
lines changed
  • include/nbl/builtin/hlsl/text_rendering

1 file changed

+2
-2
lines changed

include/nbl/builtin/hlsl/text_rendering/msdf.hlsl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ This can then be processed using smoothstep to provide anti-alising when renderi
2323
@params:
2424
- msdfSample: sampled SNORM value from the MSDF texture generated by msdfgen library.
2525
26-
- pixelRange = msdfPixelRange * screenPxRangeValue, It is the value to convert snorm distance to screen space distance
26+
- pixelRange = screenPxRangeValue * msdfPixelRange * 0.5, It is the value to convert snorm distance to screen space distance
2727
- msdfPixelRange: specifies the width of the range around the shape between the minimum and maximum representable signed distance in shape units or distance field pixels, respectivelly.
2828
for example if msdfPixelRange is 4, then the range of distance values are [-2, +2], and it can be computed by snormValue * MSDFPixelRange/2.0
2929
so an snorm value of 1.0 means a distance of 2 pixels outside the shape (in msdf texture space)
@@ -34,7 +34,7 @@ This can then be processed using smoothstep to provide anti-alising when renderi
3434
where GlyphTextureSpaceSize is the size of the glyph inside the msdf texture/atlas
3535
*/
3636
float msdfDistance(float3 msdfSample, float pixelRange) {
37-
return median(msdfSample.r, msdfSample.g, msdfSample.b) * pixelRange / 2.0f;
37+
return median(msdfSample.r, msdfSample.g, msdfSample.b) * pixelRange;
3838
}
3939

4040
}

0 commit comments

Comments
 (0)