forked from bartvdbraak/blender
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:
parent
996f2cd8b2
commit
238f3a7d34
@ -78,6 +78,9 @@ class CyclesRenderSettings(bpy.types.PropertyGroup):
|
||||
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="",
|
||||
|
@ -62,13 +62,13 @@ class CyclesRender_PT_integrator(CyclesButtonsPanel, Panel):
|
||||
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 @@ class CyclesRender_PT_integrator(CyclesButtonsPanel, Panel):
|
||||
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")
|
||||
|
@ -151,6 +151,8 @@ void BlenderSync::sync_integrator()
|
||||
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);
|
||||
}
|
||||
|
@ -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 ^= 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 @@ __device void path_rng_init(KernelGlobals *kg, __global uint *rng_state, int sam
|
||||
/* 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);
|
||||
}
|
||||
|
@ -362,7 +362,6 @@ typedef struct KernelIntegrator {
|
||||
int num_all_lights;
|
||||
float pdf_triangles;
|
||||
float pdf_lights;
|
||||
float pdf_pad;
|
||||
|
||||
/* bounces */
|
||||
int min_bounce;
|
||||
@ -380,6 +379,9 @@ typedef struct KernelIntegrator {
|
||||
/* caustics */
|
||||
int no_caustics;
|
||||
float blur_caustics;
|
||||
|
||||
/* seed */
|
||||
int seed;
|
||||
} KernelIntegrator;
|
||||
|
||||
typedef struct KernelBVH {
|
||||
|
@ -21,6 +21,8 @@
|
||||
#include "scene.h"
|
||||
#include "sobol.h"
|
||||
|
||||
#include "util_hash.h"
|
||||
|
||||
CCL_NAMESPACE_BEGIN
|
||||
|
||||
Integrator::Integrator()
|
||||
@ -41,6 +43,8 @@ Integrator::Integrator()
|
||||
no_caustics = false;
|
||||
blur_caustics = 0.0f;
|
||||
|
||||
seed = 0;
|
||||
|
||||
need_update = true;
|
||||
}
|
||||
|
||||
@ -79,6 +83,8 @@ void Integrator::device_update(Device *device, DeviceScene *dscene)
|
||||
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 @@ bool Integrator::modified(const Integrator& integrator)
|
||||
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)
|
||||
|
@ -42,6 +42,9 @@ public:
|
||||
|
||||
bool no_caustics;
|
||||
float blur_caustics;
|
||||
|
||||
int seed;
|
||||
|
||||
bool need_update;
|
||||
|
||||
Integrator();
|
||||
|
@ -44,6 +44,11 @@ static unsigned int hash_int_2d(unsigned int kx, unsigned int ky)
|
||||
#undef rot
|
||||
}
|
||||
|
||||
static unsigned int hash_int(unsigned int k)
|
||||
{
|
||||
return hash_int_2d(k, 0);
|
||||
}
|
||||
|
||||
CCL_NAMESPACE_END
|
||||
|
||||
#endif /* __UTIL_HASH_H__ */
|
||||
|
Loading…
Reference in New Issue
Block a user