1. Hey Guest, is it this your first time on the forums?

    Visit the Beginner's Box

    Introduce yourself, read some of the ins and outs of the community, access to useful links and information.

    Dismiss Notice

Purple contours? How doooo they do it?

Discussion in 'Modding Help' started by Xlayer, Jul 18, 2013.

  1. Xlayer

    Xlayer Haxor

    Messages:
    263
    Not sure if this is where to post it.... whatever.

    I've noticed in KAG beta, when you select certain objects in the game, a purple outline appears around the object.
    Like this:
    [​IMG][​IMG]

    I would like to ask the devs and anyone else who might know, how is this effect achieved? How do you put a contour line on an image like that?

    EDIT: wrong prefix for this thread. Just realised what "Forum" means. Oh well. //fixed
     
    Guitarman likes this.
  2. Shadreki

    Shadreki ᴋᴀɢ ᴅᴡᴇʟʟᴇʀ Donator

    Messages:
    115
    Hello Xlayer,
    example.gif
    I really like that visual effect so I played a little bit in Photoshop with blending modes. This is probably not the correct way and it seems to me if you want to achieve something like that, then it's going to be way more advanced. Anyway, here's what I made and if you got Photoshop, then you can see what I did. The answer probably lies somewhere there. (Edit: Noticed that the line is outwards, lmao.. my bad)

    http://www.speedyshare.com/6dV7n/example.psd
     
  3. master4523

    master4523 Masterful KAG Guard Global Moderator Tester
    1. PumpkinStars - [Pk#] - Inactive

    Messages:
    378
    Programmatically, you have 3 ways of achieving this:
    1. draw the same sprite, but rescaled, with a color blending filter
    2. use shaders
    3. get the bitmap matrice of the sprite, use an edge detection filter, fill out the new pixels and apply the new matrice on the sprite
     
    miniu and Shadreki like this.
  4. Xlayer

    Xlayer Haxor

    Messages:
    263
    omg thank you, this looks like not only the answer, but 3 answers! What kind of shader would be used? Or should I just learn how shaders work?
     
  5. Voxxitronic

    Voxxitronic It's an adjective Donator

    Messages:
    46
    It seems to me that:

    Since the outline color is purple (I have looked at the color in photoshop, and it is a very dark purple), that's where your purple highlight comes from. The blending mode used is add, and it seems to me that every pixel (at least on the edge) emits 4 pixels of the same color in the add blend mode, in the four cardinal directions like a cross. That would explain the brightness increase on the angled surfaces, the crosses of all the pixels overlap. That's just me though, I'm crazy.
     
    Xlayer and Guitarman like this.
  6. CrispyChips35

    CrispyChips35 Bison Rider

    Messages:
    25
    Isn't this the wrong section to post this ?
     
  7. Guitarman

    Guitarman Haxor Tester Official Server Admin

    Messages:
    686
    Yes, it should be in King Arthurs Gold Beta Forums>Modding>Modding Help.
    Though since it hasn't been moved yet, it probably isn't a big deal.
     
    Xlayer likes this.