Distance Field Technique

Posted Tekkaman

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Distance Field Technique相关的知识,希望对你有一定的参考价值。

Distance Field Technique

  一种小纹理高清放大的技术。

  

 

    A distance field is generated from a high resolution image, and then stored into a channel of a lower-resolution texture.  which has been previously used to develop games such as the Half-Life 2 series, Counter-Strike: Source and Day of Defeat: Source.

    In the simplest case, this texture can then be rendered simply by using the alpha-testing and alpha-thresholding feature of modern GPUs.

 

    The distance function stored in an 8-bit channel. By doing so, we are able to take advantage of the native bilinear texture interpolation.  

    Once this signed distance has been calculated, we map it into the range 0..1, with 0 representing the maximum possible negative distance and 1.0 representing the maximum possible positive distance. A texel value of 0.5 represents the exact position of the edge and, hence, 0.5 is generally used for the alpha threshold value.

    小图中存储的alpha是,在原大图中,该点到最近的边缘的距离。

    

应用

1、SoftEdge。

  Two distance thresholds, Distmin and Distmax, are defined and the shader maps the distance field value between these two values using the smoothstep() function.

    

2、Outline。

   By changing the color of all texels which are between two userspecified distance values.

    

3、Glow

  When the alpha value is between the threshold value of 0.5 and 0, the smoothstep function can be used.

    

4、Drop Shadow

  texture coordinate offset to produce drop shadows

    

5、

 

参考:

1、《Improved Alpha-Tested Magnification for Vector Textures and Special Effects》.pdf

2、http://www.360doc.com/content/17/0930/09/110467_691283041.shtml

以上是关于Distance Field Technique的主要内容,如果未能解决你的问题,请参考以下文章

Signed Distance Field Shadow in Unity

sqlmap常用技巧整理

sqlmap常用技巧整理

基于SDF渲染字体

2022-01-10:路径交叉。给你一个整数数组 distance 。 从 X-Y 平面上的点 (0,0) 开始,先向北移动 distance[0] 米,然后向西移动 distance[1] 米,向南

错误1error LNK2019: 无法解析的外部符号 "public: __thiscall Distance::Distance(int)" (??0Distance@@QAE