diff options
author | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2011-09-01 19:53:36 +0400 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2011-09-01 19:53:36 +0400 |
commit | df625253ac0dec5be70701e2694c1e0358343fbf (patch) | |
tree | 10b216af9eb607023a3b280b8641acf336e34b10 /intern/cycles/kernel | |
parent | 1e741b3a52cc44b7a3ee173f180fd3d99c958efc (diff) |
Cycles:
* Add max diffuse/glossy/transmission bounces
* Add separate min/max for transparent depth
* Updated/added some presets that use these options
* Add ray visibility options for objects, to hide them from
camera/diffuse/glossy/transmission/shadow rays
* Is singular ray output for light path node
Details here:
http://wiki.blender.org/index.php/Dev:2.5/Source/Render/Cycles/LightPaths
Diffstat (limited to 'intern/cycles/kernel')
-rw-r--r-- | intern/cycles/kernel/kernel.cpp | 4 | ||||
-rw-r--r-- | intern/cycles/kernel/kernel_bvh.h | 38 | ||||
-rw-r--r-- | intern/cycles/kernel/kernel_path.h | 172 | ||||
-rw-r--r-- | intern/cycles/kernel/kernel_textures.h | 1 | ||||
-rw-r--r-- | intern/cycles/kernel/kernel_types.h | 23 | ||||
-rw-r--r-- | intern/cycles/kernel/osl/nodes/node_light_path.osl | 2 | ||||
-rw-r--r-- | intern/cycles/kernel/osl/osl_shader.cpp | 4 | ||||
-rw-r--r-- | intern/cycles/kernel/svm/bsdf_transparent.h | 2 | ||||
-rw-r--r-- | intern/cycles/kernel/svm/svm_light_path.h | 1 | ||||
-rw-r--r-- | intern/cycles/kernel/svm/svm_noise.h | 17 | ||||
-rw-r--r-- | intern/cycles/kernel/svm/svm_texture.h | 4 | ||||
-rw-r--r-- | intern/cycles/kernel/svm/svm_types.h | 1 |
12 files changed, 175 insertions, 94 deletions
diff --git a/intern/cycles/kernel/kernel.cpp b/intern/cycles/kernel/kernel.cpp index d9ba237d964..01682d11f33 100644 --- a/intern/cycles/kernel/kernel.cpp +++ b/intern/cycles/kernel/kernel.cpp @@ -89,6 +89,10 @@ void kernel_tex_copy(KernelGlobals *kg, const char *name, device_ptr mem, size_t kg->__tri_woop.data = (float4*)mem; kg->__tri_woop.width = width; } + else if(strcmp(name, "__prim_visibility") == 0) { + kg->__prim_visibility.data = (uint*)mem; + kg->__prim_visibility.width = width; + } else if(strcmp(name, "__prim_index") == 0) { kg->__prim_index.data = (uint*)mem; kg->__prim_index.width = width; diff --git a/intern/cycles/kernel/kernel_bvh.h b/intern/cycles/kernel/kernel_bvh.h index 4dea540e31c..df7663b5555 100644 --- a/intern/cycles/kernel/kernel_bvh.h +++ b/intern/cycles/kernel/kernel_bvh.h @@ -78,7 +78,7 @@ __device_inline void bvh_instance_pop(KernelGlobals *kg, int object, const Ray * __device_inline void bvh_node_intersect(KernelGlobals *kg, bool *traverseChild0, bool *traverseChild1, bool *closestChild1, int *nodeAddr0, int *nodeAddr1, - float3 P, float3 idir, float t, int nodeAddr) + float3 P, float3 idir, float t, uint visibility, int nodeAddr) { /* fetch node data */ float4 n0xy = kernel_tex_fetch(__bvh_nodes, nodeAddr*BVH_NODE_SIZE+0); @@ -111,8 +111,14 @@ __device_inline void bvh_node_intersect(KernelGlobals *kg, float c1max = min4(max(c1lox, c1hix), max(c1loy, c1hiy), max(c1loz, c1hiz), t); /* decide which nodes to traverse next */ +#ifdef __VISIBILITY_FLAG__ + /* this visibility test gives a 5% performance hit, how to solve? */ + *traverseChild0 = (c0max >= c0min) && (__float_as_int(cnodes.z) & visibility); + *traverseChild1 = (c1max >= c1min) && (__float_as_int(cnodes.w) & visibility); +#else *traverseChild0 = (c0max >= c0min); *traverseChild1 = (c1max >= c1min); +#endif *nodeAddr0 = __float_as_int(cnodes.x); *nodeAddr1 = __float_as_int(cnodes.y); @@ -121,7 +127,8 @@ __device_inline void bvh_node_intersect(KernelGlobals *kg, } /* Sven Woop's algorithm */ -__device_inline void bvh_triangle_intersect(KernelGlobals *kg, Intersection *isect, float3 P, float3 idir, int object, int triAddr) +__device_inline void bvh_triangle_intersect(KernelGlobals *kg, Intersection *isect, + float3 P, float3 idir, uint visibility, int object, int triAddr) { /* compute and check intersection t-value */ float4 v00 = kernel_tex_fetch(__tri_woop, triAddr*TRI_NODE_SIZE+0); @@ -146,18 +153,25 @@ __device_inline void bvh_triangle_intersect(KernelGlobals *kg, Intersection *ise float v = Oy + t*Dy; if(v >= 0.0f && u + v <= 1.0f) { - /* record intersection */ - isect->prim = triAddr; - isect->object = object; - isect->u = u; - isect->v = v; - isect->t = t; +#ifdef __VISIBILITY_FLAG__ + /* visibility flag test. we do it here under the assumption + that most triangles are culled by node flags */ + if(kernel_tex_fetch(__prim_visibility, triAddr) & visibility) +#endif + { + /* record intersection */ + isect->prim = triAddr; + isect->object = object; + isect->u = u; + isect->v = v; + isect->t = t; + } } } } } -__device_inline bool scene_intersect(KernelGlobals *kg, const Ray *ray, const bool isshadowray, Intersection *isect) +__device_inline bool scene_intersect(KernelGlobals *kg, const Ray *ray, const uint visibility, Intersection *isect) { /* traversal stack in CUDA thread-local memory */ int traversalStack[BVH_STACK_SIZE]; @@ -191,7 +205,7 @@ __device_inline bool scene_intersect(KernelGlobals *kg, const Ray *ray, const bo bvh_node_intersect(kg, &traverseChild0, &traverseChild1, &closestChild1, &nodeAddr, &nodeAddrChild1, - P, idir, isect->t, nodeAddr); + P, idir, isect->t, visibility, nodeAddr); if(traverseChild0 != traverseChild1) { /* one child was intersected */ @@ -236,10 +250,10 @@ __device_inline bool scene_intersect(KernelGlobals *kg, const Ray *ray, const bo /* triangle intersection */ while(primAddr < primAddr2) { /* intersect ray against triangle */ - bvh_triangle_intersect(kg, isect, P, idir, object, primAddr); + bvh_triangle_intersect(kg, isect, P, idir, visibility, object, primAddr); /* shadow ray early termination */ - if(isshadowray && isect->prim != ~0) + if(visibility == PATH_RAY_SHADOW && isect->prim != ~0) return true; primAddr++; diff --git a/intern/cycles/kernel/kernel_path.h b/intern/cycles/kernel/kernel_path.h index d4ed4651751..7f7aaad3270 100644 --- a/intern/cycles/kernel/kernel_path.h +++ b/intern/cycles/kernel/kernel_path.h @@ -58,51 +58,108 @@ __device float3 path_terminate_modified_throughput(KernelGlobals *kg, __global f } #endif -__device float path_terminate_probability(KernelGlobals *kg, int bounce, const float3 throughput) -{ - if(bounce >= kernel_data.integrator.maxbounce) - return 0.0f; - else if(bounce <= kernel_data.integrator.minbounce) - return 1.0f; +typedef struct PathState { + uint flag; + int bounce; - return average(throughput); + int diffuse_bounce; + int glossy_bounce; + int transmission_bounce; + int transparent_bounce; +} PathState; + +__device_inline void path_state_init(PathState *state) +{ + state->flag = PATH_RAY_CAMERA|PATH_RAY_SINGULAR; + state->bounce = 0; + state->diffuse_bounce = 0; + state->glossy_bounce = 0; + state->transmission_bounce = 0; + state->transparent_bounce = 0; } -__device int path_flag_from_label(int path_flag, int label) +__device_inline void path_state_next(PathState *state, int label) { - /* reflect/transmit */ + /* ray through transparent keeps same flags from previous ray and is + not counted as a regular bounce, transparent has separate max */ + if(label & LABEL_TRANSPARENT) { + state->flag |= PATH_RAY_TRANSPARENT; + state->transparent_bounce++; + + return; + } + + state->bounce++; + + /* reflection/transmission */ if(label & LABEL_REFLECT) { - path_flag |= PATH_RAY_REFLECT; - path_flag &= ~PATH_RAY_TRANSMIT; + state->flag |= PATH_RAY_REFLECT; + state->flag &= ~(PATH_RAY_TRANSMIT|PATH_RAY_CAMERA|PATH_RAY_TRANSPARENT); + + if(label & LABEL_DIFFUSE) + state->diffuse_bounce++; + else + state->glossy_bounce++; } else { kernel_assert(label & LABEL_TRANSMIT); - path_flag |= PATH_RAY_TRANSMIT; - path_flag &= ~PATH_RAY_REFLECT; + state->flag |= PATH_RAY_TRANSMIT; + state->flag &= ~(PATH_RAY_REFLECT|PATH_RAY_CAMERA|PATH_RAY_TRANSPARENT); + + state->transmission_bounce++; } /* diffuse/glossy/singular */ if(label & LABEL_DIFFUSE) { - path_flag |= PATH_RAY_DIFFUSE; - path_flag &= ~(PATH_RAY_GLOSSY|PATH_RAY_SINGULAR); + state->flag |= PATH_RAY_DIFFUSE; + state->flag &= ~(PATH_RAY_GLOSSY|PATH_RAY_SINGULAR); } else if(label & LABEL_GLOSSY) { - path_flag |= PATH_RAY_GLOSSY; - path_flag &= ~(PATH_RAY_DIFFUSE|PATH_RAY_SINGULAR); + state->flag |= PATH_RAY_GLOSSY; + state->flag &= ~(PATH_RAY_DIFFUSE|PATH_RAY_SINGULAR); } else { - kernel_assert(label & (LABEL_SINGULAR|LABEL_STRAIGHT)); + kernel_assert(label & LABEL_SINGULAR); + + state->flag |= PATH_RAY_GLOSSY|PATH_RAY_SINGULAR; + state->flag &= ~PATH_RAY_DIFFUSE; + } +} + +__device_inline uint path_state_ray_visibility(PathState *state) +{ + uint flag = state->flag; + + /* for visibility, diffuse/glossy are for reflection only */ + if(flag & PATH_RAY_TRANSMIT) + flag &= ~(PATH_RAY_DIFFUSE|PATH_RAY_GLOSSY); - path_flag |= PATH_RAY_SINGULAR; - path_flag &= ~(PATH_RAY_DIFFUSE|PATH_RAY_GLOSSY); + return flag; +} + +__device_inline float path_state_terminate_probability(KernelGlobals *kg, PathState *state, const float3 throughput) +{ + if(state->flag & PATH_RAY_TRANSPARENT) { + /* transparent rays treated separately */ + if(state->transparent_bounce >= kernel_data.integrator.transparent_max_bounce) + return 0.0f; + else if(state->transparent_bounce <= kernel_data.integrator.transparent_min_bounce) + return 1.0f; } - - /* ray through transparent is still camera ray */ - if(!(label & LABEL_STRAIGHT)) - path_flag &= ~PATH_RAY_CAMERA; - - return path_flag; + else { + /* other rays */ + if((state->bounce >= kernel_data.integrator.max_bounce) || + (state->diffuse_bounce >= kernel_data.integrator.max_diffuse_bounce) || + (state->glossy_bounce >= kernel_data.integrator.max_glossy_bounce) || + (state->transmission_bounce >= kernel_data.integrator.max_transmission_bounce)) + return 0.0f; + else if(state->bounce <= kernel_data.integrator.min_bounce) + return 1.0f; + } + + /* probalistic termination */ + return average(throughput); } __device float4 kernel_path_integrate(KernelGlobals *kg, RNG *rng, int pass, Ray ray, float3 throughput) @@ -114,24 +171,27 @@ __device float4 kernel_path_integrate(KernelGlobals *kg, RNG *rng, int pass, Ray #ifdef __EMISSION__ float ray_pdf = 0.0f; #endif - int path_flag = PATH_RAY_CAMERA|PATH_RAY_SINGULAR; + PathState state; int rng_offset = PRNG_BASE_NUM; + path_state_init(&state); + /* path iteration */ - for(int bounce = 0; ; bounce++, rng_offset += PRNG_BOUNCE_NUM) { + for(;; rng_offset += PRNG_BOUNCE_NUM) { /* intersect scene */ Intersection isect; + uint visibility = path_state_ray_visibility(&state); - if(!scene_intersect(kg, &ray, false, &isect)) { + if(!scene_intersect(kg, &ray, visibility, &isect)) { /* eval background shader if nothing hit */ - if(kernel_data.background.transparent && (path_flag & PATH_RAY_CAMERA)) { + if(kernel_data.background.transparent && (state.flag & PATH_RAY_CAMERA)) { Ltransparent += average(throughput); } else { #ifdef __BACKGROUND__ ShaderData sd; shader_setup_from_background(kg, &sd, &ray); - L += throughput*shader_eval_background(kg, &sd, path_flag); + L += throughput*shader_eval_background(kg, &sd, state.flag); shader_release(kg, &sd); #else L += make_float3(0.8f, 0.8f, 0.8f); @@ -145,10 +205,10 @@ __device float4 kernel_path_integrate(KernelGlobals *kg, RNG *rng, int pass, Ray ShaderData sd; shader_setup_from_ray(kg, &sd, &isect, &ray); float rbsdf = path_rng(kg, rng, pass, rng_offset + PRNG_BSDF); - shader_eval_surface(kg, &sd, rbsdf, path_flag); + shader_eval_surface(kg, &sd, rbsdf, state.flag); #ifdef __HOLDOUT__ - if((sd.flag & SD_HOLDOUT) && (path_flag & PATH_RAY_CAMERA)) { + if((sd.flag & SD_HOLDOUT) && (state.flag & PATH_RAY_CAMERA)) { float3 holdout_weight = shader_holdout_eval(kg, &sd); if(kernel_data.background.transparent) @@ -160,11 +220,25 @@ __device float4 kernel_path_integrate(KernelGlobals *kg, RNG *rng, int pass, Ray /* emission */ if(kernel_data.integrator.use_emission) { if(sd.flag & SD_EMISSION) - L += throughput*indirect_emission(kg, &sd, isect.t, path_flag, ray_pdf); + L += throughput*indirect_emission(kg, &sd, isect.t, state.flag, ray_pdf); + } +#endif + + /* path termination. this is a strange place to put the termination, it's + mainly due to the mixed in MIS that we use. gives too many unneeded + shader evaluations, only need emission if we are going to terminate */ + float probability = path_state_terminate_probability(kg, &state, throughput); + float terminate = path_rng(kg, rng, pass, rng_offset + PRNG_TERMINATE); + if(terminate >= probability) + break; + + throughput /= probability; + +#ifdef __EMISSION__ + if(kernel_data.integrator.use_emission) { /* sample illumination from lights to find path contribution */ - if((sd.flag & SD_BSDF_HAS_EVAL) && - bounce != kernel_data.integrator.maxbounce) { + if(sd.flag & SD_BSDF_HAS_EVAL) { float light_t = path_rng(kg, rng, pass, rng_offset + PRNG_LIGHT); float light_o = path_rng(kg, rng, pass, rng_offset + PRNG_LIGHT_F); float light_u = path_rng(kg, rng, pass, rng_offset + PRNG_LIGHT_U); @@ -173,9 +247,11 @@ __device float4 kernel_path_integrate(KernelGlobals *kg, RNG *rng, int pass, Ray Ray light_ray; float3 light_L; + /* todo: use visbility flag to skip lights */ + if(direct_emission(kg, &sd, light_t, light_o, light_u, light_v, &light_ray, &light_L)) { /* trace shadow ray */ - if(!scene_intersect(kg, &light_ray, true, &isect)) + if(!scene_intersect(kg, &light_ray, PATH_RAY_SHADOW, &isect)) L += throughput*light_L; } } @@ -183,10 +259,8 @@ __device float4 kernel_path_integrate(KernelGlobals *kg, RNG *rng, int pass, Ray #endif /* no BSDF? we can stop here */ - if(!(sd.flag & SD_BSDF)) { - path_flag &= ~PATH_RAY_CAMERA; + if(!(sd.flag & SD_BSDF)) break; - } /* sample BSDF */ float bsdf_pdf; @@ -202,10 +276,8 @@ __device float4 kernel_path_integrate(KernelGlobals *kg, RNG *rng, int pass, Ray shader_release(kg, &sd); - if(bsdf_pdf == 0.0f || is_zero(bsdf_eval)) { - path_flag &= ~PATH_RAY_CAMERA; + if(bsdf_pdf == 0.0f || is_zero(bsdf_eval)) break; - } /* modify throughput */ throughput *= bsdf_eval/bsdf_pdf; @@ -215,18 +287,8 @@ __device float4 kernel_path_integrate(KernelGlobals *kg, RNG *rng, int pass, Ray ray_pdf = bsdf_pdf; #endif - path_flag = path_flag_from_label(path_flag, label); - - /* path termination */ - float probability = path_terminate_probability(kg, bounce, throughput); - float terminate = path_rng(kg, rng, pass, rng_offset + PRNG_TERMINATE); - - if(terminate >= probability) { - path_flag &= ~PATH_RAY_CAMERA; - break; - } - - throughput /= probability; + /* update path state */ + path_state_next(&state, label); /* setup ray */ ray.P = ray_offset(sd.P, (label & LABEL_TRANSMIT)? -sd.Ng: sd.Ng); diff --git a/intern/cycles/kernel/kernel_textures.h b/intern/cycles/kernel/kernel_textures.h index dd4566ec184..19635b2664c 100644 --- a/intern/cycles/kernel/kernel_textures.h +++ b/intern/cycles/kernel/kernel_textures.h @@ -11,6 +11,7 @@ /* bvh */ KERNEL_TEX(float4, texture_float4, __bvh_nodes) KERNEL_TEX(float4, texture_float4, __tri_woop) +KERNEL_TEX(uint, texture_uint, __prim_visibility) KERNEL_TEX(uint, texture_uint, __prim_index) KERNEL_TEX(uint, texture_uint, __prim_object) KERNEL_TEX(uint, texture_uint, __object_node) diff --git a/intern/cycles/kernel/kernel_types.h b/intern/cycles/kernel/kernel_types.h index 06581d593e4..5881f090944 100644 --- a/intern/cycles/kernel/kernel_types.h +++ b/intern/cycles/kernel/kernel_types.h @@ -34,11 +34,14 @@ CCL_NAMESPACE_BEGIN #define __BACKGROUND__ #define __EMISSION__ #define __CAUSTICS_TRICKS__ +#define __VISIBILITY_FLAG__ + #ifndef __KERNEL_OPENCL__ #define __SVM__ #define __TEXTURES__ #define __HOLDOUT__ #endif + #define __RAY_DIFFERENTIALS__ #define __CAMERA_CLIPPING__ #define __INTERSECTION_REFINE__ @@ -76,7 +79,8 @@ enum PathRayFlag { PATH_RAY_TRANSMIT = 8, PATH_RAY_DIFFUSE = 16, PATH_RAY_GLOSSY = 32, - PATH_RAY_SINGULAR = 64 + PATH_RAY_SINGULAR = 64, + PATH_RAY_TRANSPARENT = 128 }; /* Bidirectional Path Tracing */ @@ -115,7 +119,7 @@ typedef enum ClosureLabel { LABEL_DIFFUSE = 128, LABEL_GLOSSY = 256, LABEL_SINGULAR = 512, - LABEL_STRAIGHT = 1024, + LABEL_TRANSPARENT = 1024, LABEL_STOP = 2048 } ClosureLabel; @@ -351,9 +355,18 @@ typedef struct KernelIntegrator { float pdf_triangles; float pdf_lights; - /* path tracing */ - int minbounce; - int maxbounce; + /* bounces */ + int min_bounce; + int max_bounce; + + int max_diffuse_bounce; + int max_glossy_bounce; + int max_transmission_bounce; + + /* transparent */ + int transparent_min_bounce; + int transparent_max_bounce; + int transparent_shadows; /* caustics */ int no_caustics; diff --git a/intern/cycles/kernel/osl/nodes/node_light_path.osl b/intern/cycles/kernel/osl/nodes/node_light_path.osl index 081640428ab..0ead20bf2bb 100644 --- a/intern/cycles/kernel/osl/nodes/node_light_path.osl +++ b/intern/cycles/kernel/osl/nodes/node_light_path.osl @@ -23,6 +23,7 @@ shader node_light_path( output float IsShadowRay = 0.0, output float IsDiffuseRay = 0.0, output float IsGlossyRay = 0.0, + output float IsSingularRay = 0.0, output float IsReflectionRay = 0.0, output float IsTransmissionRay = 0.0) { @@ -30,6 +31,7 @@ shader node_light_path( IsShadowRay = raytype("shadow"); IsDiffuseRay = raytype("diffuse"); IsGlossyRay = raytype("glossy"); + IsSingularRay = raytype("singular"); IsReflectionRay = raytype("reflection"); IsTransmissionRay = raytype("refraction"); } diff --git a/intern/cycles/kernel/osl/osl_shader.cpp b/intern/cycles/kernel/osl/osl_shader.cpp index 007d14b526b..73ff4f41423 100644 --- a/intern/cycles/kernel/osl/osl_shader.cpp +++ b/intern/cycles/kernel/osl/osl_shader.cpp @@ -89,7 +89,7 @@ static void shaderdata_to_shaderglobals(KernelGlobals *kg, ShaderData *sd, globals->surfacearea = (sd->object == ~0)? 1.0f: object_surface_area(kg, sd->object); /* booleans */ - globals->raytype = path_flag; + globals->raytype = path_flag; /* todo: add our own ray types */ globals->backfacing = (sd->flag & SD_BACKFACING); /* don't know yet if we need this */ @@ -437,7 +437,7 @@ int OSLShader::bsdf_sample(const ShaderData *sd, float randu, float randv, float else if(uscattering == OSL::Labels::SINGULAR) label |= LABEL_SINGULAR; else - label |= LABEL_STRAIGHT; + label |= LABEL_TRANSPARENT; /* eval + pdf */ eval *= flat->weight; diff --git a/intern/cycles/kernel/svm/bsdf_transparent.h b/intern/cycles/kernel/svm/bsdf_transparent.h index 30288bf251d..1674f04955e 100644 --- a/intern/cycles/kernel/svm/bsdf_transparent.h +++ b/intern/cycles/kernel/svm/bsdf_transparent.h @@ -70,7 +70,7 @@ __device int bsdf_transparent_sample(const ShaderData *sd, float randu, float ra #endif *pdf = 1; *eval = make_float3(1, 1, 1); - return LABEL_TRANSMIT|LABEL_STRAIGHT; + return LABEL_TRANSMIT|LABEL_TRANSPARENT; } CCL_NAMESPACE_END diff --git a/intern/cycles/kernel/svm/svm_light_path.h b/intern/cycles/kernel/svm/svm_light_path.h index d6413d1569e..1b13fd93a0f 100644 --- a/intern/cycles/kernel/svm/svm_light_path.h +++ b/intern/cycles/kernel/svm/svm_light_path.h @@ -29,6 +29,7 @@ __device void svm_node_light_path(ShaderData *sd, float *stack, uint type, uint case NODE_LP_shadow: info = (path_flag & PATH_RAY_SHADOW)? 1.0f: 0.0f; break; case NODE_LP_diffuse: info = (path_flag & PATH_RAY_DIFFUSE)? 1.0f: 0.0f; break; case NODE_LP_glossy: info = (path_flag & PATH_RAY_GLOSSY)? 1.0f: 0.0f; break; + case NODE_LP_singular: info = (path_flag & PATH_RAY_SINGULAR)? 1.0f: 0.0f; break; case NODE_LP_reflection: info = (path_flag & PATH_RAY_REFLECT)? 1.0f: 0.0f; break; case NODE_LP_transmission: info = (path_flag & PATH_RAY_TRANSMIT)? 1.0f: 0.0f; break; case NODE_LP_backfacing: info = (sd->flag & SD_BACKFACING)? 1.0f: 0.0f; break; diff --git a/intern/cycles/kernel/svm/svm_noise.h b/intern/cycles/kernel/svm/svm_noise.h index 72ff353abb4..28ad028ad0e 100644 --- a/intern/cycles/kernel/svm/svm_noise.h +++ b/intern/cycles/kernel/svm/svm_noise.h @@ -209,22 +209,5 @@ __device float psnoise(float3 p, float3 pperiod) return perlin_periodic(p.x, p.y, p.z, pperiod); } -/* turbulence */ -__device_noinline float turbulence(float3 P, int oct, bool hard) -{ - float amp = 1.0f, fscale = 1.0f, sum = 0.0f; - int i; - - for(i=0; i<=oct; i++, amp *= 0.5f, fscale *= 2.0f) { - float t = noise(fscale*P); - if(hard) t = fabsf(2.0f*t - 1.0f); - sum += t * amp; - } - - sum *= ((float)(1<<oct)/(float)((1<<(oct+1))-1)); - - return sum; -} - CCL_NAMESPACE_END diff --git a/intern/cycles/kernel/svm/svm_texture.h b/intern/cycles/kernel/svm/svm_texture.h index 0bf0cf8c2cd..e273a92c988 100644 --- a/intern/cycles/kernel/svm/svm_texture.h +++ b/intern/cycles/kernel/svm/svm_texture.h @@ -42,7 +42,7 @@ __device float voronoi_distance(NodeDistanceMetric distance_metric, float3 d, fl /* Voronoi / Worley like */ -__device void voronoi(float3 p, NodeDistanceMetric distance_metric, float e, float da[4], float3 pa[4]) +__device_noinline void voronoi(float3 p, NodeDistanceMetric distance_metric, float e, float da[4], float3 pa[4]) { /* returns distances in da and point coords in pa */ int xx, yy, zz, xi, yi, zi; @@ -213,7 +213,7 @@ __device float noise_wave(NodeWaveType wave, float a) /* Turbulence */ -__device float noise_turbulence(float3 p, NodeNoiseBasis basis, int octaves, int hard) +__device_noinline float noise_turbulence(float3 p, NodeNoiseBasis basis, int octaves, int hard) { float fscale = 1.0f; float amp = 1.0f; diff --git a/intern/cycles/kernel/svm/svm_types.h b/intern/cycles/kernel/svm/svm_types.h index 786478c0c03..758ba25c07a 100644 --- a/intern/cycles/kernel/svm/svm_types.h +++ b/intern/cycles/kernel/svm/svm_types.h @@ -104,6 +104,7 @@ typedef enum NodeLightPath { NODE_LP_shadow, NODE_LP_diffuse, NODE_LP_glossy, + NODE_LP_singular, NODE_LP_reflection, NODE_LP_transmission, NODE_LP_backfacing |