dmj5
Class DMJ_GaussianBlur
Object
common:Generic
dmj5:DMJ_ConvolutionFilter
dmj5:DMJ_GaussianBlur
class
- DMJ_ConvolutionFilter:DMJ_GaussianBlur
Basic Gaussian blur filter. Provides even, soft blurring.
Ultra Fractal Source
Toggle UF Source Code Display
class DMJ_GaussianBlur(DMJ_ConvolutionFilter) {
; Basic Gaussian blur filter. Provides even, soft blurring.
public:
import "common.ulb"
func DMJ_GaussianBlur(Generic pparent)
DMJ_ConvolutionFilter.DMJ_ConvolutionFilter(pparent)
int count = (@p_samples*2+1)
int elements = sqr(count)
setLength(m_Offsets, elements)
setLength(m_Weights, elements)
m_Bias = 0.0
m_Multiplier = 0.0
int j = -@p_samples
int k = 0
int l = 0
float o = 1.0 / (2.0*sqr(@p_samples / 3.0))
while (j <= @p_samples)
k = -@p_samples
while (k <= @p_samples)
m_Offsets[l] = @p_radius*j/@p_samples + flip(@p_radius*k/@p_samples)
m_Weights[l] = o/#pi * exp(-(sqr(j)+sqr(k))*o)
m_Multiplier = m_Multiplier + m_Weights[l]
l = l + 1
k = k + 1
endwhile
j = j + 1
endwhile
m_Multiplier = 1.0 / m_Multiplier
endfunc
default:
title = "Gaussian Blur"
int param v_dmj_gaussianblur
caption = "Version (DMJ_GaussianBlur)"
default = 100
hint = "This version parameter is used to detect when a change has been made to the formula that is incompatible with the previous version. When that happens, this field will reflect the old version number to alert you to the fact that an alternate rendering is being used."
visible = @v_dmj_gaussianblur < 100
endparam
float param p_radius
caption = "Filter Radius"
default = 0.1
hint = "Sets the radius of the filter. A smaller radius will result in less blurring."
endparam
int param p_samples
caption = "Sample Density"
default = 9
min = 1
hint = "Sets the density of samples used to compute the blur. Increasing the density will dramatically increase the rendering time (increasing with 4x the square of the density) but for very wide blurs you will need to do this to get even blurring."
endparam
}
Methods inherited from class Object |
|
DMJ_GaussianBlur
public DMJ_GaussianBlur(Generic pparent)
DMJ_GaussianBlur
public DMJ_GaussianBlur()