Cycles: Render Passes

Currently supported passes:
* Combined, Z, Normal, Object Index, Material Index, Emission, Environment,
  Diffuse/Glossy/Transmission x Direct/Indirect/Color

Not supported yet:
* UV, Vector, Mist

Only enabled for CPU devices at the moment, will do GPU tweaks tommorrow,
also for environment importance sampling.

Documentation:
http://wiki.blender.org/index.php/Doc:2.6/Manual/Render/Cycles/Passes
This commit is contained in:
Brecht Van Lommel
2012-01-25 17:23:52 +00:00
parent 14f475fcca
commit f99343d3b8
36 changed files with 1528 additions and 243 deletions

View File

@@ -123,7 +123,7 @@ __device_inline float path_rng(KernelGlobals *kg, RNG *rng, int sample, int dime
#endif
}
__device_inline void path_rng_init(KernelGlobals *kg, __global uint *rng_state, int sample, RNG *rng, int x, int y, int offset, int stride, float *fx, float *fy)
__device_inline void path_rng_init(KernelGlobals *kg, __global uint *rng_state, int sample, RNG *rng, int x, int y, float *fx, float *fy)
{
#ifdef __SOBOL_FULL_SCREEN__
uint px, py;
@@ -135,19 +135,31 @@ __device_inline void path_rng_init(KernelGlobals *kg, __global uint *rng_state,
*rng ^= kernel_data.integrator.seed;
*fx = size * (float)px * (1.0f/(float)0xFFFFFFFF) - x;
*fy = size * (float)py * (1.0f/(float)0xFFFFFFFF) - y;
if(sample == 0) {
*fx = 0.5f;
*fy = 0.5f;
}
else {
*fx = size * (float)px * (1.0f/(float)0xFFFFFFFF) - x;
*fy = size * (float)py * (1.0f/(float)0xFFFFFFFF) - y;
}
#else
*rng = rng_state[offset + x + y*stride];
*rng = *rng_state;
*rng ^= kernel_data.integrator.seed;
*fx = path_rng(kg, rng, sample, PRNG_FILTER_U);
*fy = path_rng(kg, rng, sample, PRNG_FILTER_V);
if(sample == 0) {
*fx = 0.5f;
*fy = 0.5f;
}
else {
*fx = path_rng(kg, rng, sample, PRNG_FILTER_U);
*fy = path_rng(kg, rng, sample, PRNG_FILTER_V);
}
#endif
}
__device void path_rng_end(KernelGlobals *kg, __global uint *rng_state, RNG rng, int x, int y, int offset, int stride)
__device void path_rng_end(KernelGlobals *kg, __global uint *rng_state, RNG rng)
{
/* nothing to do */
}
@@ -163,21 +175,27 @@ __device float path_rng(KernelGlobals *kg, RNG *rng, int sample, int dimension)
return (float)*rng * (1.0f/(float)0xFFFFFFFF);
}
__device void path_rng_init(KernelGlobals *kg, __global uint *rng_state, int sample, RNG *rng, int x, int y, int offset, int stride, float *fx, float *fy)
__device void path_rng_init(KernelGlobals *kg, __global uint *rng_state, int sample, RNG *rng, int x, int y, float *fx, float *fy)
{
/* load state */
*rng = rng_state[offset + x + y*stride];
*rng = *rng_state;
*rng ^= kernel_data.integrator.seed;
*fx = path_rng(kg, rng, sample, PRNG_FILTER_U);
*fy = path_rng(kg, rng, sample, PRNG_FILTER_V);
if(sample == 0) {
*fx = 0.5f;
*fy = 0.5f;
}
else {
*fx = path_rng(kg, rng, sample, PRNG_FILTER_U);
*fy = path_rng(kg, rng, sample, PRNG_FILTER_V);
}
}
__device void path_rng_end(KernelGlobals *kg, __global uint *rng_state, RNG rng, int x, int y, int offset, int stride)
__device void path_rng_end(KernelGlobals *kg, __global uint *rng_state, RNG rng)
{
/* store state for next sample */
rng_state[offset + x + y*stride] = rng;
*rng_state = rng;
}
#endif