• Create Account

Need scary sound effects or creepy audio loops for your next horror-themed game? Check out Highscore Vol.3 - The Horror Edition in our marketplace. 50 sounds and 10 loops for only \$9.99!

# Gaussian filter confusion

Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

5 replies to this topic

### #1lipsryme  Members   -  Reputation: 760

Like
0Likes
Like

Posted 30 August 2013 - 01:32 PM

I'm a little confused about the gaussian filter function which can be found on several sources.

What's confusing to me is that I've found at least 3 different equations for the same thing...

I've marked the differences in red color.

Wikipedia lists it as: (http://en.wikipedia.org/wiki/Gaussian_filter)

g(x) = (1 / (sqrt(2 * PI) * rho)) * exp(-(x*x) / (2 * (rho * rho)))

While the one found in Real-Time-Rendering, Third Edition defines it as:

g(x) = (1 / (sqrt(2 * PI) * rho * rho)) * exp(-(x*x) / (2 * (rho * rho)))

And finally the code that I've got from one of MJP's samples:

g(x) = (1 / (sqrt(2 * PI * rho * rho))) * exp(-(x*x) / (2 * (rho * rho)))

What am I missing here ?

Edited by lipsryme, 30 August 2013 - 02:24 PM.

marcel-schindler.tumblr.com

### #2Brother Bob  Moderators   -  Reputation: 6404

Like
1Likes
Like

Posted 30 August 2013 - 01:55 PM

Assuming that you meant to divide by rho instead of multiplying by rho at all places, as indicated by the Wikipedia link, the first and third are identical, and the second is different only by a scale factor. I'd say the first and third ones are the "correct" ones as they have unit scaling, but if you disregard the scaling then the second one is no less correct than the other two.

### #3lipsryme  Members   -  Reputation: 760

Like
0Likes
Like

Posted 30 August 2013 - 02:03 PM

Not sure what you mean by "Assuming that you meant to divide by rho instead of multiplying by rho at all places". What scaling are you talking about ?

RTR defines it as: http://d.pr/i/3Dsg

Where is this squared rho coming from ?

Edited by lipsryme, 30 August 2013 - 02:06 PM.

marcel-schindler.tumblr.com

### #4David Neubelt  Members   -  Reputation: 737

Like
0Likes
Like

Posted 30 August 2013 - 02:11 PM

Hmm, I'd imagine the RTR is a typo because typically you don't want to scale and you want to be normalized to 1 when you integrate over the domain -\inf to \inf. That's what the term out in the front is for. I don't have the book on me at the moment to see in context what they are talking about.

-= Dave

Graphics Programmer - Ready At Dawn Studios

### #5Brother Bob  Moderators   -  Reputation: 6404

Like
0Likes
Like

Posted 30 August 2013 - 02:19 PM

The σ symbol in that equation is sigma, not rho, but never mind that. If you look at the equation, σ2 is in the denominator so you need to divide by σ, not multiply by σ (or rho; ρ) as you have in your original posts. Basically, your original post stated 1/sqrt(2π)*σ, where the correct equation in 1/(sqrt(2π)*σ). Likewise in the exponent, the correct equation is exp(-x*x/(2*σ*σ)). Note the parentheses to get the factors, dividends and the divisors correct.

Scaling refers to the linear scaling perform by the filter. If the filter has a scaling by for example 2, it means that the values of the signal is filtered but also scaled by 2 in amplitude. Your first and third equations does not have any additional scaling as the second equation has. Your second filter is scaled by 1/σ, which means that if σ=0.25, then the filtered signal is four times larger than the input signal apart from the actual filtering.

### #6lipsryme  Members   -  Reputation: 760

Like
0Likes
Like

Posted 30 August 2013 - 02:23 PM

Ah yes sorry I keep confusing these symbols names   (maybe I should just call it the standard deviation  ) and yes it seems I've made some mistakes in the parentheses (fixed it now) but that scaling factor is basically what I'm confused about the reason why it's in there.

Edited by lipsryme, 30 August 2013 - 02:26 PM.

marcel-schindler.tumblr.com

Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

PARTNERS