Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Font effects  (Read 2079 times)

0 Members and 1 Guest are viewing this topic.

switlle

  • Newbie
  • *
  • Posts: 2
    • View Profile
    • Email
Font effects
« on: January 11, 2014, 10:46:51 pm »
In moddern games we are used to see nice texts with borders, shaddows or glow.

How to realize this effects in SFML? Maybe shaders or any other ways?

Daddi

  • Jr. Member
  • **
  • Posts: 66
    • View Profile
    • http://foxdev.de/
    • Email
Re: Font effects
« Reply #1 on: January 11, 2014, 10:53:58 pm »
There is no easy method for special effects like that, but you can fake some of them pretty easily:

Shadow: Render your text twice, once normal, once dark with a slight offset (render the normal text above the "shadow" text)

Border: Similar, but this time the "border" text that lies behind the normal text has to be a bit bigger (and also needs an offset to the top left corner)

Glow is a little "harder", but can be achived in a similar way. Just render the text twice and use a shader to blur the underlying text :)
« Last Edit: January 11, 2014, 10:56:49 pm by Daddi »

zsbzsb

  • Hero Member
  • *****
  • Posts: 1409
  • Active Maintainer of CSFML/SFML.NET
    • View Profile
    • My little corner...
    • Email
Re: Font effects
« Reply #2 on: January 11, 2014, 11:16:48 pm »
You can do as Daddi suggested, but if you are looking for the "professional" method for doing this the answers lie within shaders.
Motion / MotionNET - Complete video / audio playback for SFML / SFML.NET

NetEXT - An SFML.NET Extension Library based on Thor