Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrecht Van Lommel <brechtvanlommel@pandora.be>2011-11-07 01:05:58 +0400
committerBrecht Van Lommel <brechtvanlommel@pandora.be>2011-11-07 01:05:58 +0400
commitfb56dbc2afc7c8b6ffc24406ed82cbcbff090da3 (patch)
tree5832366c7147ad6ebc858312ac106b5d1571b5e5 /intern/cycles/kernel/svm/svm_voronoi.h
parent3bf96250cde08ab9ad717819114b48ccb11c2d5d (diff)
Cycles: procedural texture nodes reorganization. This will break existing files
using them, but rather do it now that I have the chance still. Highlights: * Wood and Marble merged into a single Wave texture * Clouds + Distorted Noise merged into new Noise node * Blend renamed to Gradient * Stucci removed, was mostly useful for old bump * Noise removed, will come back later, didn't actually work yet * Depth setting is now Detail socket, which accepts float values * Scale socket instead of Size socket http://wiki.blender.org/index.php/Doc:2.6/Manual/Render/Cycles/Nodes/Textures
Diffstat (limited to 'intern/cycles/kernel/svm/svm_voronoi.h')
-rw-r--r--intern/cycles/kernel/svm/svm_voronoi.h65
1 files changed, 12 insertions, 53 deletions
diff --git a/intern/cycles/kernel/svm/svm_voronoi.h b/intern/cycles/kernel/svm/svm_voronoi.h
index 36965959cc2..f5ee7851a51 100644
--- a/intern/cycles/kernel/svm/svm_voronoi.h
+++ b/intern/cycles/kernel/svm/svm_voronoi.h
@@ -20,50 +20,25 @@ CCL_NAMESPACE_BEGIN
/* Voronoi */
-__device_noinline float4 svm_voronoi(NodeDistanceMetric distance_metric, NodeVoronoiColoring coloring,
- float weight1, float weight2, float weight3, float weight4,
- float exponent, float intensity, float size, float3 p)
+__device_noinline float4 svm_voronoi(NodeVoronoiColoring coloring, float scale, float3 p)
{
- float aw1 = fabsf(weight1);
- float aw2 = fabsf(weight2);
- float aw3 = fabsf(weight3);
- float aw4 = fabsf(weight4);
- float sc = (aw1 + aw2 + aw3 + aw4);
-
- if(sc != 0.0f)
- sc = intensity/sc;
-
/* compute distance and point coordinate of 4 nearest neighbours */
float da[4];
float3 pa[4];
- voronoi(p/size, distance_metric, exponent, da, pa);
+ voronoi(p*scale, NODE_VORONOI_DISTANCE_SQUARED, 1.0f, da, pa);
- /* Scalar output */
- float fac = sc * fabsf(weight1*da[0] + weight2*da[1] + weight3*da[2] + weight4*da[3]);
+ /* output */
+ float fac;
float3 color;
- /* colored output */
if(coloring == NODE_VORONOI_INTENSITY) {
+ fac = fabsf(da[0]);
color = make_float3(fac, fac, fac);
}
else {
- color = aw1*cellnoise_color(pa[0]);
- color += aw2*cellnoise_color(pa[1]);
- color += aw3*cellnoise_color(pa[2]);
- color += aw4*cellnoise_color(pa[3]);
-
- if(coloring != NODE_VORONOI_POSITION) {
- float t1 = min((da[1] - da[0])*10.0f, 1.0f);
-
- if(coloring == NODE_VORONOI_POSITION_OUTLINE_INTENSITY)
- color *= t1*fac;
- else if(coloring == NODE_VORONOI_POSITION_OUTLINE)
- color *= t1*sc;
- }
- else {
- color *= sc;
- }
+ color = cellnoise_color(pa[0]);
+ fac= average(color);
}
return make_float4(color.x, color.y, color.z, fac);
@@ -71,31 +46,15 @@ __device_noinline float4 svm_voronoi(NodeDistanceMetric distance_metric, NodeVor
__device void svm_node_tex_voronoi(KernelGlobals *kg, ShaderData *sd, float *stack, uint4 node, int *offset)
{
- uint4 node2 = read_node(kg, offset);
- uint4 node3 = read_node(kg, offset);
+ uint coloring = node.y;
+ uint scale_offset, co_offset, fac_offset, color_offset;
- uint distance_metric, coloring, exponent_offset;
- uint size_offset, co_offset, fac_offset, color_offset;
- uint weight1_offset, weight2_offset, weight3_offset, weight4_offset;
-
- decode_node_uchar4(node.y, &distance_metric, &coloring, &exponent_offset, NULL);
- decode_node_uchar4(node.z, &size_offset, &co_offset, &fac_offset, &color_offset);
- decode_node_uchar4(node.w, &weight1_offset, &weight2_offset, &weight3_offset, &weight4_offset);
+ decode_node_uchar4(node.z, &scale_offset, &co_offset, &fac_offset, &color_offset);
float3 co = stack_load_float3(stack, co_offset);
- float weight1 = stack_load_float_default(stack, weight1_offset, node2.x);
- float weight2 = stack_load_float_default(stack, weight2_offset, node2.y);
- float weight3 = stack_load_float_default(stack, weight3_offset, node2.z);
- float weight4 = stack_load_float_default(stack, weight4_offset, node2.w);
- float exponent = stack_load_float_default(stack, exponent_offset, node3.x);
- float size = stack_load_float_default(stack, size_offset, node3.y);
-
- exponent = fmaxf(exponent, 1e-5f);
- size = nonzerof(size, 1e-5f);
+ float scale = stack_load_float_default(stack, scale_offset, node.w);
- float4 result = svm_voronoi((NodeDistanceMetric)distance_metric,
- (NodeVoronoiColoring)coloring,
- weight1, weight2, weight3, weight4, exponent, 1.0f, size, co);
+ float4 result = svm_voronoi((NodeVoronoiColoring)coloring, scale, co);
float3 color = make_float3(result.x, result.y, result.z);
float f = result.w;