[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [41366] branches/cycles/intern/cycles: Cycles: seed value to get different noise values from renders, there was a patch
Brecht Van Lommel
brechtvanlommel at pandora.be
Sat Oct 29 16:27:24 CEST 2011
Revision: 41366
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=41366
Author: blendix
Date: 2011-10-29 14:27:24 +0000 (Sat, 29 Oct 2011)
Log Message:
-----------
Cycles: seed value to get different noise values from renders, there was a patch
for this but I've implemented it differently.
Modified Paths:
--------------
branches/cycles/intern/cycles/blender/addon/properties.py
branches/cycles/intern/cycles/blender/addon/ui.py
branches/cycles/intern/cycles/blender/blender_sync.cpp
branches/cycles/intern/cycles/kernel/kernel_random.h
branches/cycles/intern/cycles/kernel/kernel_types.h
branches/cycles/intern/cycles/render/integrator.cpp
branches/cycles/intern/cycles/render/integrator.h
branches/cycles/intern/cycles/util/util_hash.h
Modified: branches/cycles/intern/cycles/blender/addon/properties.py
===================================================================
--- branches/cycles/intern/cycles/blender/addon/properties.py 2011-10-29 14:24:06 UTC (rev 41365)
+++ branches/cycles/intern/cycles/blender/addon/properties.py 2011-10-29 14:27:24 UTC (rev 41366)
@@ -78,6 +78,9 @@
cls.filter_width = FloatProperty(name="Filter Width", description="Pixel filter width",
default=1.5, min=0.01, max=10.0)
+ cls.seed = IntProperty(name="Seed", description="Seed value for integrator to get different noise patterns",
+ default=0, min=0, max=2147483647)
+
cls.debug_tile_size = IntProperty(name="Tile Size", description="",
default=1024, min=1, max=4096)
cls.debug_min_size = IntProperty(name="Min Size", description="",
Modified: branches/cycles/intern/cycles/blender/addon/ui.py
===================================================================
--- branches/cycles/intern/cycles/blender/addon/ui.py 2011-10-29 14:24:06 UTC (rev 41365)
+++ branches/cycles/intern/cycles/blender/addon/ui.py 2011-10-29 14:27:24 UTC (rev 41366)
@@ -62,13 +62,13 @@
sub.label(text="Samples:")
sub.prop(cscene, "samples", text="Render")
sub.prop(cscene, "preview_samples", text="Preview")
+ sub.prop(cscene, "seed")
sub = col.column(align=True)
sub.label("Transparency:")
sub.prop(cscene, "transparent_max_bounces", text="Max")
sub.prop(cscene, "transparent_min_bounces", text="Min")
sub.prop(cscene, "use_transparent_shadows", text="Shadows")
- sub.prop(cscene, "no_caustics")
col = split.column()
@@ -82,6 +82,7 @@
sub.prop(cscene, "diffuse_bounces", text="Diffuse")
sub.prop(cscene, "glossy_bounces", text="Glossy")
sub.prop(cscene, "transmission_bounces", text="Transmission")
+ sub.prop(cscene, "no_caustics")
#row = col.row()
#row.prop(cscene, "blur_caustics")
Modified: branches/cycles/intern/cycles/blender/blender_sync.cpp
===================================================================
--- branches/cycles/intern/cycles/blender/blender_sync.cpp 2011-10-29 14:24:06 UTC (rev 41365)
+++ branches/cycles/intern/cycles/blender/blender_sync.cpp 2011-10-29 14:27:24 UTC (rev 41366)
@@ -151,6 +151,8 @@
integrator->no_caustics = get_boolean(cscene, "no_caustics");
integrator->blur_caustics = get_float(cscene, "blur_caustics");
+ integrator->seed = get_int(cscene, "seed");
+
if(integrator->modified(previntegrator))
integrator->tag_update(scene);
}
Modified: branches/cycles/intern/cycles/kernel/kernel_random.h
===================================================================
--- branches/cycles/intern/cycles/kernel/kernel_random.h 2011-10-29 14:24:06 UTC (rev 41365)
+++ branches/cycles/intern/cycles/kernel/kernel_random.h 2011-10-29 14:27:24 UTC (rev 41366)
@@ -128,11 +128,15 @@
*rng = sobol_lookup(bits, frame, x, y, &px, &py);
+ *rng ^= kernel_data.integrator.seed;
+
*fx = size * (float)px * (1.0f/(float)0xFFFFFFFF) - x;
*fy = size * (float)py * (1.0f/(float)0xFFFFFFFF) - y;
#else
*rng = rng_state[x + y*kernel_data.cam.width];
+ *rng ^= kernel_data.integrator.seed;
+
*fx = path_rng(kg, rng, sample, PRNG_FILTER_U);
*fy = path_rng(kg, rng, sample, PRNG_FILTER_V);
#endif
@@ -159,6 +163,8 @@
/* load state */
*rng = rng_state[x + y*kernel_data.cam.width];
+ *rng ^= kernel_data.integrator.seed;
+
*fx = path_rng(kg, rng, sample, PRNG_FILTER_U);
*fy = path_rng(kg, rng, sample, PRNG_FILTER_V);
}
Modified: branches/cycles/intern/cycles/kernel/kernel_types.h
===================================================================
--- branches/cycles/intern/cycles/kernel/kernel_types.h 2011-10-29 14:24:06 UTC (rev 41365)
+++ branches/cycles/intern/cycles/kernel/kernel_types.h 2011-10-29 14:27:24 UTC (rev 41366)
@@ -362,7 +362,6 @@
int num_all_lights;
float pdf_triangles;
float pdf_lights;
- float pdf_pad;
/* bounces */
int min_bounce;
@@ -380,6 +379,9 @@
/* caustics */
int no_caustics;
float blur_caustics;
+
+ /* seed */
+ int seed;
} KernelIntegrator;
typedef struct KernelBVH {
Modified: branches/cycles/intern/cycles/render/integrator.cpp
===================================================================
--- branches/cycles/intern/cycles/render/integrator.cpp 2011-10-29 14:24:06 UTC (rev 41365)
+++ branches/cycles/intern/cycles/render/integrator.cpp 2011-10-29 14:27:24 UTC (rev 41366)
@@ -21,6 +21,8 @@
#include "scene.h"
#include "sobol.h"
+#include "util_hash.h"
+
CCL_NAMESPACE_BEGIN
Integrator::Integrator()
@@ -41,6 +43,8 @@
no_caustics = false;
blur_caustics = 0.0f;
+ seed = 0;
+
need_update = true;
}
@@ -79,6 +83,8 @@
kintegrator->no_caustics = no_caustics;
kintegrator->blur_caustics = blur_caustics;
+ kintegrator->seed = hash_int(seed);
+
/* sobol directions table */
int dimensions = PRNG_BASE_NUM + (max_bounce + transparent_max_bounce + 2)*PRNG_BOUNCE_NUM;
uint *directions = dscene->sobol_directions.resize(SOBOL_BITS*dimensions);
@@ -109,7 +115,8 @@
transparent_probalistic == integrator.transparent_probalistic &&
transparent_shadows == integrator.transparent_shadows &&
no_caustics == integrator.no_caustics &&
- blur_caustics == integrator.blur_caustics);
+ blur_caustics == integrator.blur_caustics &&
+ seed == integrator.seed);
}
void Integrator::tag_update(Scene *scene)
Modified: branches/cycles/intern/cycles/render/integrator.h
===================================================================
--- branches/cycles/intern/cycles/render/integrator.h 2011-10-29 14:24:06 UTC (rev 41365)
+++ branches/cycles/intern/cycles/render/integrator.h 2011-10-29 14:27:24 UTC (rev 41366)
@@ -42,6 +42,9 @@
bool no_caustics;
float blur_caustics;
+
+ int seed;
+
bool need_update;
Integrator();
Modified: branches/cycles/intern/cycles/util/util_hash.h
===================================================================
--- branches/cycles/intern/cycles/util/util_hash.h 2011-10-29 14:24:06 UTC (rev 41365)
+++ branches/cycles/intern/cycles/util/util_hash.h 2011-10-29 14:27:24 UTC (rev 41366)
@@ -44,6 +44,11 @@
#undef rot
}
+static unsigned int hash_int(unsigned int k)
+{
+ return hash_int_2d(k, 0);
+}
+
CCL_NAMESPACE_END
#endif /* __UTIL_HASH_H__ */
More information about the Bf-blender-cvs
mailing list