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

Author Topic: Outline Shader Not Working Outside Sprite Bounds?  (Read 2620 times)

0 Members and 2 Guests are viewing this topic.

7ark

  • Newbie
  • *
  • Posts: 4
    • View Profile
Outline Shader Not Working Outside Sprite Bounds?
« on: March 17, 2018, 11:13:30 pm »
Maybe I'm doing something wrong, or maybe this is intended? I'm fairly new to using SFML, and I've made a system for adding shaders to my objects. I haven't noticed until now, but I've added an outline shader to a sprite whose texture doesn't have much transparent space around it, unlike the previous sprites I had used the shader on.

Well the outline doesnt actually get applied to any part that the sprite bounds aren't apart of. So the only transparent space in the texture is the corners (its a button with rounded corners), and so clearly thats not what I wanted.
I don't do a ton with shaders normally, and I just started using SFML. So I'm not sure if this is normal, or if there's a way to fix it?

Hapax

  • Hero Member
  • *****
  • Posts: 3379
  • My number of posts is shown in hexadecimal.
    • View Profile
    • Links
Re: Outline Shader Not Working Outside Sprite Bounds?
« Reply #1 on: March 18, 2018, 02:12:49 am »
The shader is applied to every pixel that is covered by the shape but nothing outside of that. A sprite, then, is simply a (transformed) rectangle and the shader will only apply within that  (transformed) rectangle. To have a shader affect a larger space, you can use a larger object or maybe apply the shader to the entire window via a render texture (post-fx), for example.
Selba Ward -SFML drawables
Cheese Map -Drawable Layered Tile Map
Kairos -Timing Library
Grambol
 *Hapaxia Links*

7ark

  • Newbie
  • *
  • Posts: 4
    • View Profile
Re: Outline Shader Not Working Outside Sprite Bounds?
« Reply #2 on: March 18, 2018, 02:33:54 am »
The shader is applied to every pixel that is covered by the shape but nothing outside of that. A sprite, then, is simply a (transformed) rectangle and the shader will only apply within that  (transformed) rectangle. To have a shader affect a larger space, you can use a larger object or maybe apply the shader to the entire window via a render texture (post-fx), for example.

Hm, alright thanks.

 

anything