diff options
Diffstat (limited to 'indra/newview/app_settings')
3 files changed, 154 insertions, 13 deletions
| diff --git a/indra/newview/app_settings/shaders/class1/deferred/bumpF.glsl b/indra/newview/app_settings/shaders/class1/deferred/bumpF.glsl index 6e5cc69e39..aaf1e5e572 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/bumpF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/bumpF.glsl @@ -31,9 +31,6 @@ out vec4 frag_data[3];  uniform sampler2D diffuseMap;  uniform sampler2D bumpMap; -uniform sampler2D specularMap; -uniform float env_intensity; -uniform vec4 specular_color;  VARYING vec3 vary_mat0;  VARYING vec3 vary_mat1; @@ -45,17 +42,15 @@ VARYING vec2 vary_texcoord0;  void main()   {  	vec3 col = vertex_color.rgb * texture2D(diffuseMap, vary_texcoord0.xy).rgb; -	vec4 spec = texture2D(specularMap, vary_texcoord0.xy); -	vec4 norm = texture2D(bumpMap, vary_texcoord0.xy); -	norm.xyz = norm.xyz * 2 - 1; +	vec3 norm = texture2D(bumpMap, vary_texcoord0.xy).rgb * 2.0 - 1.0; -	vec3 tnorm = vec3(dot(norm.xyz,vary_mat0), -			  dot(norm.xyz,vary_mat1), -			  dot(norm.xyz,vary_mat2)); -	 -	frag_data[0] = vec4(col * (1 - spec.a * env_intensity), 0); -	frag_data[1] = vec4(spec.xyz * specular_color.xyz, specular_color.a * norm.a); // spec +	vec3 tnorm = vec3(dot(norm,vary_mat0), +			  dot(norm,vary_mat1), +			  dot(norm,vary_mat2)); +						 +	frag_data[0] = vec4(col * (1 - vertex_color.a), 0.0); +	frag_data[1] = vertex_color.aaaa; // spec  	//frag_data[1] = vec4(vec3(vertex_color.a), vertex_color.a+(1.0-vertex_color.a)*vertex_color.a); // spec - from former class3 - maybe better, but not so well tested  	vec3 nvn = normalize(tnorm); -	frag_data[2] = vec4(nvn.xyz * 0.5 + 0.5, spec.a * env_intensity); +	frag_data[2] = vec4(nvn.xyz * 0.5 + 0.5, vertex_color.a);  } diff --git a/indra/newview/app_settings/shaders/class1/deferred/materialF.glsl b/indra/newview/app_settings/shaders/class1/deferred/materialF.glsl new file mode 100644 index 0000000000..4f7fc6a411 --- /dev/null +++ b/indra/newview/app_settings/shaders/class1/deferred/materialF.glsl @@ -0,0 +1,89 @@ +/**  + * @file materialF.glsl + * + * $LicenseInfo:firstyear=2007&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2007, Linden Research, Inc. + *  + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + *  + * This library 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 + * Lesser General Public License for more details. + *  + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA + *  + * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA + * $/LicenseInfo$ + */ +  +#ifdef DEFINE_GL_FRAGCOLOR +out vec4 frag_data[3]; +#else +#define frag_data gl_FragData +#endif + +uniform sampler2D diffuseMap; + +uniform sampler2D bumpMap; + +uniform sampler2D specularMap; +uniform float env_intensity; +uniform vec4 specular_color; + +#ifdef ALPHA_TEST +uniform float minimum_alpha; +#endif + +VARYING vec3 vary_mat0; +VARYING vec3 vary_mat1; +VARYING vec3 vary_mat2; + +VARYING vec4 vertex_color; +VARYING vec2 vary_texcoord0; + +void main()  +{ +	vec4 col = texture2D(diffuseMap, vary_texcoord0.xy) * vertex_color; + +	#ifdef ALPHA_TEST +	if (col.a < minimum_alpha) +	{ +		discard; +	} +	#endif +	 +	vec4 spec = texture2D(specularMap, vary_texcoord0.xy); + +	vec4 norm = texture2D(bumpMap, vary_texcoord0.xy); + +	norm.xyz = norm.xyz * 2 - 1; + +	vec3 tnorm = vec3(dot(norm.xyz,vary_mat0), +			  dot(norm.xyz,vary_mat1), +			  dot(norm.xyz,vary_mat2)); + +	vec4 final_color = col; +	final_color.rgb *= 1 - spec.a * env_intensity; + +	#ifndef EMISSIVE_MASK +	final_color.a = 0; +	#endif + +	vec4 final_specular = spec; +	final_specular.rgb *= specular_color.rgb; +	final_specular.a = specular_color.a * norm.a; + +	vec4 final_normal = vec4(normalize(tnorm), spec.a * env_intensity); +	final_normal.xyz = final_normal.xyz * 0.5 + 0.5; +	 +	frag_data[0] = final_color; +	frag_data[1] = final_specular; // XYZ = Specular color. W = Specular exponent. +	frag_data[2] = final_normal; // XYZ = Normal.  W = Env. intensity. +} diff --git a/indra/newview/app_settings/shaders/class1/deferred/materialV.glsl b/indra/newview/app_settings/shaders/class1/deferred/materialV.glsl new file mode 100644 index 0000000000..c8d38bb8f7 --- /dev/null +++ b/indra/newview/app_settings/shaders/class1/deferred/materialV.glsl @@ -0,0 +1,57 @@ +/**  + * @file bumpV.glsl + * + * $LicenseInfo:firstyear=2007&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2007, Linden Research, Inc. + *  + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + *  + * This library 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 + * Lesser General Public License for more details. + *  + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA + *  + * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA + * $/LicenseInfo$ + */ + +uniform mat3 normal_matrix; +uniform mat4 texture_matrix0; +uniform mat4 modelview_projection_matrix; + +ATTRIBUTE vec3 position; +ATTRIBUTE vec4 diffuse_color; +ATTRIBUTE vec3 normal; +ATTRIBUTE vec2 texcoord0; +ATTRIBUTE vec3 binormal; + +VARYING vec3 vary_mat0; +VARYING vec3 vary_mat1; +VARYING vec3 vary_mat2; +VARYING vec4 vertex_color; +VARYING vec2 vary_texcoord0; + +void main() +{ +	//transform vertex +	gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0);  +	vary_texcoord0 = (texture_matrix0 * vec4(texcoord0,0,1)).xy; +	 +	vec3 n = normalize(normal_matrix * normal); +	vec3 b = normalize(normal_matrix * binormal); +	vec3 t = cross(b, n); +	 +	vary_mat0 = vec3(t.x, b.x, n.x); +	vary_mat1 = vec3(t.y, b.y, n.y); +	vary_mat2 = vec3(t.z, b.z, n.z); +	 +	vertex_color = diffuse_color; +} | 
