[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [51388] trunk/blender/intern/cycles: Cycles / OSL:

Thomas Dinges blender at dingto.org
Wed Oct 17 18:16:36 CEST 2012


Revision: 51388
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=51388
Author:   dingto
Date:     2012-10-17 16:16:35 +0000 (Wed, 17 Oct 2012)
Log Message:
-----------
Cycles / OSL:
* Layer Weight is now available in OSL. 

Modified Paths:
--------------
    trunk/blender/intern/cycles/kernel/osl/nodes/CMakeLists.txt
    trunk/blender/intern/cycles/render/nodes.cpp

Added Paths:
-----------
    trunk/blender/intern/cycles/kernel/osl/nodes/node_layer_weight.osl

Removed Paths:
-------------
    trunk/blender/intern/cycles/kernel/osl/nodes/node_blend_weight.osl

Modified: trunk/blender/intern/cycles/kernel/osl/nodes/CMakeLists.txt
===================================================================
--- trunk/blender/intern/cycles/kernel/osl/nodes/CMakeLists.txt	2012-10-17 16:10:04 UTC (rev 51387)
+++ trunk/blender/intern/cycles/kernel/osl/nodes/CMakeLists.txt	2012-10-17 16:16:35 UTC (rev 51388)
@@ -29,6 +29,7 @@
 	node_hsv.osl
 	node_image_texture.osl
 	node_invert.osl
+	node_layer_weight.osl
 	node_light_path.osl
 	node_light_falloff.osl
 	node_magic_texture.osl

Deleted: trunk/blender/intern/cycles/kernel/osl/nodes/node_blend_weight.osl
===================================================================
--- trunk/blender/intern/cycles/kernel/osl/nodes/node_blend_weight.osl	2012-10-17 16:10:04 UTC (rev 51387)
+++ trunk/blender/intern/cycles/kernel/osl/nodes/node_blend_weight.osl	2012-10-17 16:16:35 UTC (rev 51388)
@@ -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_fresnel.h"
-
-shader node_blend_weight(
-	float Blend = 0.3,
-	normal Normal = N,
-	output float Fresnel = 0.0,
-	output float Facing = 0.0)
-{
-	float f = max(1.0 - Blend, 1e-5);
-	Fresnel = fresnel_dielectric(I, Normal, backfacing()? f: 1.0 / f);
-
-	Facing = abs(dot(I, Normal));
-
-	if (Blend != 0.5) {
-		Blend = clamp(Blend, 0.0, 1.0); 
-		Blend = (Blend < 0.5)? 2.0 * Blend: 0.5 / (1.0 - Blend);
-
-		Facing = powf(Facing, Blend);
-	}
-
-	Facing = 1.0 - Facing;
-}
-

Copied: trunk/blender/intern/cycles/kernel/osl/nodes/node_layer_weight.osl (from rev 51385, trunk/blender/intern/cycles/kernel/osl/nodes/node_blend_weight.osl)
===================================================================
--- trunk/blender/intern/cycles/kernel/osl/nodes/node_layer_weight.osl	                        (rev 0)
+++ trunk/blender/intern/cycles/kernel/osl/nodes/node_layer_weight.osl	2012-10-17 16:16:35 UTC (rev 51388)
@@ -0,0 +1,47 @@
+/*
+ * 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_fresnel.h"
+
+shader node_layer_weight(
+	float Blend = 0.5,
+	normal Normal = N,
+	output float Fresnel = 0.0,
+	output float Facing = 0.0)
+{
+	float blend = Blend;
+
+	/* Fresnel */ 
+	float eta = max(1.0 - Blend, 1e-5);
+	eta = backfacing()? eta: 1.0 / eta;
+	Fresnel = fresnel_dielectric(I, Normal, eta);
+
+	/* Facing */ 
+	Facing = abs(dot(I, Normal));
+
+	if (blend != 0.5) {
+		blend = clamp(blend, 0.0, 1.0); 
+		blend = (blend < 0.5)? 2.0 * blend: 0.5 / (1.0 - blend);
+
+		Facing = pow(Facing, blend);
+	}
+
+	Facing = 1.0 - Facing;
+}
+

Modified: trunk/blender/intern/cycles/render/nodes.cpp
===================================================================
--- trunk/blender/intern/cycles/render/nodes.cpp	2012-10-17 16:10:04 UTC (rev 51387)
+++ trunk/blender/intern/cycles/render/nodes.cpp	2012-10-17 16:16:35 UTC (rev 51388)
@@ -2579,7 +2579,7 @@
 
 void LayerWeightNode::compile(OSLCompiler& compiler)
 {
-	compiler.add(this, "node_blend_weight");
+	compiler.add(this, "node_layer_weight");
 }
 
 /* Output */




More information about the Bf-blender-cvs mailing list