Cycles: seed value to get different noise values from renders, there was a patch
for this but I've implemented it differently.
This commit is contained in:
@@ -78,6 +78,9 @@ class CyclesRenderSettings(bpy.types.PropertyGroup):
|
|||||||
cls.filter_width = FloatProperty(name="Filter Width", description="Pixel filter width",
|
cls.filter_width = FloatProperty(name="Filter Width", description="Pixel filter width",
|
||||||
default=1.5, min=0.01, max=10.0)
|
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="",
|
cls.debug_tile_size = IntProperty(name="Tile Size", description="",
|
||||||
default=1024, min=1, max=4096)
|
default=1024, min=1, max=4096)
|
||||||
cls.debug_min_size = IntProperty(name="Min Size", description="",
|
cls.debug_min_size = IntProperty(name="Min Size", description="",
|
||||||
|
@@ -62,13 +62,13 @@ class CyclesRender_PT_integrator(CyclesButtonsPanel, Panel):
|
|||||||
sub.label(text="Samples:")
|
sub.label(text="Samples:")
|
||||||
sub.prop(cscene, "samples", text="Render")
|
sub.prop(cscene, "samples", text="Render")
|
||||||
sub.prop(cscene, "preview_samples", text="Preview")
|
sub.prop(cscene, "preview_samples", text="Preview")
|
||||||
|
sub.prop(cscene, "seed")
|
||||||
|
|
||||||
sub = col.column(align=True)
|
sub = col.column(align=True)
|
||||||
sub.label("Transparency:")
|
sub.label("Transparency:")
|
||||||
sub.prop(cscene, "transparent_max_bounces", text="Max")
|
sub.prop(cscene, "transparent_max_bounces", text="Max")
|
||||||
sub.prop(cscene, "transparent_min_bounces", text="Min")
|
sub.prop(cscene, "transparent_min_bounces", text="Min")
|
||||||
sub.prop(cscene, "use_transparent_shadows", text="Shadows")
|
sub.prop(cscene, "use_transparent_shadows", text="Shadows")
|
||||||
sub.prop(cscene, "no_caustics")
|
|
||||||
|
|
||||||
col = split.column()
|
col = split.column()
|
||||||
|
|
||||||
@@ -82,6 +82,7 @@ class CyclesRender_PT_integrator(CyclesButtonsPanel, Panel):
|
|||||||
sub.prop(cscene, "diffuse_bounces", text="Diffuse")
|
sub.prop(cscene, "diffuse_bounces", text="Diffuse")
|
||||||
sub.prop(cscene, "glossy_bounces", text="Glossy")
|
sub.prop(cscene, "glossy_bounces", text="Glossy")
|
||||||
sub.prop(cscene, "transmission_bounces", text="Transmission")
|
sub.prop(cscene, "transmission_bounces", text="Transmission")
|
||||||
|
sub.prop(cscene, "no_caustics")
|
||||||
|
|
||||||
#row = col.row()
|
#row = col.row()
|
||||||
#row.prop(cscene, "blur_caustics")
|
#row.prop(cscene, "blur_caustics")
|
||||||
|
@@ -151,6 +151,8 @@ void BlenderSync::sync_integrator()
|
|||||||
integrator->no_caustics = get_boolean(cscene, "no_caustics");
|
integrator->no_caustics = get_boolean(cscene, "no_caustics");
|
||||||
integrator->blur_caustics = get_float(cscene, "blur_caustics");
|
integrator->blur_caustics = get_float(cscene, "blur_caustics");
|
||||||
|
|
||||||
|
integrator->seed = get_int(cscene, "seed");
|
||||||
|
|
||||||
if(integrator->modified(previntegrator))
|
if(integrator->modified(previntegrator))
|
||||||
integrator->tag_update(scene);
|
integrator->tag_update(scene);
|
||||||
}
|
}
|
||||||
|
@@ -128,11 +128,15 @@ __device_inline void path_rng_init(KernelGlobals *kg, __global uint *rng_state,
|
|||||||
|
|
||||||
*rng = sobol_lookup(bits, frame, x, y, &px, &py);
|
*rng = sobol_lookup(bits, frame, x, y, &px, &py);
|
||||||
|
|
||||||
|
*rng ^= kernel_data.integrator.seed;
|
||||||
|
|
||||||
*fx = size * (float)px * (1.0f/(float)0xFFFFFFFF) - x;
|
*fx = size * (float)px * (1.0f/(float)0xFFFFFFFF) - x;
|
||||||
*fy = size * (float)py * (1.0f/(float)0xFFFFFFFF) - y;
|
*fy = size * (float)py * (1.0f/(float)0xFFFFFFFF) - y;
|
||||||
#else
|
#else
|
||||||
*rng = rng_state[x + y*kernel_data.cam.width];
|
*rng = rng_state[x + y*kernel_data.cam.width];
|
||||||
|
|
||||||
|
*rng ^= kernel_data.integrator.seed;
|
||||||
|
|
||||||
*fx = path_rng(kg, rng, sample, PRNG_FILTER_U);
|
*fx = path_rng(kg, rng, sample, PRNG_FILTER_U);
|
||||||
*fy = path_rng(kg, rng, sample, PRNG_FILTER_V);
|
*fy = path_rng(kg, rng, sample, PRNG_FILTER_V);
|
||||||
#endif
|
#endif
|
||||||
@@ -159,6 +163,8 @@ __device void path_rng_init(KernelGlobals *kg, __global uint *rng_state, int sam
|
|||||||
/* load state */
|
/* load state */
|
||||||
*rng = rng_state[x + y*kernel_data.cam.width];
|
*rng = rng_state[x + y*kernel_data.cam.width];
|
||||||
|
|
||||||
|
*rng ^= kernel_data.integrator.seed;
|
||||||
|
|
||||||
*fx = path_rng(kg, rng, sample, PRNG_FILTER_U);
|
*fx = path_rng(kg, rng, sample, PRNG_FILTER_U);
|
||||||
*fy = path_rng(kg, rng, sample, PRNG_FILTER_V);
|
*fy = path_rng(kg, rng, sample, PRNG_FILTER_V);
|
||||||
}
|
}
|
||||||
|
@@ -362,7 +362,6 @@ typedef struct KernelIntegrator {
|
|||||||
int num_all_lights;
|
int num_all_lights;
|
||||||
float pdf_triangles;
|
float pdf_triangles;
|
||||||
float pdf_lights;
|
float pdf_lights;
|
||||||
float pdf_pad;
|
|
||||||
|
|
||||||
/* bounces */
|
/* bounces */
|
||||||
int min_bounce;
|
int min_bounce;
|
||||||
@@ -380,6 +379,9 @@ typedef struct KernelIntegrator {
|
|||||||
/* caustics */
|
/* caustics */
|
||||||
int no_caustics;
|
int no_caustics;
|
||||||
float blur_caustics;
|
float blur_caustics;
|
||||||
|
|
||||||
|
/* seed */
|
||||||
|
int seed;
|
||||||
} KernelIntegrator;
|
} KernelIntegrator;
|
||||||
|
|
||||||
typedef struct KernelBVH {
|
typedef struct KernelBVH {
|
||||||
|
@@ -21,6 +21,8 @@
|
|||||||
#include "scene.h"
|
#include "scene.h"
|
||||||
#include "sobol.h"
|
#include "sobol.h"
|
||||||
|
|
||||||
|
#include "util_hash.h"
|
||||||
|
|
||||||
CCL_NAMESPACE_BEGIN
|
CCL_NAMESPACE_BEGIN
|
||||||
|
|
||||||
Integrator::Integrator()
|
Integrator::Integrator()
|
||||||
@@ -41,6 +43,8 @@ Integrator::Integrator()
|
|||||||
no_caustics = false;
|
no_caustics = false;
|
||||||
blur_caustics = 0.0f;
|
blur_caustics = 0.0f;
|
||||||
|
|
||||||
|
seed = 0;
|
||||||
|
|
||||||
need_update = true;
|
need_update = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -79,6 +83,8 @@ void Integrator::device_update(Device *device, DeviceScene *dscene)
|
|||||||
kintegrator->no_caustics = no_caustics;
|
kintegrator->no_caustics = no_caustics;
|
||||||
kintegrator->blur_caustics = blur_caustics;
|
kintegrator->blur_caustics = blur_caustics;
|
||||||
|
|
||||||
|
kintegrator->seed = hash_int(seed);
|
||||||
|
|
||||||
/* sobol directions table */
|
/* sobol directions table */
|
||||||
int dimensions = PRNG_BASE_NUM + (max_bounce + transparent_max_bounce + 2)*PRNG_BOUNCE_NUM;
|
int dimensions = PRNG_BASE_NUM + (max_bounce + transparent_max_bounce + 2)*PRNG_BOUNCE_NUM;
|
||||||
uint *directions = dscene->sobol_directions.resize(SOBOL_BITS*dimensions);
|
uint *directions = dscene->sobol_directions.resize(SOBOL_BITS*dimensions);
|
||||||
@@ -109,7 +115,8 @@ bool Integrator::modified(const Integrator& integrator)
|
|||||||
transparent_probalistic == integrator.transparent_probalistic &&
|
transparent_probalistic == integrator.transparent_probalistic &&
|
||||||
transparent_shadows == integrator.transparent_shadows &&
|
transparent_shadows == integrator.transparent_shadows &&
|
||||||
no_caustics == integrator.no_caustics &&
|
no_caustics == integrator.no_caustics &&
|
||||||
blur_caustics == integrator.blur_caustics);
|
blur_caustics == integrator.blur_caustics &&
|
||||||
|
seed == integrator.seed);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Integrator::tag_update(Scene *scene)
|
void Integrator::tag_update(Scene *scene)
|
||||||
|
@@ -42,6 +42,9 @@ public:
|
|||||||
|
|
||||||
bool no_caustics;
|
bool no_caustics;
|
||||||
float blur_caustics;
|
float blur_caustics;
|
||||||
|
|
||||||
|
int seed;
|
||||||
|
|
||||||
bool need_update;
|
bool need_update;
|
||||||
|
|
||||||
Integrator();
|
Integrator();
|
||||||
|
@@ -44,6 +44,11 @@ static unsigned int hash_int_2d(unsigned int kx, unsigned int ky)
|
|||||||
#undef rot
|
#undef rot
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static unsigned int hash_int(unsigned int k)
|
||||||
|
{
|
||||||
|
return hash_int_2d(k, 0);
|
||||||
|
}
|
||||||
|
|
||||||
CCL_NAMESPACE_END
|
CCL_NAMESPACE_END
|
||||||
|
|
||||||
#endif /* __UTIL_HASH_H__ */
|
#endif /* __UTIL_HASH_H__ */
|
||||||
|
Reference in New Issue
Block a user