diff options
author | Antony Riakiotakis <kalast@gmail.com> | 2015-02-26 01:30:50 +0300 |
---|---|---|
committer | Antony Riakiotakis <kalast@gmail.com> | 2015-02-26 01:30:50 +0300 |
commit | 7708012b9daddbbdc6bb949f9610537754db3887 (patch) | |
tree | c0cf49e807c9491375cdde3743d86b4c0202e252 /source/blender/gpu/intern/gpu_compositing.c | |
parent | 22ab4e6e13ebaabe3960af539e46a5bdfaf9f877 (diff) |
Change samples variable for SSAO - now it is actual samples, not squared
- spiral scheme is much more intuitive here. Also use float number for
spirals to avoid having samples on the same radial direction when sample
number is divisible by spiral number.
Diffstat (limited to 'source/blender/gpu/intern/gpu_compositing.c')
-rw-r--r-- | source/blender/gpu/intern/gpu_compositing.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/source/blender/gpu/intern/gpu_compositing.c b/source/blender/gpu/intern/gpu_compositing.c index d0ddc996ddf..08291d0d1c6 100644 --- a/source/blender/gpu/intern/gpu_compositing.c +++ b/source/blender/gpu/intern/gpu_compositing.c @@ -148,13 +148,13 @@ static GPUTexture * create_concentric_sample_texture(int side) } #endif -static GPUTexture * create_spiral_sample_texture(int side) +static GPUTexture * create_spiral_sample_texture(int numsaples) { GPUTexture *tex; - int numsaples = side * side; float *texels = (float *)MEM_mallocN(sizeof(float) * 2 * numsaples, "concentric_tex"); int i; - const int spirals = 8; + /* random number to ensure we don't get conciding samples every circle */ + const float spirals = 7.357; for (i = 0; i < numsaples; i++) { float r = (i + 0.5f) / (float) numsaples; @@ -163,7 +163,7 @@ static GPUTexture * create_spiral_sample_texture(int side) texels[i * 2 + 1] = r * sin(phi); } - tex = GPU_texture_create_1D_procedural(side * side, texels, NULL); + tex = GPU_texture_create_1D_procedural(numsaples, texels, NULL); MEM_freeN(texels); return tex; } @@ -642,7 +642,7 @@ bool GPU_fx_do_composite_pass(GPUFX *fx, float projmat[4][4], bool is_persp, str float ssao_params[4] = {fx_ssao->distance_max, fx_ssao->factor, fx_ssao->attenuation, 0.0f}; float sample_params[4]; - sample_params[0] = fx->ssao_sample_count * fx->ssao_sample_count; + sample_params[0] = fx->ssao_sample_count; /* multiplier so we tile the random texture on screen */ sample_params[2] = fx->gbuffer_dim[0] / 64.0; sample_params[3] = fx->gbuffer_dim[1] / 64.0; @@ -978,5 +978,5 @@ void GPU_fx_compositor_init_ssao_settings(GPUSSAOSettings *fx_ssao) fx_ssao->factor = 1.0f; fx_ssao->distance_max = 0.2f; fx_ssao->attenuation = 1.0f; - fx_ssao->samples = 4; + fx_ssao->samples = 20; } |