diff options
| author | Dave Parks <davep@lindenlab.com> | 2013-06-27 16:16:56 -0500 | 
|---|---|---|
| committer | Dave Parks <davep@lindenlab.com> | 2013-06-27 16:16:56 -0500 | 
| commit | 380785e613b9823cb6160be5678e5f01783fee5f (patch) | |
| tree | dce0f35d02994c861428683b91f64371e9a64ea0 /indra/newview/app_settings/shaders/class1 | |
| parent | 21b78d7368f969fdf0daf7994fb565da633b1e71 (diff) | |
| parent | 4696eeeb30ce4d01c3bcbe74c9024f05d848968a (diff) | |
Automated merge with https://bitbucket.org/lindenlab/viewer-development-materials
Diffstat (limited to 'indra/newview/app_settings/shaders/class1')
6 files changed, 22 insertions, 210 deletions
| diff --git a/indra/newview/app_settings/shaders/class1/avatar/objectSkinV.glsl b/indra/newview/app_settings/shaders/class1/avatar/objectSkinV.glsl index 43ed41a205..ff30560adc 100755 --- a/indra/newview/app_settings/shaders/class1/avatar/objectSkinV.glsl +++ b/indra/newview/app_settings/shaders/class1/avatar/objectSkinV.glsl @@ -26,22 +26,28 @@  ATTRIBUTE vec4 weight4;   -uniform mat4 matrixPalette[32]; +uniform mat4 matrixPalette[64];  mat4 getObjectSkinnedTransform()  { -	int i;  -	vec4 w = fract(weight4); -	vec4 index = floor(weight4); -	 -	float scale = 1.0/(w.x+w.y+w.z+w.w); -	w *= scale; +	float w0 = fract(weight4.x); +	float w1 = fract(weight4.y); +	float w2 = fract(weight4.z); +	float w3 = fract(weight4.w); +			 +	int i0 = int(floor(weight4.x)); +	int i1 = int(floor(weight4.y)); +	int i2 = int(floor(weight4.z)); +	int i3 = int(floor(weight4.w)); + +	//float scale = 1.0/(w.x+w.y+w.z+w.w); +	//w *= scale; -	mat4 mat = matrixPalette[int(index.x)]*w.x; -	mat += matrixPalette[int(index.y)]*w.y; -	mat += matrixPalette[int(index.z)]*w.z; -	mat += matrixPalette[int(index.w)]*w.w; +	mat4 mat = matrixPalette[i0]*w0; +	mat += matrixPalette[i1]*w1; +	mat += matrixPalette[i2]*w2; +	mat += matrixPalette[i3]*w3;  	return mat;  } diff --git a/indra/newview/app_settings/shaders/class1/deferred/avatarF.glsl b/indra/newview/app_settings/shaders/class1/deferred/avatarF.glsl index bcccbf77d2..662c762bca 100755 --- a/indra/newview/app_settings/shaders/class1/deferred/avatarF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/avatarF.glsl @@ -31,6 +31,8 @@ out vec4 frag_data[3];  uniform sampler2D diffuseMap; +uniform float minimum_alpha; +  VARYING vec3 vary_normal;  VARYING vec2 vary_texcoord0; @@ -44,7 +46,7 @@ void main()  {  	vec4 diff = texture2D(diffuseMap, vary_texcoord0.xy); -	if (diff.a < 0.2) +	if (diff.a < minimum_alpha)  	{  		discard;  	} diff --git a/indra/newview/app_settings/shaders/class1/deferred/giF.glsl b/indra/newview/app_settings/shaders/class1/deferred/giF.glsl deleted file mode 100755 index da1b234240..0000000000 --- a/indra/newview/app_settings/shaders/class1/deferred/giF.glsl +++ /dev/null @@ -1,190 +0,0 @@ -/**  - * @file giF.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$ - */ -  -#extension GL_ARB_texture_rectangle : enable - -#ifdef DEFINE_GL_FRAGCOLOR -out vec4 frag_color; -#else -#define frag_color gl_FragColor -#endif - -uniform sampler2DRect depthMap; -uniform sampler2DRect normalMap; -uniform sampler2D noiseMap; - -uniform sampler2D		diffuseGIMap; -uniform sampler2D		normalGIMap; -uniform sampler2D		depthGIMap; - -uniform sampler2D		lightFunc; - -// Inputs -VARYING vec2 vary_fragcoord; - -uniform vec2 screen_res; - -uniform mat4 inv_proj; -uniform mat4 gi_mat;  //gPipeline.mGIMatrix - eye space to sun space -uniform mat4 gi_mat_proj; //gPipeline.mGIMatrixProj - eye space to projected sun space -uniform mat4 gi_norm_mat; //gPipeline.mGINormalMatrix - eye space normal to sun space normal matrix -uniform mat4 gi_inv_proj; //gPipeline.mGIInvProj - projected sun space to sun space -uniform float gi_radius; -uniform float gi_intensity; -uniform int gi_samples; -uniform vec2 gi_kern[25]; -uniform vec2 gi_scale; -uniform vec3 gi_quad; -uniform vec3 gi_spec; -uniform float gi_direction_weight; -uniform float gi_light_offset; - -vec4 getPosition(vec2 pos_screen) -{ -	float depth = texture2DRect(depthMap, pos_screen.xy).a; -	vec2 sc = pos_screen.xy*2.0; -	sc /= screen_res; -	sc -= vec2(1.0,1.0); -	vec4 ndc = vec4(sc.x, sc.y, 2.0*depth-1.0, 1.0); -	vec4 pos = inv_proj * ndc; -	pos /= pos.w; -	pos.w = 1.0; -	return pos; -} - -vec4 getGIPosition(vec2 gi_tc) -{ -	float depth = texture2D(depthGIMap, gi_tc).a; -	vec2 sc = gi_tc*2.0; -	sc -= vec2(1.0, 1.0); -	vec4 ndc = vec4(sc.x, sc.y, 2.0*depth-1.0, 1.0); -	vec4 pos = gi_inv_proj*ndc; -	pos.xyz /= pos.w; -	pos.w = 1.0; -	return pos; -} - -vec3 giAmbient(vec3 pos, vec3 norm) -{ -	vec4 gi_c = gi_mat_proj * vec4(pos, 1.0); -	gi_c.xyz /= gi_c.w; - -	vec4 gi_pos = gi_mat*vec4(pos,1.0); -	vec3 gi_norm = (gi_norm_mat*vec4(norm,1.0)).xyz; -	gi_norm = normalize(gi_norm); -	 -	vec2 tcx = gi_norm.xy; -	vec2 tcy = gi_norm.yx; -	 -	vec4 eye_pos = gi_mat*vec4(0,0,0,1.0); -	 -	vec3 eye_dir = normalize(gi_pos.xyz-eye_pos.xyz/eye_pos.w); -	 -	//vec3 eye_dir = vec3(0,0,-1); -	//eye_dir = (gi_norm_mat*vec4(eye_dir, 1.0)).xyz; -	//eye_dir = normalize(eye_dir); -	 -	//float round_x = gi_scale.x; -	//float round_y = gi_scale.y; -	 -	vec3 debug = texture2D(normalGIMap, gi_c.xy).rgb*0.5+0.5; -	debug.xz = vec2(0.0,0.0); -	//debug = fract(debug); -	 -	float round_x = 1.0/64.0; -	float round_y = 1.0/64.0; -	 -	//gi_c.x = floor(gi_c.x/round_x+0.5)*round_x; -	//gi_c.y = floor(gi_c.y/round_y+0.5)*round_y; -	 -	float fda = 0.0; -	vec3 fdiff = vec3(0,0,0); -	 -	vec3 rcol = vec3(0,0,0); -	 -	float fsa = 0.0; -	 -	for (int i = -1; i < 2; i+=2 ) -	{ -		for (int j = -1; j < 2; j+=2) -		{ -			vec2 tc = vec2(i, j)*0.75; -			vec3 nz = texture2D(noiseMap, vary_fragcoord.xy/128.0+tc*0.5).xyz; -			//tc += gi_norm.xy*nz.z; -			tc += nz.xy*2.0; -			tc /= gi_samples; -			tc += gi_c.xy; -			 -			vec3 lnorm = -normalize(texture2D(normalGIMap, tc.xy).xyz*2.0-1.0); -			vec3 lpos = getGIPosition(tc.xy).xyz; -							 -			vec3 at = lpos-gi_pos.xyz; -			float dist = dot(at,at); -			float da = clamp(1.0/(gi_spec.x*dist), 0.0, 1.0); -			 -			if (da > 0.0) -			{ -				//add angular attenuation -				vec3 ldir = at; -				float ang_atten = clamp(dot(ldir, gi_norm), 0.0, 1.0); -			 -				float ld = -dot(ldir, lnorm); -				 -				if (ang_atten > 0.0 && ld < 0.0) -				{ -					vec3 diff = texture2D(diffuseGIMap, tc.xy).xyz; -					da = da*ang_atten; -					fda += da; -					fdiff += diff*da; -				} -			} -		} -	} - -	fdiff /= max(gi_spec.y*fda, gi_quad.z); -	fdiff = clamp(fdiff, vec3(0), vec3(1)); -	 -	vec3 ret = fda*fdiff; -	//ret = ret*ret*gi_quad.x+ret*gi_quad.y+gi_quad.z;			 - -	//fda *= nz.z; -	 -	//rcol.rgb *= gi_intensity; -	//return rcol.rgb+vary_AmblitColor.rgb*0.25; -	//return vec4(debug, 0.0); -	//return vec4(fda*fdiff, 0.0); -	return clamp(ret,vec3(0.0), vec3(1.0)); -	//return debug.xyz; -} - -void main()  -{ -	vec2 pos_screen = vary_fragcoord.xy; -	vec4 pos = getPosition(pos_screen); -	vec3 norm = texture2DRect(normalMap, pos_screen).xyz; -	norm = vec3((norm.xy-0.5)*2.0,norm.z); // unpack norm -	 -	frag_color.xyz = giAmbient(pos, norm); -} diff --git a/indra/newview/app_settings/shaders/class1/deferred/waterF.glsl b/indra/newview/app_settings/shaders/class1/deferred/waterF.glsl index daa2fb390a..8de8ba1dd8 100755 --- a/indra/newview/app_settings/shaders/class1/deferred/waterF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/waterF.glsl @@ -53,13 +53,11 @@ uniform vec3 specular;  uniform float lightExp;  uniform float refScale;  uniform float kd; -uniform vec2 screenRes;  uniform vec3 normScale;  uniform float fresnelScale;  uniform float fresnelOffset;  uniform float blurMultiplier; -uniform vec2 screen_res; -uniform mat4 norm_mat; //region space to screen space +uniform mat3 normal_matrix;  //bigWave is (refCoord.w, view.w);  VARYING vec4 refCoord; @@ -163,7 +161,7 @@ void main()  	//wavef.z *= 0.1f;  	//wavef = normalize(wavef); -	vec3 screenspacewavef = (norm_mat*vec4(wavef, 1.0)).xyz; +	vec3 screenspacewavef = normal_matrix*wavef;  	frag_data[0] = vec4(color.rgb, 0.5); // diffuse  	frag_data[1] = vec4(0.5,0.5,0.5, 0.95); // speccolor*spec, spec diff --git a/indra/newview/app_settings/shaders/class1/environment/underWaterF.glsl b/indra/newview/app_settings/shaders/class1/environment/underWaterF.glsl index 0d8dab0a41..485e48537c 100755 --- a/indra/newview/app_settings/shaders/class1/environment/underWaterF.glsl +++ b/indra/newview/app_settings/shaders/class1/environment/underWaterF.glsl @@ -43,13 +43,11 @@ uniform vec2 fbScale;  uniform float refScale;  uniform float znear;  uniform float zfar; -uniform float kd;  uniform vec4 waterPlane;  uniform vec3 eyeVec;  uniform vec4 waterFogColor;  uniform float waterFogDensity;  uniform float waterFogKS; -uniform vec2 screenRes;  //bigWave is (refCoord.w, view.w);  VARYING vec4 refCoord; diff --git a/indra/newview/app_settings/shaders/class1/environment/waterF.glsl b/indra/newview/app_settings/shaders/class1/environment/waterF.glsl index 79bffab745..1fd7bdaa5c 100755 --- a/indra/newview/app_settings/shaders/class1/environment/waterF.glsl +++ b/indra/newview/app_settings/shaders/class1/environment/waterF.glsl @@ -42,8 +42,6 @@ uniform vec3 lightDir;  uniform vec3 specular;  uniform float lightExp;  uniform float refScale; -uniform float kd; -uniform vec2 screenRes;  uniform vec3 normScale;  uniform float fresnelScale;  uniform float fresnelOffset; | 
