TextureBased SDF Slice

Background
I want to have 3D font in my game.

????It's very frustrating.Because when I created the font in an empty scene initially,the FPS seems OK to me:
?


I look back on the empty scene without 'B',wow it's 1000FPS:

It seems like absolute FPS doesn't mean a thing,the relative proportion does.Our 'B' drop 50%!
Since a spline based 'B' is so heavy,I want to use texture based SDF.
Let's try it!
Generate SDF texture
????The important thing is that you save the value by pixel distance,and do not normalize it,otherwise there'll be a problem.I havn't fully found the reason, but this procedure solve the issue: don't normalize it in SDF Texture

Calculate SDF Slice in Shader
With a bound condition,we get a single slice.Same view, up to 1000FPS,almost cost free:

Get closer,the precision is acceptable.Afterall,it's texture based,can't compare with a 'perfect' spline based one:


Thanks to SDF Trace and TextureBased SDF Slice,allows infinite instances at a relative cheap cost:

TextureBased SDF Slice的評論 (共 條)
