Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAntony Riakiotakis <kalast@gmail.com>2015-02-26 01:30:50 +0300
committerAntony Riakiotakis <kalast@gmail.com>2015-02-26 01:30:50 +0300
commit7708012b9daddbbdc6bb949f9610537754db3887 (patch)
treec0cf49e807c9491375cdde3743d86b4c0202e252
parent22ab4e6e13ebaabe3960af539e46a5bdfaf9f877 (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.
-rw-r--r--source/blender/gpu/intern/gpu_compositing.c12
-rw-r--r--source/blender/makesrna/intern/rna_scene.c4
2 files changed, 8 insertions, 8 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;
}
diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c
index c5eed3ff18c..13350f653b8 100644
--- a/source/blender/makesrna/intern/rna_scene.c
+++ b/source/blender/makesrna/intern/rna_scene.c
@@ -3903,8 +3903,8 @@ static void rna_def_gpu_ssao_fx(BlenderRNA *brna)
RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
prop = RNA_def_property(srna, "samples", PROP_INT, PROP_NONE);
- RNA_def_property_ui_text(prop, "Samples", "Number of samples (final number is squared)");
- RNA_def_property_range(prop, 1, 30); /* 0 is needed for compression. */
+ RNA_def_property_ui_text(prop, "Samples", "Number of samples");
+ RNA_def_property_range(prop, 1, 500);
RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
prop = RNA_def_property(srna, "color", PROP_FLOAT, PROP_COLOR_GAMMA);