Search Unity

Distance Map Generator

Discussion in 'Made With Unity' started by Jasper-Flick, Feb 17, 2012.

  1. Jasper-Flick

    Jasper-Flick

    Joined:
    Jan 17, 2011
    Posts:
    959
    Hi,

    I've made a tool that generates distance maps from low-resolution anti-aliased textures, right inside Unity.

    $distance-map-generator-logo-distance-map.png

    Have a look at the tool and the documentation! It's available for free under the GNU GPL.

    $ccdmg-generated.png

    Here's a short demonstration video.



    It's very useful for my upcoming Text Box product release.
     
    Last edited: Feb 25, 2012
  2. Marc S

    Marc S

    Joined:
    Jan 29, 2012
    Posts:
    27
    Sorry if my question is dumb but what is a "distance map" and what is the point of making it?
     
  3. Deleted User

    Deleted User

    Guest

    It's what you use for this.

    Good work!
     
  4. Marc S

    Marc S

    Joined:
    Jan 29, 2012
    Posts:
    27
    Thanks.

    I get it now, ans I agree, that's à very good feature.
     
  5. Jasper-Flick

    Jasper-Flick

    Joined:
    Jan 17, 2011
    Posts:
    959
    Yes, it's useful for contour rendering, most notably text.
     
  6. TiG

    TiG

    Joined:
    Feb 28, 2011
    Posts:
    311
    This looks very promising looking at the sample at Valve. Can you post some kind of webplayer?
     
  7. Jasper-Flick

    Jasper-Flick

    Joined:
    Jan 17, 2011
    Posts:
    959
    I don't have a webplayer to show off distance map rendering, but you can take a look at the WIP topic for my upcoming text tool to see some screenshots of text rendered with this technique.
     
  8. TiG

    TiG

    Joined:
    Feb 28, 2011
    Posts:
    311
    Wonderful. I think many people will want to use this.
     
  9. Jasper-Flick

    Jasper-Flick

    Joined:
    Jan 17, 2011
    Posts:
    959
    :) Maybe. The technique has been around for a while, but not many people have adopted it yet. Perhaps some good tools might change that.
     
  10. Jasper-Flick

    Jasper-Flick

    Joined:
    Jan 17, 2011
    Posts:
    959
    I made a short demonstration video and added it to the top post. It's my first tutorial video ever.
     
  11. Andrew_atl

    Andrew_atl

    Joined:
    Sep 21, 2010
    Posts:
    103
    Thanks so much for this Jasper! I was trying to figure out how to do this earlier. And thanks for the tutorial video.
     
  12. Jasper-Flick

    Jasper-Flick

    Joined:
    Jan 17, 2011
    Posts:
    959
    :) Thanks for telling you liked the tutorial!
     
  13. renanse

    renanse

    Joined:
    Apr 12, 2013
    Posts:
    21
    Does this tool work in Unity 4.2? When I try it on a simple 512x1024 font texture, unity hangs. :(
     
    Last edited: Oct 28, 2013
  14. Jasper-Flick

    Jasper-Flick

    Joined:
    Jan 17, 2011
    Posts:
    959
    @renanse: Yes, it should work. I just tried it with Unity 4.2.2f1 to be sure, and no problems. 512x1024 could take a second or two, but shouldn't hang Unity. Do you have more info?
     
  15. renanse

    renanse

    Joined:
    Apr 12, 2013
    Posts:
    21
    Seems perhaps it did not like something in my texture settings. Switching off mipmaps and going from ARGB16 to ARGB32 somehow solved it. :confused:
     
  16. Jasper-Flick

    Jasper-Flick

    Joined:
    Jan 17, 2011
    Posts:
    959
    @renanse: Thanks, I reproduced it! Turns out it happens with 16-bit textures. I'll either fix the problem or make it reject 16-bit input in the next version.
     
  17. renanse

    renanse

    Joined:
    Apr 12, 2013
    Posts:
    21
    Cool, thanks for the quick reply!
     
  18. nasos_333

    nasos_333

    Joined:
    Feb 13, 2013
    Posts:
    13,364
    Hi

    Is it possible to use this for a commercial game ? Can someone obtain a different license ?

    With GNU you cant use the software unless you give the open source of your whole game with it (whole game means every line of code your game has, not just the tool one, but the whole final product you may sell and obviosuly is incompatible with any game that uses even one line of code from any Unity webstore item)

    Also will this be included in the Numberflow at some point ? I would love to buy it at that point.

    Thanks
     
  19. Jasper-Flick

    Jasper-Flick

    Joined:
    Jan 17, 2011
    Posts:
    959
    @nasos_333: Currently it's an editor tool only, not used at runtime and not included in builds. So it doesn't influence your commercial game, unless you adapt it for runtime use.

    However, as part of my Text Box 2 development, I'll also update this tool. It'll become available at runtime as well, and with an MIT license so you can use it without trouble in commercial games. It'll be available for free and also bundled with Text Box 2. I might add it to NumberFlow as well.
     
  20. nasos_333

    nasos_333

    Joined:
    Feb 13, 2013
    Posts:
    13,364
    Thanks, i suppose i could just use it offline together with Numberflow, i though the license covered the development tools as well
     
  21. Jasper-Flick

    Jasper-Flick

    Joined:
    Jan 17, 2011
    Posts:
    959
    Using GNU GPL software doesn't infect whatever you're creating with it. It only does so when you incorporate the GNU GPL software itself into your own product. Just to be clear.