[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [11572] branches/soc-2007-maike:
Brecht Van Lommel
brechtvanlommel at pandora.be
Mon Aug 13 15:20:33 CEST 2007
Revision: 11572
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=11572
Author: blendix
Date: 2007-08-13 15:20:32 +0200 (Mon, 13 Aug 2007)
Log Message:
-----------
GLSL Branch
===========
- Fix specular eye position.
- Compatibility fix changing some int constants/variables to float.
Modified Paths:
--------------
branches/soc-2007-maike/release/glsl/blinn.gsl
branches/soc-2007-maike/release/glsl/blinn_area.gsl
branches/soc-2007-maike/release/glsl/blinn_hemi.gsl
branches/soc-2007-maike/release/glsl/blinn_sun.gsl
branches/soc-2007-maike/release/glsl/cooktorr.gsl
branches/soc-2007-maike/release/glsl/cooktorr_area.gsl
branches/soc-2007-maike/release/glsl/cooktorr_hemi.gsl
branches/soc-2007-maike/release/glsl/cooktorr_sun.gsl
branches/soc-2007-maike/release/glsl/difftoon.gsl
branches/soc-2007-maike/release/glsl/difftoon_area.gsl
branches/soc-2007-maike/release/glsl/difftoon_sun.gsl
branches/soc-2007-maike/release/glsl/lambert_area.gsl
branches/soc-2007-maike/release/glsl/material_uniforms.gsl
branches/soc-2007-maike/release/glsl/minnaert_area.gsl
branches/soc-2007-maike/release/glsl/spectoon.gsl
branches/soc-2007-maike/release/glsl/spectoon_area.gsl
branches/soc-2007-maike/release/glsl/spectoon_hemi.gsl
branches/soc-2007-maike/release/glsl/spectoon_sun.gsl
branches/soc-2007-maike/release/glsl/wardiso.gsl
branches/soc-2007-maike/release/glsl/wardiso_area.gsl
branches/soc-2007-maike/release/glsl/wardiso_hemi.gsl
branches/soc-2007-maike/release/glsl/wardiso_sun.gsl
branches/soc-2007-maike/source/blender/src/glsl_drawobject.c
branches/soc-2007-maike/source/blender/src/glsl_uniforms.c
Modified: branches/soc-2007-maike/release/glsl/blinn.gsl
===================================================================
--- branches/soc-2007-maike/release/glsl/blinn.gsl 2007-08-13 06:42:21 UTC (rev 11571)
+++ branches/soc-2007-maike/release/glsl/blinn.gsl 2007-08-13 13:20:32 UTC (rev 11572)
@@ -6,7 +6,7 @@
if(hard < 100.0) har = sqrt(1.0 / hard);
else har = 10.0 / hard;
- vec3 h = normalize((eye - pos) + (l.loc - pos));
+ vec3 h = normalize(view + normalize(l.loc - pos));
float nh = dot(vnormal, h);
float nv = max(dot(vnormal, view), 0.01);
float nl = dot(vnormal, normalize(l.loc - pos));
@@ -18,6 +18,6 @@
float g = min(a, min(b, c));
float p = sqrt((refrac * refrac) + (vh * vh) - 1.0);
float f = (((p - vh) * (p - vh)) / ((p + vh) * (p + vh))) * (1.0 + ((((vh * (p + vh)) - 1.0) * ((vh * (p + vh)) - 1.0)) / (((vh * (p - vh)) + 1.0) * ((vh * (p - vh)) + 1.0))));
- float rslt = max(f * g * exp((-1 * (ang * ang)) / (2.0 * har * har)), 0.0);
+ float rslt = max(f * g * exp((-1.0 * (ang * ang)) / (2.0 * har * har)), 0.0);
return(rslt);
}
Modified: branches/soc-2007-maike/release/glsl/blinn_area.gsl
===================================================================
--- branches/soc-2007-maike/release/glsl/blinn_area.gsl 2007-08-13 06:42:21 UTC (rev 11571)
+++ branches/soc-2007-maike/release/glsl/blinn_area.gsl 2007-08-13 13:20:32 UTC (rev 11572)
@@ -6,7 +6,7 @@
if(hard < 100.0) har = sqrt(1.0 / hard);
else har = 10.0 / hard;
- vec3 h = normalize((eye - pos) + (l.loc - pos));
+ vec3 h = normalize(view + normalize(l.loc - pos));
float nh = dot(vnormal, h);
float nv = max(dot(vnormal, view), 0.01);
float nl = dot(vnormal, normalize(l.loc - pos));
@@ -18,6 +18,6 @@
float g = min(a, min(b, c));
float p = sqrt((refrac * refrac) + (vh * vh) - 1.0);
float f = (((p - vh) * (p - vh)) / ((p + vh) * (p + vh))) * (1.0 + ((((vh * (p + vh)) - 1.0) * ((vh * (p + vh)) - 1.0)) / (((vh * (p - vh)) + 1.0) * ((vh * (p - vh)) + 1.0))));
- float rslt = max(f * g * exp((-1 * (ang * ang)) / (2.0 * har * har)), 0.0);
+ float rslt = max(f * g * exp((-1.0 * (ang * ang)) / (2.0 * har * har)), 0.0);
return(rslt);
}
Modified: branches/soc-2007-maike/release/glsl/blinn_hemi.gsl
===================================================================
--- branches/soc-2007-maike/release/glsl/blinn_hemi.gsl 2007-08-13 06:42:21 UTC (rev 11571)
+++ branches/soc-2007-maike/release/glsl/blinn_hemi.gsl 2007-08-13 13:20:32 UTC (rev 11572)
@@ -1,4 +1,4 @@
-float blinnhemi(light l, vec3 vnormal, int hard){
+float blinnhemi(light l, vec3 vnormal, float hard){
vec3 view = normalize(eye - pos);
float har;
@@ -6,7 +6,7 @@
if(hard < 100.0) har = sqrt(1.0 / hard);
else har = 10.0 / hard;
- vec3 h = normalize((eye - pos) + l.vec);
+ vec3 h = normalize(view + l.vec);
float nh = 0.5 * dot(vnormal, h) + 0.5;
return(nh * pow(nh, hard));
}
Modified: branches/soc-2007-maike/release/glsl/blinn_sun.gsl
===================================================================
--- branches/soc-2007-maike/release/glsl/blinn_sun.gsl 2007-08-13 06:42:21 UTC (rev 11571)
+++ branches/soc-2007-maike/release/glsl/blinn_sun.gsl 2007-08-13 13:20:32 UTC (rev 11572)
@@ -6,7 +6,7 @@
if(hard < 100.0) har = sqrt(1.0 / hard);
else har = 10.0 / hard;
- vec3 h = normalize((eye - pos) + l.vec);
+ vec3 h = normalize(view + l.vec);
float nh = dot(vnormal, h);
float nv = max(dot(vnormal, view), 0.01);
float nl = dot(vnormal, normalize(l.loc - pos));
@@ -18,6 +18,6 @@
float g = min(a, min(b, c));
float p = sqrt((refrac * refrac) + (vh * vh) - 1.0);
float f = (((p - vh) * (p - vh)) / ((p + vh) * (p + vh))) * (1.0 + ((((vh * (p + vh)) - 1.0) * ((vh * (p + vh)) - 1.0)) / (((vh * (p - vh)) + 1.0) * ((vh * (p - vh)) + 1.0))));
- float rslt = max(f * g * exp((-1 * (ang * ang)) / (2.0 * har * har)), 0.0);
+ float rslt = max(f * g * exp((-1.0 * (ang * ang)) / (2.0 * har * har)), 0.0);
return(rslt);
}
Modified: branches/soc-2007-maike/release/glsl/cooktorr.gsl
===================================================================
--- branches/soc-2007-maike/release/glsl/cooktorr.gsl 2007-08-13 06:42:21 UTC (rev 11571)
+++ branches/soc-2007-maike/release/glsl/cooktorr.gsl 2007-08-13 13:20:32 UTC (rev 11572)
@@ -1,6 +1,6 @@
float cooktorrdef(light l, vec3 vnormal, float hard, float unused){
vec3 view = normalize(eye - pos);
- vec3 h = normalize((eye - pos) + (l.loc - pos));
+ vec3 h = normalize(view + normalize(l.loc - pos));
float nh = max(dot(vnormal, h), 0.0);
float nv = max(dot(vnormal, view), 0.0);
return(pow(nh, hard) / (0.1 + nv));
Modified: branches/soc-2007-maike/release/glsl/cooktorr_area.gsl
===================================================================
--- branches/soc-2007-maike/release/glsl/cooktorr_area.gsl 2007-08-13 06:42:21 UTC (rev 11571)
+++ branches/soc-2007-maike/release/glsl/cooktorr_area.gsl 2007-08-13 13:20:32 UTC (rev 11572)
@@ -1,6 +1,6 @@
float cooktorrarea(light l, vec3 vnormal, float hard, float unused){
vec3 view = normalize(eye - pos);
- vec3 h = normalize((eye - pos) + (l.loc - pos));
+ vec3 h = normalize(view + normalize(l.loc - pos));
float nh = max(dot(vnormal, h), 0.0);
float nv = max(dot(vnormal, view), 0.0);
return( pow(nh, hard) / (0.1 + nv));
Modified: branches/soc-2007-maike/release/glsl/cooktorr_hemi.gsl
===================================================================
--- branches/soc-2007-maike/release/glsl/cooktorr_hemi.gsl 2007-08-13 06:42:21 UTC (rev 11571)
+++ branches/soc-2007-maike/release/glsl/cooktorr_hemi.gsl 2007-08-13 13:20:32 UTC (rev 11572)
@@ -1,6 +1,6 @@
float cooktorrhemi(light l, vec3 vnormal, float hard){
vec3 view = normalize(eye - pos);
- vec3 h = normalize((eye - pos) + l.vec);
+ vec3 h = normalize(view + l.vec);
float nh = 0.5 * (max(dot(vnormal, h), 0.0)) + 0.5;
return(nh * pow(nh, hard));
}
Modified: branches/soc-2007-maike/release/glsl/cooktorr_sun.gsl
===================================================================
--- branches/soc-2007-maike/release/glsl/cooktorr_sun.gsl 2007-08-13 06:42:21 UTC (rev 11571)
+++ branches/soc-2007-maike/release/glsl/cooktorr_sun.gsl 2007-08-13 13:20:32 UTC (rev 11572)
@@ -1,6 +1,6 @@
float cooktorrsun(light l, vec3 vnormal, float hard, float unused){
vec3 view = normalize(eye - pos);
- vec3 h = normalize((eye - pos) + l.vec);
+ vec3 h = normalize(view + l.vec);
float nh = max(dot(vnormal, h), 0.0);
float nv = max(dot(vnormal, view), 0.0);
return(pow(nh, hard) / (0.1 + nv));
Modified: branches/soc-2007-maike/release/glsl/difftoon.gsl
===================================================================
--- branches/soc-2007-maike/release/glsl/difftoon.gsl 2007-08-13 06:42:21 UTC (rev 11571)
+++ branches/soc-2007-maike/release/glsl/difftoon.gsl 2007-08-13 13:20:32 UTC (rev 11572)
@@ -2,7 +2,7 @@
vec3 lightVec = normalize(l.loc - pos);
float rslt = dot(vnormal, lightVec);
float ang;
- ang = acos(clamp(rslt, -1.0, 1.0)) * (1 - floor(clamp(rslt, 0.1, 1.0) + 0.00001));
+ ang = acos(clamp(rslt, -1.0, 1.0)) * (1.0 - floor(clamp(rslt, 0.1, 1.0) + 0.00001));
rslt = (1.0 - max((ang - size) / smooth, 0.0)) * ceil(clamp(size + smooth - ang, 0.0, 1.0) - 0.00001);
return(rslt);
Modified: branches/soc-2007-maike/release/glsl/difftoon_area.gsl
===================================================================
--- branches/soc-2007-maike/release/glsl/difftoon_area.gsl 2007-08-13 06:42:21 UTC (rev 11571)
+++ branches/soc-2007-maike/release/glsl/difftoon_area.gsl 2007-08-13 13:20:32 UTC (rev 11572)
@@ -2,7 +2,7 @@
vec3 lightVec = normalize(l.loc - pos);
float rslt = dot(vnormal, lightVec);
float ang;
- ang = acos(clamp(rslt, -1.0, 1.0)) * (1 - floor(clamp(rslt, 0.1, 1.0) + 0.00001));
+ ang = acos(clamp(rslt, -1.0, 1.0)) * (1.0 - floor(clamp(rslt, 0.1, 1.0) + 0.00001));
rslt = (1.0 - max((ang - size) / smooth, 0.0)) * ceil(clamp(size + smooth - ang, 0.0, 1.0) - 0.00001);
return(rslt);
Modified: branches/soc-2007-maike/release/glsl/difftoon_sun.gsl
===================================================================
--- branches/soc-2007-maike/release/glsl/difftoon_sun.gsl 2007-08-13 06:42:21 UTC (rev 11571)
+++ branches/soc-2007-maike/release/glsl/difftoon_sun.gsl 2007-08-13 13:20:32 UTC (rev 11572)
@@ -2,7 +2,7 @@
vec3 lightVec = normalize(l.vec);
float rslt = max(dot(vnormal, lightVec), 0.0);
float ang;
- ang = acos(clamp(rslt, -1.0, 1.0)) * (1 - floor(clamp(rslt, 0.1, 1.0) + 0.00001));
+ ang = acos(clamp(rslt, -1.0, 1.0)) * (1.0 - floor(clamp(rslt, 0.1, 1.0) + 0.00001));
rslt = clamp(ceil(size + smooth - ang - 0.00001) * (1.0 - ((ang - size) / smooth)), 0.0, 1.0);
return(rslt);
}
Modified: branches/soc-2007-maike/release/glsl/lambert_area.gsl
===================================================================
--- branches/soc-2007-maike/release/glsl/lambert_area.gsl 2007-08-13 06:42:21 UTC (rev 11571)
+++ branches/soc-2007-maike/release/glsl/lambert_area.gsl 2007-08-13 13:20:32 UTC (rev 11572)
@@ -21,10 +21,10 @@
rad[2] = dot(vect3, vect4);
rad[3] = dot(vect4, vect1);
- rad[0] = acos(clamp(rad[0], -1.0, 1.0)) * (1 - floor(clamp(rad[0], 0.1, 1.0) + 0.00001));
- rad[1] = acos(clamp(rad[1], -1.0, 1.0)) * (1 - floor(clamp(rad[1], 0.1, 1.0) + 0.00001));
- rad[2] = acos(clamp(rad[2], -1.0, 1.0)) * (1 - floor(clamp(rad[2], 0.1, 1.0) + 0.00001));
- rad[3] = acos(clamp(rad[3], -1.0, 1.0)) * (1 - floor(clamp(rad[3], 0.1, 1.0) + 0.00001));
+ rad[0] = acos(clamp(rad[0], -1.0, 1.0)) * (1.0 - floor(clamp(rad[0], 0.1, 1.0) + 0.00001));
+ rad[1] = acos(clamp(rad[1], -1.0, 1.0)) * (1.0 - floor(clamp(rad[1], 0.1, 1.0) + 0.00001));
+ rad[2] = acos(clamp(rad[2], -1.0, 1.0)) * (1.0 - floor(clamp(rad[2], 0.1, 1.0) + 0.00001));
+ rad[3] = acos(clamp(rad[3], -1.0, 1.0)) * (1.0 - floor(clamp(rad[3], 0.1, 1.0) + 0.00001));
fac = rad[0] * dot(vnormal, cross1);
fac += rad[1] * dot(vnormal, cross2);
Modified: branches/soc-2007-maike/release/glsl/material_uniforms.gsl
===================================================================
--- branches/soc-2007-maike/release/glsl/material_uniforms.gsl 2007-08-13 06:42:21 UTC (rev 11571)
+++ branches/soc-2007-maike/release/glsl/material_uniforms.gsl 2007-08-13 13:20:32 UTC (rev 11572)
@@ -15,6 +15,6 @@
uniform float u_mat_MATERIAL_ID_amb_fac;
uniform float u_mat_MATERIAL_ID_emit;
-uniform int u_mat_MATERIAL_ID_hard;
+uniform float u_mat_MATERIAL_ID_hard;
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list