Commit: 7708012b9daddbbdc6bb949f9610537754db3887
Author: Antony Riakiotakis
Date: Wed Feb 25 23:30:50 2015 +0100
Branches: master
https://developer.blender.org/rB7708012b9daddbbdc6bb949f9610537754db3887
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.
===================================================================
M source/blender/gpu/intern/gpu_compositing.c
M source/blender/makesrna/intern/rna_scene.c
===================================================================
diff --git a/source/blender/gpu/intern/gpu_compositing.c
b/source/blender/gpu/intern/gpu_compositing.c
index d0ddc99..08291d0 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 c5eed3f..13350f6 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);
_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs