diff options
| author | Graham Linden <graham@lindenlab.com> | 2019-04-26 16:02:21 -0700 | 
|---|---|---|
| committer | Graham Linden <graham@lindenlab.com> | 2019-04-26 16:02:21 -0700 | 
| commit | f133be068a4aa23c02c47348f5c7d4a28e1d5c37 (patch) | |
| tree | 948e7fc0ed5fc01acb466f137e088a0d87ca6b64 /indra/newview/app_settings/shaders/class3 | |
| parent | 9d314074c9e3c898436321bdb90d3bf0d10c0079 (diff) | |
Lighting WIP
Consistency across class2/3/ALM lighting.
Diffstat (limited to 'indra/newview/app_settings/shaders/class3')
4 files changed, 17 insertions, 18 deletions
| diff --git a/indra/newview/app_settings/shaders/class3/avatar/avatarV.glsl b/indra/newview/app_settings/shaders/class3/avatar/avatarV.glsl index 721054b5ad..df9704ec25 100644 --- a/indra/newview/app_settings/shaders/class3/avatar/avatarV.glsl +++ b/indra/newview/app_settings/shaders/class3/avatar/avatarV.glsl @@ -33,7 +33,7 @@ ATTRIBUTE vec4 clothing;  VARYING vec4 vertex_color;  VARYING vec2 vary_texcoord0; -vec4 calcLighting(vec3 pos, vec3 norm, vec4 color, vec4 baseCol); +vec4 calcLighting(vec3 pos, vec3 norm, vec4 color);  mat4 getSkinnedTransform();  void calcAtmospherics(vec3 inPositionEye); @@ -127,7 +127,7 @@ void main()  	calcAtmospherics(pos.xyz); -	vec4 col = calcLighting(pos.xyz, norm, color, vec4(0.0));			 +	vec4 col = calcLighting(pos.xyz, norm, color);			  	vertex_color = col;   	gl_Position = projection_matrix * pos; diff --git a/indra/newview/app_settings/shaders/class3/lighting/lightV.glsl b/indra/newview/app_settings/shaders/class3/lighting/lightV.glsl index efe7f69f21..372992fab2 100644 --- a/indra/newview/app_settings/shaders/class3/lighting/lightV.glsl +++ b/indra/newview/app_settings/shaders/class3/lighting/lightV.glsl @@ -26,11 +26,13 @@  // All lights, no specular highlights +vec3 atmosAmbient(); +vec4 sumLights(vec3 pos, vec3 norm, vec4 color); -vec4 sumLights(vec3 pos, vec3 norm, vec4 color, vec4 baseLight); - -vec4 calcLighting(vec3 pos, vec3 norm, vec4 color, vec4 baseLight) +vec4 calcLighting(vec3 pos, vec3 norm, vec4 color)  { -	return sumLights(pos, norm, color, baseLight) * 2.0f; +	vec4 c = sumLights(pos, norm, color * 2.0); +    c.rgb += atmosAmbient() * color.rgb * 0.5; +    return c;  } diff --git a/indra/newview/app_settings/shaders/class3/lighting/sumLightsSpecularV.glsl b/indra/newview/app_settings/shaders/class3/lighting/sumLightsSpecularV.glsl index 6d4192ab13..c1aee69c30 100644 --- a/indra/newview/app_settings/shaders/class3/lighting/sumLightsSpecularV.glsl +++ b/indra/newview/app_settings/shaders/class3/lighting/sumLightsSpecularV.glsl @@ -26,7 +26,7 @@  float calcDirectionalLightSpecular(inout vec4 specular, vec3 view, vec3 n, vec3 l, vec3 lightCol, float da);  vec3 calcPointLightSpecular(inout vec4 specular, vec3 view, vec3 v, vec3 n, vec3 l, float r, float pw, vec3 lightCol); -vec3 atmosAmbient(vec3 light); +vec3 atmosAmbient();  vec3 atmosAffectDirectionalLight(float lightIntensity);  vec3 atmosGetDiffuseSunlightColor();  vec3 scaleDownLight(vec3 light); @@ -35,7 +35,7 @@ uniform vec4 light_position[8];  uniform vec4 light_attenuation[8];   uniform vec3 light_diffuse[8]; -vec4 sumLightsSpecular(vec3 pos, vec3 norm, vec4 color, inout vec4 specularColor, vec4 baseCol) +vec4 sumLightsSpecular(vec3 pos, vec3 norm, vec4 color, inout vec4 specularColor)  {  	vec4 col = vec4(0.0, 0.0, 0.0, color.a); @@ -55,8 +55,8 @@ vec4 sumLightsSpecular(vec3 pos, vec3 norm, vec4 color, inout vec4 specularColor  	col.rgb = scaleDownLight(col.rgb);  	// Add windlight lights -	col.rgb += atmosAmbient(baseCol.rgb); -	col.rgb += atmosAffectDirectionalLight(calcDirectionalLightSpecular(specularSum, view, norm, light_position[0].xyz,atmosGetDiffuseSunlightColor()*baseCol.a, 1.0)); +	col.rgb += atmosAmbient(); +	col.rgb += atmosAffectDirectionalLight(calcDirectionalLightSpecular(specularSum, view, norm, light_position[0].xyz,atmosGetDiffuseSunlightColor(), 1.0));  	col.rgb = min(col.rgb*color.rgb, 1.0);  	specularColor.rgb = min(specularColor.rgb*specularSum.rgb, 1.0); diff --git a/indra/newview/app_settings/shaders/class3/lighting/sumLightsV.glsl b/indra/newview/app_settings/shaders/class3/lighting/sumLightsV.glsl index 097889039d..81da6688c2 100644 --- a/indra/newview/app_settings/shaders/class3/lighting/sumLightsV.glsl +++ b/indra/newview/app_settings/shaders/class3/lighting/sumLightsV.glsl @@ -1,5 +1,5 @@  /** - * @file class3\lighing\sumLightsV.glsl + * @file class3\lighting\sumLightsV.glsl   *   * $LicenseInfo:firstyear=2005&license=viewerlgpl$   * Second Life Viewer Source Code @@ -27,7 +27,6 @@  float calcDirectionalLight(vec3 n, vec3 l);  float calcPointLightOrSpotLight(vec3 v, vec3 n, vec4 lp, vec3 ln, float la, float is_pointlight); -vec3 atmosAmbient(vec3 light);  vec3 atmosAffectDirectionalLight(float lightIntensity);  vec3 scaleDownLight(vec3 light); @@ -36,7 +35,7 @@ uniform vec3 light_direction[8];  uniform vec4 light_attenuation[8];   uniform vec3 light_diffuse[8]; -vec4 sumLights(vec3 pos, vec3 norm, vec4 color, vec4 baseLight) +vec4 sumLights(vec3 pos, vec3 norm, vec4 color)  {  	vec4 col = vec4(0.0, 0.0, 0.0, color.a); @@ -49,13 +48,11 @@ vec4 sumLights(vec3 pos, vec3 norm, vec4 color, vec4 baseLight)  	col.rgb += light_diffuse[5].rgb*calcPointLightOrSpotLight(pos.xyz, norm, light_position[5], light_direction[5], light_attenuation[5].x, light_attenuation[5].z);  	col.rgb += light_diffuse[6].rgb*calcPointLightOrSpotLight(pos.xyz, norm, light_position[6], light_direction[6], light_attenuation[6].x, light_attenuation[6].z);  	col.rgb += light_diffuse[7].rgb*calcPointLightOrSpotLight(pos.xyz, norm, light_position[7], light_direction[7], light_attenuation[7].x, light_attenuation[7].z); -	col.rgb += light_diffuse[1].rgb*calcDirectionalLight(norm, light_direction[1].xyz); -    col.rgb = scaleDownLight(col.grb); +	col.rgb += light_diffuse[1].rgb*calcDirectionalLight(norm, light_position[1].xyz); +    col.rgb = scaleDownLight(col.rgb);  	// Add windlight lights -	col.rgb += atmosAffectDirectionalLight(calcDirectionalLight(norm, light_direction[0].xyz)); -	col.rgb += atmosAmbient(baseLight.rgb); - +	col.rgb += atmosAffectDirectionalLight(calcDirectionalLight(norm, light_position[0].xyz));  	col.rgb = min(col.rgb*color.rgb, 1.0);  	return col;	 | 
