Author Topic: Gaussian blur filter shader: How?!  (Read 7266 times)

Bgoulette

  • Sr. Member
  • ****
  • Posts: 116
  • I wrote a book.
    • View Profile
    • BlakeGoulette.com
Gaussian blur filter shader: How?!
« on: August 15, 2015, 01:28:02 PM »
Hey all,

I'm trying to mess around with layouts, and I have the (very) basics down, I think, but I want to add a gaussian blur shader to part of it. Except I don't know how to write one and what I've been able to find on the internet looks... all right, it looks weird, but the way they have [Vertex_Shader] and [Pixel_Shader] sections makes squirrel angry, so straight up cutting and pasting is out. I'm happy to learn, but I'm such a neophyte that I'm not even sure where to really begin looking. Any advice or direction would be greatly appreciated! Thanks!

liquid8d

  • Global Moderator
  • Sr. Member
  • *****
  • Posts: 442
    • View Profile
Re: Gaussian blur filter shader: How?!
« Reply #1 on: August 21, 2015, 09:49:06 AM »
Shaders are a tricky subject, especially if you don't have experience with them. Most can't just be copied over and will require some modifications to work properly in AM.

Take a look at this topic:
http://forum.attractmode.org/index.php?topic=7.0

Begin with this, which has the minimal shaders:
https://github.com/mickelson/attract/blob/v1.5.2/Layouts.md#add_shader

If you read about shaders a bit, you can ever so slightly make modifications to the minimal ones and see what effect it has. Once you are little more comfortable with using them, you can make an attempt at converting an existing gaussian blur shader. I'm not comfortable, so I couldn't help :)

I believe Luke_Nukem has a pretty good understanding though as he was converting some for AM and Mame, maybe he can add some suggestions..

Bgoulette

  • Sr. Member
  • ****
  • Posts: 116
  • I wrote a book.
    • View Profile
    • BlakeGoulette.com
Re: Gaussian blur filter shader: How?!
« Reply #2 on: August 21, 2015, 10:08:18 AM »
Thanks, liquid8d: I eventually found Luke_Nukem's shaders on github, and I've been cannibalizing them for the present, but I know jack about glsl, so there's going to be a steep learning curve for me there... someday, I'll figure it out (a little)! Thanks for the links!

liquid8d

  • Global Moderator
  • Sr. Member
  • *****
  • Posts: 442
    • View Profile
Re: Gaussian blur filter shader: How?!
« Reply #3 on: August 21, 2015, 10:17:20 AM »
I actually noticed he has a gaussian one in there:
https://github.com/Luke-Nukem/attract-extra/tree/master/layouts/shaders/screen-shaders

I'm still in the same boat, just haven't put much time into it. Graphics + Math :P But if you take those minimal shaders (which don't modify anything) and make some small changes, you'll start to see how the pixels or vertices are affected by adding/multiplying/subtracting modifications to the original. As you start looking at some of those other shaders, you'll see how they are modifying the pixels or the vertices for the effects. Try to find the simple ones to help grasp what is going on :P

ArcadeBliss

  • Sr. Member
  • ****
  • Posts: 195
    • View Profile
Re: Gaussian blur filter shader: How?!
« Reply #4 on: May 21, 2016, 06:58:52 AM »
Just incase someone else looks for a solution to do a gaussian blur,  just check out my layout code here http://forum.attractmode.org/index.php?topic=741.0