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:
authorThomas Dinges <blender@dingto.org>2012-06-03 01:34:25 +0400
committerThomas Dinges <blender@dingto.org>2012-06-03 01:34:25 +0400
commit014105f35d0d3bd0adae79c15f12e6e2e7c2e5b4 (patch)
treee5e694328efdecf9f28175e87acd3315b64e52f6 /intern/cycles
parent298d311bd665a905c2c3095a70a29c07e2fc5506 (diff)
Cycles / OSL:
* More fixes for r41599, removed clouds and distorted noise textures and ported the Noise texture to OSL. ToDo: Color output is still commented, needs a closer look. * Some more fixes (comments, uninitialized variables)
Diffstat (limited to 'intern/cycles')
-rw-r--r--intern/cycles/kernel/osl/nodes/CMakeLists.txt2
-rw-r--r--intern/cycles/kernel/osl/nodes/node_clouds_texture.osl42
-rw-r--r--intern/cycles/kernel/osl/nodes/node_distorted_noise_texture.osl46
-rw-r--r--intern/cycles/kernel/osl/nodes/node_noise_texture.osl44
-rw-r--r--intern/cycles/kernel/osl/nodes/node_wave_texture.osl3
-rw-r--r--intern/cycles/kernel/svm/svm_noisetex.h2
-rw-r--r--intern/cycles/render/nodes.cpp2
7 files changed, 38 insertions, 103 deletions
diff --git a/intern/cycles/kernel/osl/nodes/CMakeLists.txt b/intern/cycles/kernel/osl/nodes/CMakeLists.txt
index a95b49f5e04..2ee7ef04fa3 100644
--- a/intern/cycles/kernel/osl/nodes/CMakeLists.txt
+++ b/intern/cycles/kernel/osl/nodes/CMakeLists.txt
@@ -7,14 +7,12 @@ set(SRC_OSL
node_background.osl
node_bump.osl
node_camera.osl
- node_clouds_texture.osl
node_convert_from_color.osl
node_convert_from_float.osl
node_convert_from_normal.osl
node_convert_from_point.osl
node_convert_from_vector.osl
node_diffuse_bsdf.osl
- node_distorted_noise_texture.osl
node_emission.osl
node_environment_texture.osl
node_fresnel.osl
diff --git a/intern/cycles/kernel/osl/nodes/node_clouds_texture.osl b/intern/cycles/kernel/osl/nodes/node_clouds_texture.osl
deleted file mode 100644
index 6d244d81e27..00000000000
--- a/intern/cycles/kernel/osl/nodes/node_clouds_texture.osl
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Copyright 2011, Blender Foundation.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-
-#include "stdosl.h"
-#include "node_texture.h"
-
-/* Turbulence */
-
-shader node_clouds_texture(
- string Basis = "Perlin",
- int Hard = 0,
- int Depth = 2,
- float Size = 0.25,
- point Vector = P,
- output float Fac = 0.0,
- output color Color = color(0.0, 0.0, 0.0))
-{
- float size = nonzero(Size, 1e-5);
- point p = Vector/size;
-
- Fac = noise_turbulence(p, Basis, Depth, Hard);
-
- Color[0] = Fac;
- Color[1] = noise_turbulence(point(p[1], p[0], p[2]), Basis, Depth, Hard);
- Color[2] = noise_turbulence(point(p[1], p[2], p[0]), Basis, Depth, Hard);
-}
-
diff --git a/intern/cycles/kernel/osl/nodes/node_distorted_noise_texture.osl b/intern/cycles/kernel/osl/nodes/node_distorted_noise_texture.osl
deleted file mode 100644
index bb338c4ef0f..00000000000
--- a/intern/cycles/kernel/osl/nodes/node_distorted_noise_texture.osl
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Copyright 2011, Blender Foundation.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-
-#include "stdosl.h"
-#include "node_texture.h"
-
-/* Distorted Noise (variable lacunarity noise) */
-
-float noise_distorted(point p, string basis, string distortion_basis, float distortion)
-{
- point r;
-
- r[0] = noise_basis(p + point(13.5), basis) * distortion;
- r[1] = noise_basis(p, basis) * distortion;
- r[2] = noise_basis(p - point(13.5), basis) * distortion;
-
- return noise_basis(p + r, distortion_basis); /* distorted-domain noise */
-}
-
-shader node_distorted_noise_texture(
- string Basis = "Perlin",
- string DistortionBasis = "Perlin",
- float Distortion = 1.0,
- float Size = 0.25,
- point Vector = P,
- output float Fac = 0.0)
-{
- float size = nonzero(Size, 1e-5);
- Fac = noise_distorted(Vector/size, Basis, DistortionBasis, Distortion);
-}
-
diff --git a/intern/cycles/kernel/osl/nodes/node_noise_texture.osl b/intern/cycles/kernel/osl/nodes/node_noise_texture.osl
index 193ed67d16e..bc5da0ca089 100644
--- a/intern/cycles/kernel/osl/nodes/node_noise_texture.osl
+++ b/intern/cycles/kernel/osl/nodes/node_noise_texture.osl
@@ -19,18 +19,42 @@
#include "stdosl.h"
#include "node_texture.h"
-shader node_noise_texture(
- point Vector = P,
- output color Color = color(0.0, 0.0, 0.0),
- output float Fac = 0.0)
+/* Noise */
+
+float noise(point p, string basis, float distortion, float detail)
{
- point p = Vector*1e8;
+ point r;
+ int hard = 0;
+ float fac = 0.0;
+
+ if(distortion != 0.0( {
+ r[0] = noise_basis(p + point(13.5), basis) * distortion;
+ r[1] = noise_basis(p, basis) * distortion;
+ r[2] = noise_basis(p - point(13.5), basis) * distortion;
+
+ p += r;
+ }
- float r = cellnoise(p);
- float g = cellnoise(point(p[1], p[0], p[2]));
- float b = cellnoise(point(p[1], p[2], p[0]));
+ fac = noise_turbulence(p, basis, detail, hard);
+
+ return fac;
+
+ /*
+ Color[0] = Fac;
+ Color[1] = noise_turbulence(point(p[1], p[0], p[2]), basis, detail, hard);
+ Color[2] = noise_turbulence(point(p[1], p[2], p[0]), basis, detail, hard);
+ */
+}
- Fac = r;
- Color = color(r, g, b);
+shader node_distorted_noise_texture(
+ string Basis = "Perlin",
+ float Distortion = 0.0,
+ float Scale = 5.0,
+ float Detail = 2.0,
+ point Vector = P,
+ output float Fac = 0.0)
+{
+ float scale = nonzero(Scale, 1e-5);
+ Fac = noise(Vector*scale, Basis, Distortion, Detail);
}
diff --git a/intern/cycles/kernel/osl/nodes/node_wave_texture.osl b/intern/cycles/kernel/osl/nodes/node_wave_texture.osl
index affefb3e313..29563660cdc 100644
--- a/intern/cycles/kernel/osl/nodes/node_wave_texture.osl
+++ b/intern/cycles/kernel/osl/nodes/node_wave_texture.osl
@@ -27,7 +27,8 @@ float wave(point p, float scale, string type, float detail, float distortion, fl
float y = p[1] * scale;
float z = p[2] * scale;
- float result, n = 0.0;
+ float result = 0.0;
+ float n = 0.0;
if(type == "Bands") {
n = (x + y + z)*10.0);
diff --git a/intern/cycles/kernel/svm/svm_noisetex.h b/intern/cycles/kernel/svm/svm_noisetex.h
index 7421597040e..96b47a055bc 100644
--- a/intern/cycles/kernel/svm/svm_noisetex.h
+++ b/intern/cycles/kernel/svm/svm_noisetex.h
@@ -18,7 +18,7 @@
CCL_NAMESPACE_BEGIN
-/* Clouds */
+/* Noise */
__device_inline void svm_noise(float3 p, float scale, float detail, float distortion, float *fac, float3 *color)
{
diff --git a/intern/cycles/render/nodes.cpp b/intern/cycles/render/nodes.cpp
index 506458d82e1..16c6b07261a 100644
--- a/intern/cycles/render/nodes.cpp
+++ b/intern/cycles/render/nodes.cpp
@@ -755,7 +755,7 @@ void WaveTextureNode::compile(OSLCompiler& compiler)
{
compiler.parameter("Type", type);
- compiler.add(this, "node_marble_texture");
+ compiler.add(this, "node_wave_texture");
}
/* Magic Texture */