[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [14549] branches/apricot/source/blender/ gpu/intern:
Brecht Van Lommel
brechtvanlommel at pandora.be
Fri Apr 25 19:39:43 CEST 2008
Revision: 14549
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=14549
Author: blendix
Date: 2008-04-25 19:39:40 +0200 (Fri, 25 Apr 2008)
Log Message:
-----------
Apricot Branch
==============
- Added basic cook-torrance specular to the GLSL material.
Modified Paths:
--------------
branches/apricot/source/blender/gpu/intern/material_shaders.glsl
branches/apricot/source/blender/gpu/intern/material_shaders.glsl.c
Modified: branches/apricot/source/blender/gpu/intern/material_shaders.glsl
===================================================================
--- branches/apricot/source/blender/gpu/intern/material_shaders.glsl 2008-04-25 17:11:37 UTC (rev 14548)
+++ branches/apricot/source/blender/gpu/intern/material_shaders.glsl 2008-04-25 17:39:40 UTC (rev 14549)
@@ -468,15 +468,36 @@
/******* MATERIAL *********/
+float material_lambert_diff(float inp)
+{
+ return inp;
+}
+
+float material_cooktorr_spec(vec3 n, vec3 l, vec3 v, float hard)
+{
+ vec3 h = normalize(l + v);
+ float nh = max(dot(n, h), 0.0);
+ float nv = max(dot(v, v), 0.0);
+
+ float i = pow(nh, hard)/(0.1 + nv);
+
+ return i;
+}
+
void material_simple(vec4 col, float ref, vec4 spec, float specfac, float hard, vec3 normal, out vec4 combined)
{
vec3 l1 = vec3(-0.300, 0.300, 0.900);
vec3 l2 = vec3(0.500, 0.500, 0.100);
- //vec3 v = normalize(varcamco);
- //vec3 h = normalize(l + v);
+ vec4 l1col = vec4(0.9, 0.9, 0.9, 1.0);
+ vec4 l2col = vec4(0.2, 0.2, 0.5, 1.0);
+ vec3 v = -normalize(varcamco);
+ float inp;
- combined = max(-dot(normal, l1), 0.0)*ref*col*vec4(0.8, 0.8, 0.8, 1.0);
- combined += max(-dot(normal, l2), 0.0)*ref*col*vec4(0.4, 0.4, 0.8, 1.0);
- //combined += pow(max(dot(normal, h), 0.0), hard)*specfac*spec;
+ inp = max(-dot(normal, l1), 0.0);
+ combined = material_lambert_diff(inp)*ref*col*l1col;
+ inp = max(-dot(normal, l2), 0.0);
+ combined += material_lambert_diff(inp)*ref*col*l2col;
+ combined += material_cooktorr_spec(-normal, l1, v, hard)*spec*specfac*l1col;
+ combined += material_cooktorr_spec(-normal, l2, v, hard)*spec*specfac*l2col;
}
Modified: branches/apricot/source/blender/gpu/intern/material_shaders.glsl.c
===================================================================
--- branches/apricot/source/blender/gpu/intern/material_shaders.glsl.c 2008-04-25 17:11:37 UTC (rev 14548)
+++ branches/apricot/source/blender/gpu/intern/material_shaders.glsl.c 2008-04-25 17:39:40 UTC (rev 14549)
@@ -1,324 +1,338 @@
/* DataToC output of file <material_shaders_glsl> */
-int datatoc_material_shaders_glsl_size= 10156;
+int datatoc_material_shaders_glsl_size= 10611;
char datatoc_material_shaders_glsl[]= {
- 10,118, 97,114,121,105,110,103, 32,118,101, 99,
- 51, 32,118, 97,114, 99,111, 59, 10,118, 97,114,121,105,110,103, 32,118,101, 99, 51, 32,118, 97,114, 99, 97,109, 99,111, 59, 10,
-118, 97,114,121,105,110,103, 32,118,101, 99, 51, 32,118, 97,114,110,111,114,109, 97,108, 59, 10, 10, 47, 42, 42, 42, 42, 42, 42,
- 42, 42, 42, 42, 42, 32, 83, 72, 65, 68, 69, 82, 32, 78, 79, 68, 69, 83, 32, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42,
- 42, 42, 47, 10, 10,118,111,105,100, 32,103,101,111,109, 40,118,101, 99, 51, 32, 97,116,116,111,114, 99,111, 44, 32,118,101, 99,
- 50, 32, 97,116,116,117,118, 44, 32,118,101, 99, 52, 32, 97,116,116,118, 99,111,108, 44, 32,111,117,116, 32,118,101, 99, 51, 32,
-103,108,111, 98, 97,108, 44, 32,111,117,116, 32,118,101, 99, 51, 32,108,111, 99, 97,108, 44, 32,111,117,116, 32,118,101, 99, 51,
- 32,118,105,101,119, 44, 32,111,117,116, 32,118,101, 99, 51, 32,111,114, 99,111, 44, 32,111,117,116, 32,118,101, 99, 51, 32,117,
-118, 44, 32,111,117,116, 32,118,101, 99, 51, 32,110,111,114,109, 97,108, 44, 32,111,117,116, 32,118,101, 99, 52, 32,118, 99,111,
-108, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,102,114,111,110,116, 98, 97, 99,107, 41, 10,123, 10, 9,108,111, 99, 97,108,
- 32, 61, 32,118, 97,114, 99, 97,109, 99,111, 59, 10, 9,118,105,101,119, 32, 61, 32,110,111,114,109, 97,108,105,122,101, 40,108,
-111, 99, 97,108, 41, 59, 10, 9,111,114, 99,111, 32, 61, 32, 97,116,116,111,114, 99,111, 59, 10, 9,117,118, 32, 61, 32,118,101,
- 99, 51, 40, 97,116,116,117,118, 42, 50, 46, 48, 32, 45, 32,118,101, 99, 50, 40, 49, 46, 48, 44, 32, 49, 46, 48, 41, 44, 32, 48,
- 46, 48, 41, 59, 10, 9,110,111,114,109, 97,108, 32, 61, 32, 45,110,111,114,109, 97,108,105,122,101, 40,118, 97,114,110,111,114,
-109, 97,108, 41, 59, 10, 9,118, 99,111,108, 32, 61, 32,118,101, 99, 52, 40, 97,116,116,118, 99,111,108, 46,119, 47, 50, 53, 53,
- 46, 48, 44, 32, 97,116,116,118, 99,111,108, 46,122, 47, 50, 53, 53, 46, 48, 44, 32, 97,116,116,118, 99,111,108, 46,121, 47, 50,
- 53, 53, 46, 48, 44, 32, 49, 46, 48, 41, 59, 10, 9,102,114,111,110,116, 98, 97, 99,107, 32, 61, 32, 49, 46, 48, 59, 10,125, 10,
- 10,118,111,105,100, 32,109, 97,112,112,105,110,103, 40,118,101, 99, 51, 32,118,101, 99, 44, 32,109, 97,116, 52, 32,109, 97,116,
- 44, 32,118,101, 99, 51, 32,109,105,110,118,101, 99, 44, 32,118,101, 99, 51, 32,109, 97,120,118,101, 99, 44, 32,102,108,111, 97,
-116, 32,100,111,109,105,110, 44, 32,102,108,111, 97,116, 32,100,111,109, 97,120, 44, 32,111,117,116, 32,118,101, 99, 51, 32,111,
-117,116,118,101, 99, 41, 10,123, 10, 9,111,117,116,118,101, 99, 32, 61, 32, 40,109, 97,116, 32, 42, 32,118,101, 99, 52, 40,118,
-101, 99, 44, 32, 49, 46, 48, 41, 41, 46,120,121,122, 59, 10, 9,105,102, 40,100,111,109,105,110, 32, 61, 61, 32, 49, 46, 48, 41,
- 10, 9, 9,111,117,116,118,101, 99, 32, 61, 32,109, 97,120, 40,111,117,116,118,101, 99, 44, 32,109,105,110,118,101, 99, 41, 59,
- 10, 9,105,102, 40,100,111,109, 97,120, 32, 61, 61, 32, 49, 46, 48, 41, 10, 9, 9,111,117,116,118,101, 99, 32, 61, 32,109,105,
-110, 40,111,117,116,118,101, 99, 44, 32,109, 97,120,118,101, 99, 41, 59, 10,125, 10, 10,118,111,105,100, 32, 99, 97,109,101,114,
- 97, 40,111,117,116, 32,118,101, 99, 51, 32,111,117,116,118,105,101,119, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,
-116,100,101,112,116,104, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,100,105,115,116, 41, 10,123, 10, 9,111,117,
-116,118,105,101,119, 32, 61, 32,118, 97,114, 99, 97,109, 99,111, 59, 10, 9,111,117,116,100,101,112,116,104, 32, 61, 32, 97, 98,
-115, 40,111,117,116,118,105,101,119, 46,122, 41, 59, 10, 9,111,117,116,100,105,115,116, 32, 61, 32,108,101,110,103,116,104, 40,
-111,117,116,118,105,101,119, 41, 59, 10, 9,111,117,116,118,105,101,119, 32, 61, 32,110,111,114,109, 97,108,105,122,101, 40,111,
-117,116,118,105,101,119, 41, 59, 10,125, 10, 10,118,111,105,100, 32,109, 97,116,104, 95, 97,100,100, 40,102,108,111, 97,116, 32,
-118, 97,108, 49, 44, 32,102,108,111, 97,116, 32,118, 97,108, 50, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,118,
- 97,108, 41, 10,123, 10, 9,111,117,116,118, 97,108, 32, 61, 32,118, 97,108, 49, 32, 43, 32,118, 97,108, 50, 59, 10,125, 10, 10,
-118,111,105,100, 32,109, 97,116,104, 95,115,117, 98,116,114, 97, 99,116, 40,102,108,111, 97,116, 32,118, 97,108, 49, 44, 32,102,
+ 10,118, 97,114,121,105,110,103, 32,118,101, 99, 51, 32,118, 97,114, 99,111,
+ 59, 10,118, 97,114,121,105,110,103, 32,118,101, 99, 51, 32,118, 97,114, 99, 97,109, 99,111, 59, 10,118, 97,114,121,105,110,103,
+ 32,118,101, 99, 51, 32,118, 97,114,110,111,114,109, 97,108, 59, 10, 10, 47, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 32, 83,
+ 72, 65, 68, 69, 82, 32, 78, 79, 68, 69, 83, 32, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 47, 10, 10,118,111,
+105,100, 32,103,101,111,109, 40,118,101, 99, 51, 32, 97,116,116,111,114, 99,111, 44, 32,118,101, 99, 50, 32, 97,116,116,117,118,
+ 44, 32,118,101, 99, 52, 32, 97,116,116,118, 99,111,108, 44, 32,111,117,116, 32,118,101, 99, 51, 32,103,108,111, 98, 97,108, 44,
+ 32,111,117,116, 32,118,101, 99, 51, 32,108,111, 99, 97,108, 44, 32,111,117,116, 32,118,101, 99, 51, 32,118,105,101,119, 44, 32,
+111,117,116, 32,118,101, 99, 51, 32,111,114, 99,111, 44, 32,111,117,116, 32,118,101, 99, 51, 32,117,118, 44, 32,111,117,116, 32,
+118,101, 99, 51, 32,110,111,114,109, 97,108, 44, 32,111,117,116, 32,118,101, 99, 52, 32,118, 99,111,108, 44, 32,111,117,116, 32,
+102,108,111, 97,116, 32,102,114,111,110,116, 98, 97, 99,107, 41, 10,123, 10, 9,108,111, 99, 97,108, 32, 61, 32,118, 97,114, 99,
+ 97,109, 99,111, 59, 10, 9,118,105,101,119, 32, 61, 32,110,111,114,109, 97,108,105,122,101, 40,108,111, 99, 97,108, 41, 59, 10,
+ 9,111,114, 99,111, 32, 61, 32, 97,116,116,111,114, 99,111, 59, 10, 9,117,118, 32, 61, 32,118,101, 99, 51, 40, 97,116,116,117,
+118, 42, 50, 46, 48, 32, 45, 32,118,101, 99, 50, 40, 49, 46, 48, 44, 32, 49, 46, 48, 41, 44, 32, 48, 46, 48, 41, 59, 10, 9,110,
+111,114,109, 97,108, 32, 61, 32, 45,110,111,114,109, 97,108,105,122,101, 40,118, 97,114,110,111,114,109, 97,108, 41, 59, 10, 9,
+118, 99,111,108, 32, 61, 32,118,101, 99, 52, 40, 97,116,116,118, 99,111,108, 46,119, 47, 50, 53, 53, 46, 48, 44, 32, 97,116,116,
+118, 99,111,108, 46,122, 47, 50, 53, 53, 46, 48, 44, 32, 97,116,116,118, 99,111,108, 46,121, 47, 50, 53, 53, 46, 48, 44, 32, 49,
+ 46, 48, 41, 59, 10, 9,102,114,111,110,116, 98, 97, 99,107, 32, 61, 32, 49, 46, 48, 59, 10,125, 10, 10,118,111,105,100, 32,109,
+ 97,112,112,105,110,103, 40,118,101, 99, 51, 32,118,101, 99, 44, 32,109, 97,116, 52, 32,109, 97,116, 44, 32,118,101, 99, 51, 32,
+109,105,110,118,101, 99, 44, 32,118,101, 99, 51, 32,109, 97,120,118,101, 99, 44, 32,102,108,111, 97,116, 32,100,111,109,105,110,
+ 44, 32,102,108,111, 97,116, 32,100,111,109, 97,120, 44, 32,111,117,116, 32,118,101, 99, 51, 32,111,117,116,118,101, 99, 41, 10,
+123, 10, 9,111,117,116,118,101, 99, 32, 61, 32, 40,109, 97,116, 32, 42, 32,118,101, 99, 52, 40,118,101, 99, 44, 32, 49, 46, 48,
+ 41, 41, 46,120,121,122, 59, 10, 9,105,102, 40,100,111,109,105,110, 32, 61, 61, 32, 49, 46, 48, 41, 10, 9, 9,111,117,116,118,
+101, 99, 32, 61, 32,109, 97,120, 40,111,117,116,118,101, 99, 44, 32,109,105,110,118,101, 99, 41, 59, 10, 9,105,102, 40,100,111,
+109, 97,120, 32, 61, 61, 32, 49, 46, 48, 41, 10, 9, 9,111,117,116,118,101, 99, 32, 61, 32,109,105,110, 40,111,117,116,118,101,
+ 99, 44, 32,109, 97,120,118,101, 99, 41, 59, 10,125, 10, 10,118,111,105,100, 32, 99, 97,109,101,114, 97, 40,111,117,116, 32,118,
+101, 99, 51, 32,111,117,116,118,105,101,119, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,100,101,112,116,104, 44,
+ 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,100,105,115,116, 41, 10,123, 10, 9,111,117,116,118,105,101,119, 32, 61,
+ 32,118, 97,114, 99, 97,109, 99,111, 59, 10, 9,111,117,116,100,101,112,116,104, 32, 61, 32, 97, 98,115, 40,111,117,116,118,105,
+101,119, 46,122, 41, 59, 10, 9,111,117,116,100,105,115,116, 32, 61, 32,108,101,110,103,116,104, 40,111,117,116,118,105,101,119,
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list