Heath's Blog

There is no end, it is just the beginning! - A Game Developer's Notes

Font Outline in Unity

团队在使用UGUI时,发现其Outline实现是将文字的顶点在上下左右方向上做偏移生成了新的顶点,所以顶点和三角面数量都增加了4倍。受Glow中Gaussian Filter可实现边界外扩效果的启发,做了个实验,在第一个pass中使用Filter对Font Texture的Alpha进行4或者8方向采样,第二个pass正常渲染字体,然后将两者进行Alpha blend。

image

No Outline

image

Tow-Pass Outline with Four-Direction Sampling

image

Outline in UGUI

从结果上来看,在一定范围的纹理坐标偏移下可以接受,但限制也很明显,下图是偏移过大导致失真

image

posted on 2016-02-05 17:36 Heath 阅读(522) 评论(0)  编辑 收藏 引用 所属分类: Graphics ProgrammingGame Development


只有注册用户登录后才能发表评论。
网站导航: 博客园   IT新闻   BlogJava   知识库   博问   管理