Search Unity

Alpha Texture Padding Script

Discussion in 'Assets and Asset Store' started by ravingbots, Mar 29, 2016.

  1. ravingbots

    ravingbots

    Joined:
    Aug 20, 2015
    Posts:
    44
    Have you ever need to automatize texture padding (dilate pixels to avoid 'bleed') in Unity? Here is a script that lets you do it with images loaded during runtime: http://u3d.as/p18

    The Advanced Edge Padding is a script that dilates pixels around the border of an alpha texture. It prevents color 'bleed' and produces a similar effect to the one described here: http://docs.unity3d.com/462/Documentation/Manual/HOWTO-alphamaps.html . This code is especially useful if you need to apply edge padding programmatically at runtime. The padding method is customizable, and it is very efficient because textures are processed by image effect shaders.

    Key Features:
    • optional edge trimming before padding (to get rid of 'dirty' pixels on the border)
    • supports two dilating techniques: 4-way (fast), and 8-way (more precise)
    • customizable number of padding iterations
    • includes documentation

    Asset Store link: http://u3d.as/p18

     
    florianalexandru05 and bac9-flcl like this.