summaryrefslogtreecommitdiff
path: root/indra/newview/app_settings/shaders
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/app_settings/shaders')
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/avatarEyesV.glsl24
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/avatarF.glsl34
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/avatarV.glsl52
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/bumpF.glsl50
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/bumpV.glsl42
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/deferredUtil.glsl172
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/diffuseAlphaMaskF.glsl34
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/diffuseAlphaMaskIndexedF.glsl34
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/diffuseAlphaMaskNoColorF.glsl36
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/diffuseF.glsl26
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/diffuseIndexedF.glsl26
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/diffuseV.glsl22
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/impostorF.glsl32
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/materialV.glsl54
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/pbropaqueV.glsl42
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/pbrterrainV.glsl18
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/postDeferredGammaCorrect.glsl66
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/treeF.glsl30
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/treeV.glsl22
-rw-r--r--indra/newview/app_settings/shaders/class1/interface/normaldebugF.glsl14
-rw-r--r--indra/newview/app_settings/shaders/class1/interface/normaldebugV.glsl16
-rw-r--r--indra/newview/app_settings/shaders/class1/interface/radianceGenF.glsl146
-rw-r--r--indra/newview/app_settings/shaders/class1/objects/bumpF.glsl18
-rw-r--r--indra/newview/app_settings/shaders/class1/objects/bumpV.glsl18
-rw-r--r--indra/newview/app_settings/shaders/class2/deferred/alphaF.glsl70
-rw-r--r--indra/newview/app_settings/shaders/class3/deferred/fullbrightShinyF.glsl28
-rw-r--r--indra/newview/app_settings/shaders/class3/deferred/materialF.glsl24
-rw-r--r--indra/newview/app_settings/shaders/class3/environment/underWaterF.glsl36
-rw-r--r--indra/newview/app_settings/shaders/class3/environment/waterF.glsl38
29 files changed, 612 insertions, 612 deletions
diff --git a/indra/newview/app_settings/shaders/class1/deferred/avatarEyesV.glsl b/indra/newview/app_settings/shaders/class1/deferred/avatarEyesV.glsl
index 43863dd37a..d3ca3ec8c1 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/avatarEyesV.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/avatarEyesV.glsl
@@ -1,24 +1,24 @@
-/**
+/**
* @file avatarEyesV.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$
*/
@@ -40,12 +40,12 @@ out vec3 vary_position;
void main()
{
- //transform vertex
- vary_position = (modelview_matrix * vec4(position.xyz, 1.0)).xyz;
- gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0);
- vary_texcoord0 = (texture_matrix0 * vec4(texcoord0,0,1)).xy;
-
- vary_normal = normalize(normal_matrix * normal);
+ //transform vertex
+ vary_position = (modelview_matrix * vec4(position.xyz, 1.0)).xyz;
+ gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0);
+ vary_texcoord0 = (texture_matrix0 * vec4(texcoord0,0,1)).xy;
+
+ vary_normal = normalize(normal_matrix * normal);
- vertex_color = diffuse_color;
+ vertex_color = diffuse_color;
}
diff --git a/indra/newview/app_settings/shaders/class1/deferred/avatarF.glsl b/indra/newview/app_settings/shaders/class1/deferred/avatarF.glsl
index db7597dd74..b904df3a1b 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/avatarF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/avatarF.glsl
@@ -1,24 +1,24 @@
-/**
+/**
* @file avatarF.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$
*/
@@ -37,21 +37,21 @@ in vec3 vary_position;
void mirrorClip(vec3 pos);
-void main()
+void main()
{
mirrorClip(vary_position);
- vec4 diff = texture(diffuseMap, vary_texcoord0.xy);
-
- if (diff.a < minimum_alpha)
- {
- discard;
- }
-
- frag_data[0] = vec4(diff.rgb, 0.0);
- frag_data[1] = vec4(0,0,0,0);
- vec3 nvn = normalize(vary_normal);
- frag_data[2] = vec4(nvn.xyz, GBUFFER_FLAG_HAS_ATMOS);
+ vec4 diff = texture(diffuseMap, vary_texcoord0.xy);
+
+ if (diff.a < minimum_alpha)
+ {
+ discard;
+ }
+
+ frag_data[0] = vec4(diff.rgb, 0.0);
+ frag_data[1] = vec4(0,0,0,0);
+ vec3 nvn = normalize(vary_normal);
+ frag_data[2] = vec4(nvn.xyz, GBUFFER_FLAG_HAS_ATMOS);
frag_data[3] = vec4(0);
}
diff --git a/indra/newview/app_settings/shaders/class1/deferred/avatarV.glsl b/indra/newview/app_settings/shaders/class1/deferred/avatarV.glsl
index 5cc2846156..aabbbac12a 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/avatarV.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/avatarV.glsl
@@ -1,28 +1,28 @@
-/**
+/**
* @file avatarV.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 mat4 projection_matrix;
in vec3 position;
@@ -39,27 +39,27 @@ out vec3 vary_position;
void main()
{
- vary_texcoord0 = texcoord0;
-
- vec4 pos;
- vec3 norm;
-
- vec4 pos_in = vec4(position.xyz, 1.0);
- mat4 trans = getSkinnedTransform();
- pos.x = dot(trans[0], pos_in);
- pos.y = dot(trans[1], pos_in);
- pos.z = dot(trans[2], pos_in);
- pos.w = 1.0;
-
- norm.x = dot(trans[0].xyz, normal);
- norm.y = dot(trans[1].xyz, normal);
- norm.z = dot(trans[2].xyz, normal);
- norm = normalize(norm);
-
- vary_normal = norm;
-
+ vary_texcoord0 = texcoord0;
+
+ vec4 pos;
+ vec3 norm;
+
+ vec4 pos_in = vec4(position.xyz, 1.0);
+ mat4 trans = getSkinnedTransform();
+ pos.x = dot(trans[0], pos_in);
+ pos.y = dot(trans[1], pos_in);
+ pos.z = dot(trans[2], pos_in);
+ pos.w = 1.0;
+
+ norm.x = dot(trans[0].xyz, normal);
+ norm.y = dot(trans[1].xyz, normal);
+ norm.z = dot(trans[2].xyz, normal);
+ norm = normalize(norm);
+
+ vary_normal = norm;
+
vary_position = pos.xyz;
- gl_Position = projection_matrix * pos;
+ gl_Position = projection_matrix * pos;
}
diff --git a/indra/newview/app_settings/shaders/class1/deferred/bumpF.glsl b/indra/newview/app_settings/shaders/class1/deferred/bumpF.glsl
index 8483f257fa..2cc3085cd0 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/bumpF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/bumpF.glsl
@@ -1,30 +1,30 @@
-/**
+/**
* @file bumpF.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$
*/
/*[EXTRA_CODE_HERE]*/
-
+
out vec4 frag_data[4];
uniform float minimum_alpha;
@@ -40,28 +40,28 @@ in vec2 vary_texcoord0;
in vec3 vary_position;
void mirrorClip(vec3 pos);
-void main()
+void main()
{
mirrorClip(vary_position);
- vec4 col = texture(diffuseMap, vary_texcoord0.xy);
-
- if(col.a < minimum_alpha)
- {
- discard;
- }
- col *= vertex_color;
-
- vec3 norm = texture(bumpMap, vary_texcoord0.xy).rgb * 2.0 - 1.0;
+ vec4 col = texture(diffuseMap, vary_texcoord0.xy);
+
+ if(col.a < minimum_alpha)
+ {
+ discard;
+ }
+ col *= vertex_color;
+
+ vec3 norm = texture(bumpMap, vary_texcoord0.xy).rgb * 2.0 - 1.0;
+
+ vec3 tnorm = vec3(dot(norm,vary_mat0),
+ dot(norm,vary_mat1),
+ dot(norm,vary_mat2));
- vec3 tnorm = vec3(dot(norm,vary_mat0),
- dot(norm,vary_mat1),
- dot(norm,vary_mat2));
-
- frag_data[0] = vec4(col.rgb, 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, GBUFFER_FLAG_HAS_ATMOS);
+ frag_data[0] = vec4(col.rgb, 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, GBUFFER_FLAG_HAS_ATMOS);
frag_data[3] = vec4(vertex_color.a, 0, 0, 0);
}
diff --git a/indra/newview/app_settings/shaders/class1/deferred/bumpV.glsl b/indra/newview/app_settings/shaders/class1/deferred/bumpV.glsl
index 74319349f6..a381392f6c 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/bumpV.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/bumpV.glsl
@@ -1,24 +1,24 @@
-/**
+/**
* @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$
*/
@@ -48,29 +48,29 @@ uniform mat4 projection_matrix;
void main()
{
- //transform vertex
+ //transform vertex
#ifdef HAS_SKIN
mat4 mat = getObjectSkinnedTransform();
- mat = modelview_matrix * mat;
- vec3 pos = (mat*vec4(position.xyz, 1.0)).xyz;
+ mat = modelview_matrix * mat;
+ vec3 pos = (mat*vec4(position.xyz, 1.0)).xyz;
vary_position = pos;
- gl_Position = projection_matrix*vec4(pos, 1.0);
+ gl_Position = projection_matrix*vec4(pos, 1.0);
- vec3 n = normalize((mat * vec4(normal.xyz+position.xyz, 1.0)).xyz-pos.xyz);
- vec3 t = normalize((mat * vec4(tangent.xyz+position.xyz, 1.0)).xyz-pos.xyz);
+ vec3 n = normalize((mat * vec4(normal.xyz+position.xyz, 1.0)).xyz-pos.xyz);
+ vec3 t = normalize((mat * vec4(tangent.xyz+position.xyz, 1.0)).xyz-pos.xyz);
#else
vary_position = (modelview_matrix*vec4(position.xyz, 1.0)).xyz;
- gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0);
- vec3 n = normalize(normal_matrix * normal);
- vec3 t = normalize(normal_matrix * tangent.xyz);
+ gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0);
+ vec3 n = normalize(normal_matrix * normal);
+ vec3 t = normalize(normal_matrix * tangent.xyz);
#endif
- vec3 b = cross(n, t) * tangent.w;
- vary_texcoord0 = (texture_matrix0 * vec4(texcoord0,0,1)).xy;
+ vec3 b = cross(n, t) * tangent.w;
+ vary_texcoord0 = (texture_matrix0 * vec4(texcoord0,0,1)).xy;
+
+ 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);
- 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;
+ vertex_color = diffuse_color;
}
diff --git a/indra/newview/app_settings/shaders/class1/deferred/deferredUtil.glsl b/indra/newview/app_settings/shaders/class1/deferred/deferredUtil.glsl
index f6696e270c..385920f622 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/deferredUtil.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/deferredUtil.glsl
@@ -1,24 +1,24 @@
-/**
+/**
* @file class1/deferred/deferredUtil.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$
*/
@@ -366,14 +366,14 @@ vec3 pbrIbl(vec3 diffuseColor,
float perceptualRough)
{
// retrieve a scale and bias to F0. See [1], Figure 3
- vec2 brdf = BRDF(clamp(nv, 0, 1), 1.0-perceptualRough);
- vec3 diffuseLight = irradiance;
- vec3 specularLight = radiance;
-
- vec3 diffuse = diffuseLight * diffuseColor;
- vec3 specular = specularLight * (specularColor * brdf.x + brdf.y);
+ vec2 brdf = BRDF(clamp(nv, 0, 1), 1.0-perceptualRough);
+ vec3 diffuseLight = irradiance;
+ vec3 specularLight = radiance;
- return (diffuse + specular) * ao;
+ vec3 diffuse = diffuseLight * diffuseColor;
+ vec3 specular = specularLight * (specularColor * brdf.x + brdf.y);
+
+ return (diffuse + specular) * ao;
}
@@ -382,18 +382,18 @@ vec3 pbrIbl(vec3 diffuseColor,
// of the shading terms, outlined in the Readme.MD Appendix.
struct PBRInfo
{
- float NdotL; // cos angle between normal and light direction
- float NdotV; // cos angle between normal and view direction
- float NdotH; // cos angle between normal and half vector
- float LdotH; // cos angle between light direction and half vector
- float VdotH; // cos angle between view direction and half vector
- float perceptualRoughness; // roughness value, as authored by the model creator (input to shader)
- float metalness; // metallic value at the surface
- vec3 reflectance0; // full reflectance color (normal incidence angle)
- vec3 reflectance90; // reflectance color at grazing angle
- float alphaRoughness; // roughness mapped to a more linear change in the roughness (proposed by [2])
- vec3 diffuseColor; // color contribution from diffuse lighting
- vec3 specularColor; // color contribution from specular lighting
+ float NdotL; // cos angle between normal and light direction
+ float NdotV; // cos angle between normal and view direction
+ float NdotH; // cos angle between normal and half vector
+ float LdotH; // cos angle between light direction and half vector
+ float VdotH; // cos angle between view direction and half vector
+ float perceptualRoughness; // roughness value, as authored by the model creator (input to shader)
+ float metalness; // metallic value at the surface
+ vec3 reflectance0; // full reflectance color (normal incidence angle)
+ vec3 reflectance90; // reflectance color at grazing angle
+ float alphaRoughness; // roughness mapped to a more linear change in the roughness (proposed by [2])
+ vec3 diffuseColor; // color contribution from diffuse lighting
+ vec3 specularColor; // color contribution from specular lighting
};
// Basic Lambertian diffuse
@@ -401,14 +401,14 @@ struct PBRInfo
// See also [1], Equation 1
vec3 diffuse(PBRInfo pbrInputs)
{
- return pbrInputs.diffuseColor / M_PI;
+ return pbrInputs.diffuseColor / M_PI;
}
// The following equation models the Fresnel reflectance term of the spec equation (aka F())
// Implementation of fresnel from [4], Equation 15
vec3 specularReflection(PBRInfo pbrInputs)
{
- return pbrInputs.reflectance0 + (pbrInputs.reflectance90 - pbrInputs.reflectance0) * pow(clamp(1.0 - pbrInputs.VdotH, 0.0, 1.0), 5.0);
+ return pbrInputs.reflectance0 + (pbrInputs.reflectance90 - pbrInputs.reflectance0) * pow(clamp(1.0 - pbrInputs.VdotH, 0.0, 1.0), 5.0);
}
// This calculates the specular geometric attenuation (aka G()),
@@ -417,13 +417,13 @@ vec3 specularReflection(PBRInfo pbrInputs)
// alphaRoughness as input as originally proposed in [2].
float geometricOcclusion(PBRInfo pbrInputs)
{
- float NdotL = pbrInputs.NdotL;
- float NdotV = pbrInputs.NdotV;
- float r = pbrInputs.alphaRoughness;
+ float NdotL = pbrInputs.NdotL;
+ float NdotV = pbrInputs.NdotV;
+ float r = pbrInputs.alphaRoughness;
- float attenuationL = 2.0 * NdotL / (NdotL + sqrt(r * r + (1.0 - r * r) * (NdotL * NdotL)));
- float attenuationV = 2.0 * NdotV / (NdotV + sqrt(r * r + (1.0 - r * r) * (NdotV * NdotV)));
- return attenuationL * attenuationV;
+ float attenuationL = 2.0 * NdotL / (NdotL + sqrt(r * r + (1.0 - r * r) * (NdotL * NdotL)));
+ float attenuationV = 2.0 * NdotV / (NdotV + sqrt(r * r + (1.0 - r * r) * (NdotV * NdotV)));
+ return attenuationL * attenuationV;
}
// The following equation(s) model the distribution of microfacet normals across the area being drawn (aka D())
@@ -431,13 +431,13 @@ float geometricOcclusion(PBRInfo pbrInputs)
// Follows the distribution function recommended in the SIGGRAPH 2013 course notes from EPIC Games [1], Equation 3.
float microfacetDistribution(PBRInfo pbrInputs)
{
- float roughnessSq = pbrInputs.alphaRoughness * pbrInputs.alphaRoughness;
- float f = (pbrInputs.NdotH * roughnessSq - pbrInputs.NdotH) * pbrInputs.NdotH + 1.0;
- return roughnessSq / (M_PI * f * f);
+ float roughnessSq = pbrInputs.alphaRoughness * pbrInputs.alphaRoughness;
+ float f = (pbrInputs.NdotH * roughnessSq - pbrInputs.NdotH) * pbrInputs.NdotH + 1.0;
+ return roughnessSq / (M_PI * f * f);
}
-vec3 pbrPunctual(vec3 diffuseColor, vec3 specularColor,
- float perceptualRoughness,
+vec3 pbrPunctual(vec3 diffuseColor, vec3 specularColor,
+ float perceptualRoughness,
float metallic,
vec3 n, // normal
vec3 v, // surface point to camera
@@ -445,53 +445,53 @@ vec3 pbrPunctual(vec3 diffuseColor, vec3 specularColor,
{
// make sure specular highlights from punctual lights don't fall off of polished surfaces
perceptualRoughness = max(perceptualRoughness, 8.0/255.0);
-
- float alphaRoughness = perceptualRoughness * perceptualRoughness;
-
- // Compute reflectance.
- float reflectance = max(max(specularColor.r, specularColor.g), specularColor.b);
-
- // For typical incident reflectance range (between 4% to 100%) set the grazing reflectance to 100% for typical fresnel effect.
- // For very low reflectance range on highly diffuse objects (below 4%), incrementally reduce grazing reflecance to 0%.
- float reflectance90 = clamp(reflectance * 25.0, 0.0, 1.0);
- vec3 specularEnvironmentR0 = specularColor.rgb;
- vec3 specularEnvironmentR90 = vec3(1.0, 1.0, 1.0) * reflectance90;
-
- vec3 h = normalize(l+v); // Half vector between both l and v
- vec3 reflection = -normalize(reflect(v, n));
- reflection.y *= -1.0f;
-
- float NdotL = clamp(dot(n, l), 0.001, 1.0);
- float NdotV = clamp(abs(dot(n, v)), 0.001, 1.0);
- float NdotH = clamp(dot(n, h), 0.0, 1.0);
- float LdotH = clamp(dot(l, h), 0.0, 1.0);
- float VdotH = clamp(dot(v, h), 0.0, 1.0);
-
- PBRInfo pbrInputs = PBRInfo(
- NdotL,
- NdotV,
- NdotH,
- LdotH,
- VdotH,
- perceptualRoughness,
- metallic,
- specularEnvironmentR0,
- specularEnvironmentR90,
- alphaRoughness,
- diffuseColor,
- specularColor
- );
-
- // Calculate the shading terms for the microfacet specular shading model
- vec3 F = specularReflection(pbrInputs);
- float G = geometricOcclusion(pbrInputs);
- float D = microfacetDistribution(pbrInputs);
-
- // Calculation of analytical lighting contribution
- vec3 diffuseContrib = (1.0 - F) * diffuse(pbrInputs);
- vec3 specContrib = F * G * D / (4.0 * NdotL * NdotV);
- // Obtain final intensity as reflectance (BRDF) scaled by the energy of the light (cosine law)
- vec3 color = NdotL * (diffuseContrib + specContrib);
+
+ float alphaRoughness = perceptualRoughness * perceptualRoughness;
+
+ // Compute reflectance.
+ float reflectance = max(max(specularColor.r, specularColor.g), specularColor.b);
+
+ // For typical incident reflectance range (between 4% to 100%) set the grazing reflectance to 100% for typical fresnel effect.
+ // For very low reflectance range on highly diffuse objects (below 4%), incrementally reduce grazing reflecance to 0%.
+ float reflectance90 = clamp(reflectance * 25.0, 0.0, 1.0);
+ vec3 specularEnvironmentR0 = specularColor.rgb;
+ vec3 specularEnvironmentR90 = vec3(1.0, 1.0, 1.0) * reflectance90;
+
+ vec3 h = normalize(l+v); // Half vector between both l and v
+ vec3 reflection = -normalize(reflect(v, n));
+ reflection.y *= -1.0f;
+
+ float NdotL = clamp(dot(n, l), 0.001, 1.0);
+ float NdotV = clamp(abs(dot(n, v)), 0.001, 1.0);
+ float NdotH = clamp(dot(n, h), 0.0, 1.0);
+ float LdotH = clamp(dot(l, h), 0.0, 1.0);
+ float VdotH = clamp(dot(v, h), 0.0, 1.0);
+
+ PBRInfo pbrInputs = PBRInfo(
+ NdotL,
+ NdotV,
+ NdotH,
+ LdotH,
+ VdotH,
+ perceptualRoughness,
+ metallic,
+ specularEnvironmentR0,
+ specularEnvironmentR90,
+ alphaRoughness,
+ diffuseColor,
+ specularColor
+ );
+
+ // Calculate the shading terms for the microfacet specular shading model
+ vec3 F = specularReflection(pbrInputs);
+ float G = geometricOcclusion(pbrInputs);
+ float D = microfacetDistribution(pbrInputs);
+
+ // Calculation of analytical lighting contribution
+ vec3 diffuseContrib = (1.0 - F) * diffuse(pbrInputs);
+ vec3 specContrib = F * G * D / (4.0 * NdotL * NdotV);
+ // Obtain final intensity as reflectance (BRDF) scaled by the energy of the light (cosine law)
+ vec3 color = NdotL * (diffuseContrib + specContrib);
return clamp(color, vec3(0), vec3(10));
}
@@ -509,9 +509,9 @@ vec3 pbrBaseLight(vec3 diffuseColor, vec3 specularColor, float metallic, vec3 v,
vec3 color = vec3(0);
float NdotV = clamp(abs(dot(norm, v)), 0.001, 1.0);
-
+
color += pbrIbl(diffuseColor, specularColor, radiance, irradiance, ao, NdotV, perceptualRoughness);
-
+
color += pbrPunctual(diffuseColor, specularColor, perceptualRoughness, metallic, norm, v, normalize(light_dir)) * sunlit * 3.0 * scol; //magic number to balance with legacy materials
color += colorEmissive;
diff --git a/indra/newview/app_settings/shaders/class1/deferred/diffuseAlphaMaskF.glsl b/indra/newview/app_settings/shaders/class1/deferred/diffuseAlphaMaskF.glsl
index 82d5d363d2..1751e17814 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/diffuseAlphaMaskF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/diffuseAlphaMaskF.glsl
@@ -1,24 +1,24 @@
-/**
+/**
* @file diffuseAlphaMaskF.glsl
*
* $LicenseInfo:firstyear=2011&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2011, 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$
*/
@@ -39,21 +39,21 @@ in vec2 vary_texcoord0;
void mirrorClip(vec3 pos);
-void main()
+void main()
{
mirrorClip(vary_position);
- vec4 col = texture(diffuseMap, vary_texcoord0.xy) * vertex_color;
-
- if (col.a < minimum_alpha)
- {
- discard;
- }
-
- frag_data[0] = vec4(col.rgb, 0.0);
- frag_data[1] = vec4(0,0,0,0); // spec
- vec3 nvn = normalize(vary_normal);
- frag_data[2] = vec4(nvn.xyz, GBUFFER_FLAG_HAS_ATMOS);
+ vec4 col = texture(diffuseMap, vary_texcoord0.xy) * vertex_color;
+
+ if (col.a < minimum_alpha)
+ {
+ discard;
+ }
+
+ frag_data[0] = vec4(col.rgb, 0.0);
+ frag_data[1] = vec4(0,0,0,0); // spec
+ vec3 nvn = normalize(vary_normal);
+ frag_data[2] = vec4(nvn.xyz, GBUFFER_FLAG_HAS_ATMOS);
frag_data[3] = vec4(0);
}
diff --git a/indra/newview/app_settings/shaders/class1/deferred/diffuseAlphaMaskIndexedF.glsl b/indra/newview/app_settings/shaders/class1/deferred/diffuseAlphaMaskIndexedF.glsl
index 788ea633fc..f5b517a8ea 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/diffuseAlphaMaskIndexedF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/diffuseAlphaMaskIndexedF.glsl
@@ -1,24 +1,24 @@
-/**
+/**
* @file diffuseAlphaMaskIndexedF.glsl
*
* $LicenseInfo:firstyear=2011&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2011, 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$
*/
@@ -37,20 +37,20 @@ in vec2 vary_texcoord0;
void mirrorClip(vec3 pos);
-void main()
+void main()
{
mirrorClip(vary_position);
- vec4 col = diffuseLookup(vary_texcoord0.xy) * vertex_color;
-
- if (col.a < minimum_alpha)
- {
- discard;
- }
-
- frag_data[0] = vec4(col.rgb, 0.0);
- frag_data[1] = vec4(0,0,0,0);
- vec3 nvn = normalize(vary_normal);
- frag_data[2] = vec4(nvn.xyz, GBUFFER_FLAG_HAS_ATMOS);
+ vec4 col = diffuseLookup(vary_texcoord0.xy) * vertex_color;
+
+ if (col.a < minimum_alpha)
+ {
+ discard;
+ }
+
+ frag_data[0] = vec4(col.rgb, 0.0);
+ frag_data[1] = vec4(0,0,0,0);
+ vec3 nvn = normalize(vary_normal);
+ frag_data[2] = vec4(nvn.xyz, GBUFFER_FLAG_HAS_ATMOS);
frag_data[3] = vec4(0);
}
diff --git a/indra/newview/app_settings/shaders/class1/deferred/diffuseAlphaMaskNoColorF.glsl b/indra/newview/app_settings/shaders/class1/deferred/diffuseAlphaMaskNoColorF.glsl
index 22e6d60419..89ea0c1710 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/diffuseAlphaMaskNoColorF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/diffuseAlphaMaskNoColorF.glsl
@@ -1,28 +1,28 @@
-/**
+/**
* @file diffuseAlphaMaskNoColorF.glsl
*
* $LicenseInfo:firstyear=2005&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2005, 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$
*/
-
+
/*[EXTRA_CODE_HERE]*/
out vec4 frag_data[4];
@@ -34,19 +34,19 @@ uniform sampler2D diffuseMap;
in vec3 vary_normal;
in vec2 vary_texcoord0;
-void main()
+void main()
{
- vec4 col = texture(diffuseMap, vary_texcoord0.xy);
-
- if (col.a < minimum_alpha)
- {
- discard;
- }
-
- frag_data[0] = vec4(col.rgb, 0.0);
- frag_data[1] = vec4(0,0,0,0); // spec
- vec3 nvn = normalize(vary_normal);
- frag_data[2] = vec4(nvn.xyz, GBUFFER_FLAG_HAS_ATMOS);
+ vec4 col = texture(diffuseMap, vary_texcoord0.xy);
+
+ if (col.a < minimum_alpha)
+ {
+ discard;
+ }
+
+ frag_data[0] = vec4(col.rgb, 0.0);
+ frag_data[1] = vec4(0,0,0,0); // spec
+ vec3 nvn = normalize(vary_normal);
+ frag_data[2] = vec4(nvn.xyz, GBUFFER_FLAG_HAS_ATMOS);
frag_data[3] = vec4(0);
}
diff --git a/indra/newview/app_settings/shaders/class1/deferred/diffuseF.glsl b/indra/newview/app_settings/shaders/class1/deferred/diffuseF.glsl
index 799fc62a42..7f056a51e8 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/diffuseF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/diffuseF.glsl
@@ -1,30 +1,30 @@
-/**
+/**
* @file diffuseF.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$
*/
/*[EXTRA_CODE_HERE]*/
-
+
out vec4 frag_data[4];
uniform sampler2D diffuseMap;
@@ -36,15 +36,15 @@ in vec3 vary_position;
void mirrorClip(vec3 pos);
-void main()
+void main()
{
mirrorClip(vary_position);
- vec3 col = vertex_color.rgb * texture(diffuseMap, vary_texcoord0.xy).rgb;
- frag_data[0] = vec4(col, 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(vary_normal);
- frag_data[2] = vec4(nvn.xyz, GBUFFER_FLAG_HAS_ATMOS);
+ vec3 col = vertex_color.rgb * texture(diffuseMap, vary_texcoord0.xy).rgb;
+ frag_data[0] = vec4(col, 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(vary_normal);
+ frag_data[2] = vec4(nvn.xyz, GBUFFER_FLAG_HAS_ATMOS);
frag_data[3] = vec4(vertex_color.a, 0, 0, 0);
}
diff --git a/indra/newview/app_settings/shaders/class1/deferred/diffuseIndexedF.glsl b/indra/newview/app_settings/shaders/class1/deferred/diffuseIndexedF.glsl
index 3362a180c6..5c73878ba9 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/diffuseIndexedF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/diffuseIndexedF.glsl
@@ -1,24 +1,24 @@
-/**
+/**
* @file diffuseIndexedF.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$
*/
@@ -35,17 +35,17 @@ in vec3 vary_position;
void mirrorClip(vec3 pos);
vec3 linear_to_srgb(vec3 c);
-void main()
+void main()
{
mirrorClip(vary_position);
- vec3 col = vertex_color.rgb * diffuseLookup(vary_texcoord0.xy).rgb;
+ vec3 col = vertex_color.rgb * diffuseLookup(vary_texcoord0.xy).rgb;
- vec3 spec;
- spec.rgb = vec3(vertex_color.a);
+ vec3 spec;
+ spec.rgb = vec3(vertex_color.a);
- frag_data[0] = vec4(col, 0.0);
- frag_data[1] = vec4(spec, vertex_color.a); // spec
- vec3 nvn = normalize(vary_normal);
- frag_data[2] = vec4(nvn.xyz, GBUFFER_FLAG_HAS_ATMOS);
+ frag_data[0] = vec4(col, 0.0);
+ frag_data[1] = vec4(spec, vertex_color.a); // spec
+ vec3 nvn = normalize(vary_normal);
+ frag_data[2] = vec4(nvn.xyz, GBUFFER_FLAG_HAS_ATMOS);
frag_data[3] = vec4(vertex_color.a, 0, 0, 0);
}
diff --git a/indra/newview/app_settings/shaders/class1/deferred/diffuseV.glsl b/indra/newview/app_settings/shaders/class1/deferred/diffuseV.glsl
index 64230dc680..4bd31cef9e 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/diffuseV.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/diffuseV.glsl
@@ -1,24 +1,24 @@
-/**
+/**
* @file diffuseV.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$
*/
@@ -59,13 +59,13 @@ void main()
vary_normal = normalize((mat*vec4(normal.xyz+position.xyz,1.0)).xyz-pos.xyz);
#else
vary_position = (modelview_matrix * vec4(position.xyz, 1.0)).xyz;
- gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0);
+ gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0);
vary_normal = normalize(normal_matrix * normal);
#endif
-
- vary_texcoord0 = (texture_matrix0 * vec4(texcoord0,0,1)).xy;
-
- passTextureIndex();
- vertex_color = diffuse_color;
+ vary_texcoord0 = (texture_matrix0 * vec4(texcoord0,0,1)).xy;
+
+ passTextureIndex();
+
+ vertex_color = diffuse_color;
}
diff --git a/indra/newview/app_settings/shaders/class1/deferred/impostorF.glsl b/indra/newview/app_settings/shaders/class1/deferred/impostorF.glsl
index c64f65e32c..99cb23839a 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/impostorF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/impostorF.glsl
@@ -1,24 +1,24 @@
-/**
+/**
* @file impostorF.glsl
*
* $LicenseInfo:firstyear=2011&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$
*/
@@ -38,20 +38,20 @@ in vec2 vary_texcoord0;
vec3 linear_to_srgb(vec3 c);
-void main()
+void main()
{
- vec4 col = texture(diffuseMap, vary_texcoord0.xy);
+ vec4 col = texture(diffuseMap, vary_texcoord0.xy);
- if (col.a < minimum_alpha)
- {
- discard;
- }
+ if (col.a < minimum_alpha)
+ {
+ discard;
+ }
- vec4 norm = texture(normalMap, vary_texcoord0.xy);
- vec4 spec = texture(specularMap, vary_texcoord0.xy);
+ vec4 norm = texture(normalMap, vary_texcoord0.xy);
+ vec4 spec = texture(specularMap, vary_texcoord0.xy);
- frag_data[0] = vec4(col.rgb, 0.0);
- frag_data[1] = spec;
- frag_data[2] = vec4(norm.xyz, GBUFFER_FLAG_HAS_ATMOS);
+ frag_data[0] = vec4(col.rgb, 0.0);
+ frag_data[1] = spec;
+ frag_data[2] = vec4(norm.xyz, GBUFFER_FLAG_HAS_ATMOS);
frag_data[3] = vec4(0);
}
diff --git a/indra/newview/app_settings/shaders/class1/deferred/materialV.glsl b/indra/newview/app_settings/shaders/class1/deferred/materialV.glsl
index ddf878ae60..b6528dfcf8 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/materialV.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/materialV.glsl
@@ -1,24 +1,24 @@
-/**
+/**
* @file materialV.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$
*/
@@ -65,67 +65,67 @@ out vec3 vary_normal;
in vec2 texcoord2;
out vec2 vary_texcoord2;
#endif
-
+
out vec4 vertex_color;
out vec2 vary_texcoord0;
void main()
{
#ifdef HAS_SKIN
- mat4 mat = getObjectSkinnedTransform();
+ mat4 mat = getObjectSkinnedTransform();
- mat = modelview_matrix * mat;
+ mat = modelview_matrix * mat;
- vec3 pos = (mat*vec4(position.xyz,1.0)).xyz;
+ vec3 pos = (mat*vec4(position.xyz,1.0)).xyz;
- vary_position = pos;
+ vary_position = pos;
- gl_Position = projection_matrix*vec4(pos,1.0);
+ gl_Position = projection_matrix*vec4(pos,1.0);
#else
- //transform vertex
- gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0);
+ //transform vertex
+ gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0);
#endif
-
- vary_texcoord0 = (texture_matrix0 * vec4(texcoord0,0,1)).xy;
-
+
+ vary_texcoord0 = (texture_matrix0 * vec4(texcoord0,0,1)).xy;
+
#ifdef HAS_NORMAL_MAP
- vary_texcoord1 = (texture_matrix0 * vec4(texcoord1,0,1)).xy;
+ vary_texcoord1 = (texture_matrix0 * vec4(texcoord1,0,1)).xy;
#endif
#ifdef HAS_SPECULAR_MAP
- vary_texcoord2 = (texture_matrix0 * vec4(texcoord2,0,1)).xy;
+ vary_texcoord2 = (texture_matrix0 * vec4(texcoord2,0,1)).xy;
#endif
#ifdef HAS_SKIN
- vec3 n = normalize((mat*vec4(normal.xyz+position.xyz,1.0)).xyz-pos.xyz);
+ vec3 n = normalize((mat*vec4(normal.xyz+position.xyz,1.0)).xyz-pos.xyz);
#ifdef HAS_NORMAL_MAP
- vec3 t = normalize((mat*vec4(tangent.xyz+position.xyz,1.0)).xyz-pos.xyz);
+ vec3 t = normalize((mat*vec4(tangent.xyz+position.xyz,1.0)).xyz-pos.xyz);
vary_tangent = t;
vary_sign = tangent.w;
vary_normal = n;
#else //HAS_NORMAL_MAP
- vary_normal = n;
+ vary_normal = n;
#endif //HAS_NORMAL_MAP
#else //HAS_SKIN
- vec3 n = normalize(normal_matrix * normal);
+ vec3 n = normalize(normal_matrix * normal);
#ifdef HAS_NORMAL_MAP
- vec3 t = normalize(normal_matrix * tangent.xyz);
+ vec3 t = normalize(normal_matrix * tangent.xyz);
vary_tangent = t;
vary_sign = tangent.w;
vary_normal = n;
#else //HAS_NORMAL_MAP
- vary_normal = n;
+ vary_normal = n;
#endif //HAS_NORMAL_MAP
#endif //HAS_SKIN
-
- vertex_color = diffuse_color;
+
+ vertex_color = diffuse_color;
#if !defined(HAS_SKIN)
- vary_position = (modelview_matrix*vec4(position.xyz, 1.0)).xyz;
+ vary_position = (modelview_matrix*vec4(position.xyz, 1.0)).xyz;
#endif
}
diff --git a/indra/newview/app_settings/shaders/class1/deferred/pbropaqueV.glsl b/indra/newview/app_settings/shaders/class1/deferred/pbropaqueV.glsl
index 5e0141910b..fd020afd57 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/pbropaqueV.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/pbropaqueV.glsl
@@ -1,24 +1,24 @@
-/**
+/**
* @file pbropaqueV.glsl
*
* $LicenseInfo:firstyear=2022&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2022, 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$
*/
@@ -54,7 +54,7 @@ out vec2 base_color_texcoord;
out vec2 normal_texcoord;
out vec2 metallic_roughness_texcoord;
out vec2 emissive_texcoord;
-
+
out vec4 vertex_color;
out vec3 vary_tangent;
@@ -68,18 +68,18 @@ vec3 tangent_space_transform(vec4 vertex_tangent, vec3 vertex_normal, vec4[2] kh
void main()
{
#ifdef HAS_SKIN
- mat4 mat = getObjectSkinnedTransform();
+ mat4 mat = getObjectSkinnedTransform();
- mat = modelview_matrix * mat;
+ mat = modelview_matrix * mat;
- vec3 pos = (mat*vec4(position.xyz,1.0)).xyz;
+ vec3 pos = (mat*vec4(position.xyz,1.0)).xyz;
vary_position = pos;
- gl_Position = projection_matrix*vec4(pos,1.0);
+ gl_Position = projection_matrix*vec4(pos,1.0);
#else
vary_position = (modelview_matrix*vec4(position.xyz, 1.0)).xyz;
- //transform vertex
- gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0);
+ //transform vertex
+ gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0);
#endif
base_color_texcoord = texture_transform(texcoord0, texture_base_color_transform, texture_matrix0);
@@ -88,11 +88,11 @@ void main()
emissive_texcoord = texture_transform(texcoord0, texture_emissive_transform, texture_matrix0);
#ifdef HAS_SKIN
- vec3 n = (mat*vec4(normal.xyz+position.xyz,1.0)).xyz-pos.xyz;
- vec3 t = (mat*vec4(tangent.xyz+position.xyz,1.0)).xyz-pos.xyz;
+ vec3 n = (mat*vec4(normal.xyz+position.xyz,1.0)).xyz-pos.xyz;
+ vec3 t = (mat*vec4(tangent.xyz+position.xyz,1.0)).xyz-pos.xyz;
#else //HAS_SKIN
- vec3 n = normal_matrix * normal;
- vec3 t = normal_matrix * tangent.xyz;
+ vec3 n = normal_matrix * normal;
+ vec3 t = normal_matrix * tangent.xyz;
#endif
n = normalize(n);
@@ -100,11 +100,11 @@ void main()
vary_tangent = normalize(tangent_space_transform(vec4(t, tangent.w), n, texture_normal_transform, texture_matrix0));
vary_sign = tangent.w;
vary_normal = n;
-
- vertex_color = diffuse_color;
+
+ vertex_color = diffuse_color;
}
-#else
+#else
// fullbright HUD implementation
@@ -121,7 +121,7 @@ in vec2 texcoord0;
out vec2 base_color_texcoord;
out vec2 emissive_texcoord;
-
+
out vec4 vertex_color;
vec2 texture_transform(vec2 vertex_texcoord, vec4[2] khr_gltf_transform, mat4 sl_animation_transform);
@@ -129,7 +129,7 @@ vec2 texture_transform(vec2 vertex_texcoord, vec4[2] khr_gltf_transform, mat4 sl
void main()
{
//transform vertex
- gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0);
+ gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0);
base_color_texcoord = texture_transform(texcoord0, texture_base_color_transform, texture_matrix0);
emissive_texcoord = texture_transform(texcoord0, texture_emissive_transform, texture_matrix0);
diff --git a/indra/newview/app_settings/shaders/class1/deferred/pbrterrainV.glsl b/indra/newview/app_settings/shaders/class1/deferred/pbrterrainV.glsl
index 489fc26e3f..4efb9a1f53 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/pbrterrainV.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/pbrterrainV.glsl
@@ -1,24 +1,24 @@
-/**
+/**
* @file class1\environment\pbrterrainV.glsl
*
* $LicenseInfo:firstyear=2023&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2023, 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$
*/
@@ -56,12 +56,12 @@ vec3 tangent_space_transform(vec4 vertex_tangent, vec3 vertex_normal, vec4[2] kh
void main()
{
//transform vertex
- gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0);
+ gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0);
vary_position = (modelview_matrix*vec4(position.xyz, 1.0)).xyz;
- vec3 n = normal_matrix * normal;
+ vec3 n = normal_matrix * normal;
vary_vertex_normal = normal;
- vec3 t = normal_matrix * tangent.xyz;
+ vec3 t = normal_matrix * tangent.xyz;
vary_tangent = normalize(t);
// *TODO: Decide if we want this. It may be better to just calculate the
@@ -88,7 +88,7 @@ void main()
#elif TERRAIN_PLANAR_TEXTURE_SAMPLE_COUNT == 1
vary_texcoord0.xy = texture_transform(position.xy, texture_base_color_transform, texture_matrix0);
#endif
-
+
vec4 tc = vec4(texcoord1,0,1);
vary_texcoord0.zw = tc.xy;
vary_texcoord1.xy = tc.xy-vec2(2.0, 0.0);
diff --git a/indra/newview/app_settings/shaders/class1/deferred/postDeferredGammaCorrect.glsl b/indra/newview/app_settings/shaders/class1/deferred/postDeferredGammaCorrect.glsl
index 1629ed91c8..a0eb6cfbb8 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/postDeferredGammaCorrect.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/postDeferredGammaCorrect.glsl
@@ -1,28 +1,28 @@
-/**
+/**
* @file postDeferredGammaCorrect.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$
*/
-
+
/*[EXTRA_CODE_HERE]*/
out vec4 frag_color;
@@ -79,7 +79,7 @@ vec3 RRTAndODTFit(vec3 color)
}
-// tone mapping
+// tone mapping
vec3 toneMapACES_Hill(vec3 color)
{
color = ACESInputMat * color;
@@ -103,7 +103,7 @@ vec3 toneMap(vec3 color)
{
#ifndef NO_POST
float exp_scale = texture(exposureMap, vec2(0.5,0.5)).r;
-
+
color *= exposure * exp_scale;
// mix ACES and Linear here as a compromise to avoid over-darkening legacy content
@@ -117,38 +117,38 @@ vec3 toneMap(vec3 color)
//=================================
// borrowed noise from:
-// <https://www.shadertoy.com/view/4dS3Wd>
-// By Morgan McGuire @morgan3d, http://graphicscodex.com
+// <https://www.shadertoy.com/view/4dS3Wd>
+// By Morgan McGuire @morgan3d, http://graphicscodex.com
//
float hash(float n) { return fract(sin(n) * 1e4); }
float hash(vec2 p) { return fract(1e4 * sin(17.0 * p.x + p.y * 0.1) * (0.1 + abs(sin(p.y * 13.0 + p.x)))); }
float noise(float x) {
- float i = floor(x);
- float f = fract(x);
- float u = f * f * (3.0 - 2.0 * f);
- return mix(hash(i), hash(i + 1.0), u);
+ float i = floor(x);
+ float f = fract(x);
+ float u = f * f * (3.0 - 2.0 * f);
+ return mix(hash(i), hash(i + 1.0), u);
}
float noise(vec2 x) {
- vec2 i = floor(x);
- vec2 f = fract(x);
-
- // Four corners in 2D of a tile
- float a = hash(i);
- float b = hash(i + vec2(1.0, 0.0));
- float c = hash(i + vec2(0.0, 1.0));
- float d = hash(i + vec2(1.0, 1.0));
-
- // Simple 2D lerp using smoothstep envelope between the values.
- // return vec3(mix(mix(a, b, smoothstep(0.0, 1.0, f.x)),
- // mix(c, d, smoothstep(0.0, 1.0, f.x)),
- // smoothstep(0.0, 1.0, f.y)));
-
- // Same code, with the clamps in smoothstep and common subexpressions
- // optimized away.
- vec2 u = f * f * (3.0 - 2.0 * f);
- return mix(a, b, u.x) + (c - a) * u.y * (1.0 - u.x) + (d - b) * u.x * u.y;
+ vec2 i = floor(x);
+ vec2 f = fract(x);
+
+ // Four corners in 2D of a tile
+ float a = hash(i);
+ float b = hash(i + vec2(1.0, 0.0));
+ float c = hash(i + vec2(0.0, 1.0));
+ float d = hash(i + vec2(1.0, 1.0));
+
+ // Simple 2D lerp using smoothstep envelope between the values.
+ // return vec3(mix(mix(a, b, smoothstep(0.0, 1.0, f.x)),
+ // mix(c, d, smoothstep(0.0, 1.0, f.x)),
+ // smoothstep(0.0, 1.0, f.y)));
+
+ // Same code, with the clamps in smoothstep and common subexpressions
+ // optimized away.
+ vec2 u = f * f * (3.0 - 2.0 * f);
+ return mix(a, b, u.x) + (c - a) * u.y * (1.0 - u.x) + (d - b) * u.x * u.y;
}
//=============================
@@ -171,7 +171,7 @@ vec3 legacyGamma(vec3 color)
return c;
}
-void main()
+void main()
{
//this is the one of the rare spots where diffuseRect contains linear color values (not sRGB)
vec4 diff = texture(diffuseRect, vary_fragcoord);
diff --git a/indra/newview/app_settings/shaders/class1/deferred/treeF.glsl b/indra/newview/app_settings/shaders/class1/deferred/treeF.glsl
index 708acd0194..05922ecb1a 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/treeF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/treeF.glsl
@@ -1,24 +1,24 @@
-/**
+/**
* @file treeF.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$
*/
@@ -37,18 +37,18 @@ in vec3 vary_position;
uniform float minimum_alpha;
void mirrorClip(vec3 pos);
-void main()
+void main()
{
mirrorClip(vary_position);
- vec4 col = texture(diffuseMap, vary_texcoord0.xy);
- if (col.a < minimum_alpha)
- {
- discard;
- }
+ vec4 col = texture(diffuseMap, vary_texcoord0.xy);
+ if (col.a < minimum_alpha)
+ {
+ discard;
+ }
- frag_data[0] = vec4(vertex_color.rgb*col.rgb, 0.0);
- frag_data[1] = vec4(0,0,0,0);
- vec3 nvn = normalize(vary_normal);
- frag_data[2] = vec4(nvn.xyz, GBUFFER_FLAG_HAS_ATMOS);
+ frag_data[0] = vec4(vertex_color.rgb*col.rgb, 0.0);
+ frag_data[1] = vec4(0,0,0,0);
+ vec3 nvn = normalize(vary_normal);
+ frag_data[2] = vec4(nvn.xyz, GBUFFER_FLAG_HAS_ATMOS);
frag_data[3] = vec4(0);
}
diff --git a/indra/newview/app_settings/shaders/class1/deferred/treeV.glsl b/indra/newview/app_settings/shaders/class1/deferred/treeV.glsl
index c84fccd4c6..ef5602f1e5 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/treeV.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/treeV.glsl
@@ -1,24 +1,24 @@
-/**
+/**
* @file treeV.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$
*/
@@ -39,13 +39,13 @@ out vec3 vary_position;
void main()
{
- //transform vertex
- gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0);
+ //transform vertex
+ gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0);
vary_position = (modelview_matrix*vec4(position.xyz, 1.0)).xyz;
- vary_texcoord0 = (texture_matrix0 * vec4(texcoord0,0,1)).xy;
-
- vary_normal = normalize(normal_matrix * normal);
+ vary_texcoord0 = (texture_matrix0 * vec4(texcoord0,0,1)).xy;
+
+ vary_normal = normalize(normal_matrix * normal);
- vertex_color = vec4(1,1,1,1);
+ vertex_color = vec4(1,1,1,1);
}
diff --git a/indra/newview/app_settings/shaders/class1/interface/normaldebugF.glsl b/indra/newview/app_settings/shaders/class1/interface/normaldebugF.glsl
index 388042e7e0..2bfd45f3b0 100644
--- a/indra/newview/app_settings/shaders/class1/interface/normaldebugF.glsl
+++ b/indra/newview/app_settings/shaders/class1/interface/normaldebugF.glsl
@@ -1,24 +1,24 @@
-/**
+/**
* @file normaldebugF.glsl
*
* $LicenseInfo:firstyear=2023&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2023, 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$
*/
@@ -27,7 +27,7 @@ out vec4 frag_color;
in vec4 vertex_color;
-void main()
+void main()
{
- frag_color = max(vertex_color, vec4(0));
+ frag_color = max(vertex_color, vec4(0));
}
diff --git a/indra/newview/app_settings/shaders/class1/interface/normaldebugV.glsl b/indra/newview/app_settings/shaders/class1/interface/normaldebugV.glsl
index b198bc2485..ae726190c7 100644
--- a/indra/newview/app_settings/shaders/class1/interface/normaldebugV.glsl
+++ b/indra/newview/app_settings/shaders/class1/interface/normaldebugV.glsl
@@ -1,24 +1,24 @@
-/**
+/**
* @file normaldebugV.glsl
*
* $LicenseInfo:firstyear=2023&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2023, 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$
*/
@@ -65,10 +65,10 @@ void main()
vec4 world_pos = mat * vec4(position.xyz,1.0);
- gl_Position = projection_matrix * world_pos;
- normal_g = get_screen_normal(position.xyz, world_pos, normal.xyz, mat);
+ gl_Position = projection_matrix * world_pos;
+ normal_g = get_screen_normal(position.xyz, world_pos, normal.xyz, mat);
#ifdef HAS_ATTRIBUTE_TANGENT
- tangent_g = get_screen_normal(position.xyz, world_pos, tangent.xyz, mat);
+ tangent_g = get_screen_normal(position.xyz, world_pos, tangent.xyz, mat);
#endif
}
diff --git a/indra/newview/app_settings/shaders/class1/interface/radianceGenF.glsl b/indra/newview/app_settings/shaders/class1/interface/radianceGenF.glsl
index c1ed1bfe6e..feb0947649 100644
--- a/indra/newview/app_settings/shaders/class1/interface/radianceGenF.glsl
+++ b/indra/newview/app_settings/shaders/class1/interface/radianceGenF.glsl
@@ -1,28 +1,28 @@
-/**
+/**
* @file radianceGenF.glsl
*
* $LicenseInfo:firstyear=2022&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2022, 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$
*/
-
+
/*[EXTRA_CODE_HERE]*/
@@ -36,7 +36,7 @@ in vec3 vary_dir;
//uniform float roughness;
uniform float mipLevel;
-uniform int u_width;
+uniform int u_width;
uniform float max_probe_lod;
uniform float probe_strength;
@@ -74,96 +74,96 @@ const float PI = 3.1415926536;
// Based omn http://byteblacksmith.com/improvements-to-the-canonical-one-liner-glsl-rand-for-opengl-es-2-0/
float random(vec2 co)
{
- float a = 12.9898;
- float b = 78.233;
- float c = 43758.5453;
- float dt= dot(co.xy ,vec2(a,b));
- float sn= mod(dt,3.14);
- return fract(sin(sn) * c);
+ float a = 12.9898;
+ float b = 78.233;
+ float c = 43758.5453;
+ float dt= dot(co.xy ,vec2(a,b));
+ float sn= mod(dt,3.14);
+ return fract(sin(sn) * c);
}
-vec2 hammersley2d(uint i, uint N)
+vec2 hammersley2d(uint i, uint N)
{
- // Radical inverse based on http://holger.dammertz.org/stuff/notes_HammersleyOnHemisphere.html
- uint bits = (i << 16u) | (i >> 16u);
- bits = ((bits & 0x55555555u) << 1u) | ((bits & 0xAAAAAAAAu) >> 1u);
- bits = ((bits & 0x33333333u) << 2u) | ((bits & 0xCCCCCCCCu) >> 2u);
- bits = ((bits & 0x0F0F0F0Fu) << 4u) | ((bits & 0xF0F0F0F0u) >> 4u);
- bits = ((bits & 0x00FF00FFu) << 8u) | ((bits & 0xFF00FF00u) >> 8u);
- float rdi = float(bits) * 2.3283064365386963e-10;
- return vec2(float(i) /float(N), rdi);
+ // Radical inverse based on http://holger.dammertz.org/stuff/notes_HammersleyOnHemisphere.html
+ uint bits = (i << 16u) | (i >> 16u);
+ bits = ((bits & 0x55555555u) << 1u) | ((bits & 0xAAAAAAAAu) >> 1u);
+ bits = ((bits & 0x33333333u) << 2u) | ((bits & 0xCCCCCCCCu) >> 2u);
+ bits = ((bits & 0x0F0F0F0Fu) << 4u) | ((bits & 0xF0F0F0F0u) >> 4u);
+ bits = ((bits & 0x00FF00FFu) << 8u) | ((bits & 0xFF00FF00u) >> 8u);
+ float rdi = float(bits) * 2.3283064365386963e-10;
+ return vec2(float(i) /float(N), rdi);
}
// Based on http://blog.selfshadow.com/publications/s2013-shading-course/karis/s2013_pbs_epic_slides.pdf
-vec3 importanceSample_GGX(vec2 Xi, float roughness, vec3 normal)
+vec3 importanceSample_GGX(vec2 Xi, float roughness, vec3 normal)
{
- // Maps a 2D point to a hemisphere with spread based on roughness
- float alpha = roughness * roughness;
- float phi = 2.0 * PI * Xi.x + random(normal.xz) * 0.1;
- float cosTheta = sqrt((1.0 - Xi.y) / (1.0 + (alpha*alpha - 1.0) * Xi.y));
- float sinTheta = sqrt(1.0 - cosTheta * cosTheta);
- vec3 H = vec3(sinTheta * cos(phi), sinTheta * sin(phi), cosTheta);
-
- // Tangent space
- vec3 up = abs(normal.z) < 0.999 ? vec3(0.0, 0.0, 1.0) : vec3(1.0, 0.0, 0.0);
- vec3 tangentX = normalize(cross(up, normal));
- vec3 tangentY = normalize(cross(normal, tangentX));
-
- // Convert to world Space
- return normalize(tangentX * H.x + tangentY * H.y + normal * H.z);
+ // Maps a 2D point to a hemisphere with spread based on roughness
+ float alpha = roughness * roughness;
+ float phi = 2.0 * PI * Xi.x + random(normal.xz) * 0.1;
+ float cosTheta = sqrt((1.0 - Xi.y) / (1.0 + (alpha*alpha - 1.0) * Xi.y));
+ float sinTheta = sqrt(1.0 - cosTheta * cosTheta);
+ vec3 H = vec3(sinTheta * cos(phi), sinTheta * sin(phi), cosTheta);
+
+ // Tangent space
+ vec3 up = abs(normal.z) < 0.999 ? vec3(0.0, 0.0, 1.0) : vec3(1.0, 0.0, 0.0);
+ vec3 tangentX = normalize(cross(up, normal));
+ vec3 tangentY = normalize(cross(normal, tangentX));
+
+ // Convert to world Space
+ return normalize(tangentX * H.x + tangentY * H.y + normal * H.z);
}
// Normal Distribution function
float D_GGX(float dotNH, float roughness)
{
- float alpha = roughness * roughness;
- float alpha2 = alpha * alpha;
- float denom = dotNH * dotNH * (alpha2 - 1.0) + 1.0;
- return (alpha2)/(PI * denom*denom);
+ float alpha = roughness * roughness;
+ float alpha2 = alpha * alpha;
+ float denom = dotNH * dotNH * (alpha2 - 1.0) + 1.0;
+ return (alpha2)/(PI * denom*denom);
}
vec4 prefilterEnvMap(vec3 R)
{
- vec3 N = R;
- vec3 V = R;
- vec4 color = vec4(0.0);
- float totalWeight = 0.0;
- float envMapDim = float(textureSize(reflectionProbes, 0).s);
+ vec3 N = R;
+ vec3 V = R;
+ vec4 color = vec4(0.0);
+ float totalWeight = 0.0;
+ float envMapDim = float(textureSize(reflectionProbes, 0).s);
float roughness = mipLevel/max_probe_lod;
int numSamples = max(int(PROBE_FILTER_SAMPLES*roughness), 1);
float numMips = max_probe_lod+1;
- for(uint i = 0u; i < numSamples; i++) {
- vec2 Xi = hammersley2d(i, numSamples);
- vec3 H = importanceSample_GGX(Xi, roughness, N);
- vec3 L = 2.0 * dot(V, H) * H - V;
- float dotNL = clamp(dot(N, L), 0.0, 1.0);
- if(dotNL > 0.0) {
- // Filtering based on https://placeholderart.wordpress.com/2015/07/28/implementation-notes-runtime-environment-map-filtering-for-image-based-lighting/
-
- float dotNH = clamp(dot(N, H), 0.0, 1.0);
- float dotVH = clamp(dot(V, H), 0.0, 1.0);
-
- // Probability Distribution Function
- float pdf = D_GGX(dotNH, roughness) * dotNH / (4.0 * dotVH) + 0.0001;
- // Slid angle of current smple
- float omegaS = 1.0 / (float(numSamples) * pdf);
- // Solid angle of 1 pixel across all cube faces
- float omegaP = 4.0 * PI / (6.0 * envMapDim * envMapDim);
- // Biased (+1.0) mip level for better result
- float mipLevel = roughness == 0.0 ? 0.0 : clamp(0.5 * log2(omegaS / omegaP) + 1.0, 0.0f, max_probe_lod);
- color += textureLod(reflectionProbes, vec4(L, sourceIdx), mipLevel) * dotNL;
- totalWeight += dotNL;
- }
- }
- return (color / totalWeight);
+ for(uint i = 0u; i < numSamples; i++) {
+ vec2 Xi = hammersley2d(i, numSamples);
+ vec3 H = importanceSample_GGX(Xi, roughness, N);
+ vec3 L = 2.0 * dot(V, H) * H - V;
+ float dotNL = clamp(dot(N, L), 0.0, 1.0);
+ if(dotNL > 0.0) {
+ // Filtering based on https://placeholderart.wordpress.com/2015/07/28/implementation-notes-runtime-environment-map-filtering-for-image-based-lighting/
+
+ float dotNH = clamp(dot(N, H), 0.0, 1.0);
+ float dotVH = clamp(dot(V, H), 0.0, 1.0);
+
+ // Probability Distribution Function
+ float pdf = D_GGX(dotNH, roughness) * dotNH / (4.0 * dotVH) + 0.0001;
+ // Slid angle of current smple
+ float omegaS = 1.0 / (float(numSamples) * pdf);
+ // Solid angle of 1 pixel across all cube faces
+ float omegaP = 4.0 * PI / (6.0 * envMapDim * envMapDim);
+ // Biased (+1.0) mip level for better result
+ float mipLevel = roughness == 0.0 ? 0.0 : clamp(0.5 * log2(omegaS / omegaP) + 1.0, 0.0f, max_probe_lod);
+ color += textureLod(reflectionProbes, vec4(L, sourceIdx), mipLevel) * dotNL;
+ totalWeight += dotNL;
+ }
+ }
+ return (color / totalWeight);
}
void main()
-{
- vec3 N = normalize(vary_dir);
- frag_color = max(prefilterEnvMap(N), vec4(0));
+{
+ vec3 N = normalize(vary_dir);
+ frag_color = max(prefilterEnvMap(N), vec4(0));
frag_color.a *= probe_strength;
}
// =============================================================================================================
diff --git a/indra/newview/app_settings/shaders/class1/objects/bumpF.glsl b/indra/newview/app_settings/shaders/class1/objects/bumpF.glsl
index 142f2a5d71..09a505d69d 100644
--- a/indra/newview/app_settings/shaders/class1/objects/bumpF.glsl
+++ b/indra/newview/app_settings/shaders/class1/objects/bumpF.glsl
@@ -1,24 +1,24 @@
-/**
+/**
* @file bumpF.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$
*/
@@ -34,11 +34,11 @@ in vec3 vary_position;
void mirrorClip(vec3 pos);
-void main()
+void main()
{
mirrorClip(vary_position);
- float tex0 = texture(texture0, vary_texcoord0.xy).a;
- float tex1 = texture(texture1, vary_texcoord1.xy).a;
+ float tex0 = texture(texture0, vary_texcoord0.xy).a;
+ float tex1 = texture(texture1, vary_texcoord1.xy).a;
- frag_color = max(vec4(tex0+(1.0-tex1)-0.5), vec4(0));
+ frag_color = max(vec4(tex0+(1.0-tex1)-0.5), vec4(0));
}
diff --git a/indra/newview/app_settings/shaders/class1/objects/bumpV.glsl b/indra/newview/app_settings/shaders/class1/objects/bumpV.glsl
index b8a02fbdec..95cdfb6fae 100644
--- a/indra/newview/app_settings/shaders/class1/objects/bumpV.glsl
+++ b/indra/newview/app_settings/shaders/class1/objects/bumpV.glsl
@@ -1,24 +1,24 @@
-/**
+/**
* @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$
*/
@@ -42,7 +42,7 @@ uniform mat4 projection_matrix;
void main()
{
- //transform vertex
+ //transform vertex
#ifdef HAS_SKIN
mat4 mat = getObjectSkinnedTransform();
mat = modelview_matrix * mat;
@@ -51,8 +51,8 @@ void main()
gl_Position = projection_matrix * pos;
#else
vary_position = (modelview_matrix * vec4(position.xyz, 1.0)).xyz;
- gl_Position = modelview_projection_matrix*vec4(position.xyz, 1.0);
+ gl_Position = modelview_projection_matrix*vec4(position.xyz, 1.0);
#endif
- vary_texcoord0 = (texture_matrix0 * vec4(texcoord0,0,1)).xy;
- vary_texcoord1 = (texture_matrix0 * vec4(texcoord1,0,1)).xy;
+ vary_texcoord0 = (texture_matrix0 * vec4(texcoord0,0,1)).xy;
+ vary_texcoord1 = (texture_matrix0 * vec4(texcoord1,0,1)).xy;
}
diff --git a/indra/newview/app_settings/shaders/class2/deferred/alphaF.glsl b/indra/newview/app_settings/shaders/class2/deferred/alphaF.glsl
index 7a1a54a77a..210ecce8db 100644
--- a/indra/newview/app_settings/shaders/class2/deferred/alphaF.glsl
+++ b/indra/newview/app_settings/shaders/class2/deferred/alphaF.glsl
@@ -1,24 +1,24 @@
-/**
+/**
* @file alphaF.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$
*/
@@ -60,7 +60,7 @@ uniform vec2 screen_res;
uniform int sun_up_factor;
uniform vec4 light_position[8];
uniform vec3 light_direction[8];
-uniform vec4 light_attenuation[8];
+uniform vec4 light_attenuation[8];
uniform vec3 light_diffuse[8];
void waterClip(vec3 pos);
@@ -91,15 +91,15 @@ vec3 calcPointLightOrSpotLight(vec3 light_col, vec3 diffuse, vec3 v, vec3 n, vec
float falloff_factor = (12.0 * fa) - 9.0;
float inverted_la = falloff_factor / la;
// Yes, it makes me want to cry as well. DJH
-
+
vec3 col = vec3(0);
- //get light vector
- vec3 lv = lp.xyz-v;
+ //get light vector
+ vec3 lv = lp.xyz-v;
- //get distance
- float dist = length(lv);
- float da = 1.0;
+ //get distance
+ float dist = length(lv);
+ float da = 1.0;
/*if (dist > inverted_la)
{
@@ -112,23 +112,23 @@ vec3 calcPointLightOrSpotLight(vec3 light_col, vec3 diffuse, vec3 v, vec3 n, vec
if (proj_tc.z < 0
|| proj_tc.z > 1
|| proj_tc.x < 0
- || proj_tc.x > 1
+ || proj_tc.x > 1
|| proj_tc.y < 0
|| proj_tc.y > 1)
{
return col;
}*/
- if (dist > 0.0 && inverted_la > 0.0)
- {
+ if (dist > 0.0 && inverted_la > 0.0)
+ {
dist /= inverted_la;
- //normalize light vector
- lv = normalize(lv);
-
- //distance attenuation
- float dist_atten = clamp(1.0-(dist-1.0*(1.0-fa))/fa, 0.0, 1.0);
- dist_atten *= dist_atten;
+ //normalize light vector
+ lv = normalize(lv);
+
+ //distance attenuation
+ float dist_atten = clamp(1.0-(dist-1.0*(1.0-fa))/fa, 0.0, 1.0);
+ dist_atten *= dist_atten;
dist_atten *= 2.0f;
if (dist_atten <= 0.0)
@@ -136,20 +136,20 @@ vec3 calcPointLightOrSpotLight(vec3 light_col, vec3 diffuse, vec3 v, vec3 n, vec
return col;
}
- // spotlight coefficient.
- float spot = max(dot(-ln, lv), is_pointlight);
- da *= spot*spot; // GL_SPOT_EXPONENT=2
+ // spotlight coefficient.
+ float spot = max(dot(-ln, lv), is_pointlight);
+ da *= spot*spot; // GL_SPOT_EXPONENT=2
- //angular attenuation
- da *= dot(n, lv);
+ //angular attenuation
+ da *= dot(n, lv);
da = max(0.0, da);
- float lit = 0.0f;
+ float lit = 0.0f;
float amb_da = 0.0;//ambiance;
if (da > 0)
{
- lit = max(da * dist_atten,0.0);
+ lit = max(da * dist_atten,0.0);
col = lit * light_col * diffuse;
amb_da += (da*0.5+0.5) * ambiance;
}
@@ -166,12 +166,12 @@ vec3 calcPointLightOrSpotLight(vec3 light_col, vec3 diffuse, vec3 v, vec3 n, vec
return col;
}
-void main()
+void main()
{
mirrorClip(vary_position);
vec2 frag = vary_fragcoord.xy/vary_fragcoord.z*0.5+0.5;
-
+
vec4 pos = vec4(vary_position, 1.0);
#ifndef IS_AVATAR_SKIN
// clip against water plane unless this is a legacy avatar skin
@@ -202,7 +202,7 @@ void main()
float final_alpha = diffuse_srgb.a * vertex_color.a;
diffuse_srgb.rgb *= vertex_color.rgb;
-
+
// Insure we don't pollute depth with invis pixels in impostor rendering
//
if (final_alpha < minimum_alpha)
@@ -225,7 +225,7 @@ void main()
final_alpha *= vertex_color.a;
if (final_alpha < minimum_alpha)
- { // TODO: figure out how to get invisible faces out of
+ { // TODO: figure out how to get invisible faces out of
// render batches without breaking glow
discard;
}
@@ -248,11 +248,11 @@ void main()
vec3 glossenv;
vec3 legacyenv;
sampleReflectionProbesLegacy(irradiance, glossenv, legacyenv, frag, pos.xyz, norm.xyz, 0.0, 0.0, true, amblit_linear);
-
+
float da = dot(norm.xyz, light_dir.xyz);
da = clamp(da, -1.0, 1.0);
-
+
float final_da = da;
final_da = clamp(final_da, 0.0f, 1.0f);
@@ -269,7 +269,7 @@ void main()
color.rgb *= diffuse_linear.rgb;
vec4 light = vec4(0,0,0,0);
-
+
#define LIGHT_LOOP(i) light.rgb += calcPointLightOrSpotLight(light_diffuse[i].rgb, diffuse_linear.rgb, pos.xyz, norm, light_position[i], light_direction[i].xyz, light_attenuation[i].x, light_attenuation[i].y, light_attenuation[i].z, light_attenuation[i].w);
LIGHT_LOOP(1)
diff --git a/indra/newview/app_settings/shaders/class3/deferred/fullbrightShinyF.glsl b/indra/newview/app_settings/shaders/class3/deferred/fullbrightShinyF.glsl
index c382a9fbc0..03dc3d7113 100644
--- a/indra/newview/app_settings/shaders/class3/deferred/fullbrightShinyF.glsl
+++ b/indra/newview/app_settings/shaders/class3/deferred/fullbrightShinyF.glsl
@@ -1,28 +1,28 @@
-/**
+/**
* @file fullbrightShinyF.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$
*/
-
+
/*[EXTRA_CODE_HERE]*/
out vec4 frag_color;
@@ -59,16 +59,16 @@ void main()
{
mirrorClip(vary_position);
#ifdef HAS_DIFFUSE_LOOKUP
- vec4 color = diffuseLookup(vary_texcoord0.xy);
+ vec4 color = diffuseLookup(vary_texcoord0.xy);
#else
- vec4 color = texture(diffuseMap, vary_texcoord0.xy);
+ vec4 color = texture(diffuseMap, vary_texcoord0.xy);
#endif
-
- color.rgb *= vertex_color.rgb;
- // SL-9632 HUDs are affected by Atmosphere
+ color.rgb *= vertex_color.rgb;
+
+ // SL-9632 HUDs are affected by Atmosphere
#ifndef IS_HUD
-
+
vec3 sunlit;
vec3 amblit;
vec3 additive;
@@ -90,8 +90,8 @@ void main()
applyLegacyEnv(color.rgb, legacyenv, spec, pos, norm, env_intensity);
#endif
- color.a = 1.0;
+ color.a = 1.0;
- frag_color = max(color, vec4(0));
+ frag_color = max(color, vec4(0));
}
diff --git a/indra/newview/app_settings/shaders/class3/deferred/materialF.glsl b/indra/newview/app_settings/shaders/class3/deferred/materialF.glsl
index 2a20eb79d2..d3e19cf4a8 100644
--- a/indra/newview/app_settings/shaders/class3/deferred/materialF.glsl
+++ b/indra/newview/app_settings/shaders/class3/deferred/materialF.glsl
@@ -100,7 +100,7 @@ vec3 calcPointLightOrSpotLight(vec3 light_col, vec3 npos, vec3 diffuse, vec4 spe
float falloff_factor = (12.0 * fa) - 9.0;
float inverted_la = falloff_factor / la;
// Yes, it makes me want to cry as well. DJH
-
+
vec3 col = vec3(0);
//get light vector
@@ -220,19 +220,19 @@ in vec2 vary_texcoord0;
vec3 getNormal(inout float glossiness)
{
#ifdef HAS_NORMAL_MAP
- vec4 vNt = texture(bumpMap, vary_texcoord1.xy);
+ vec4 vNt = texture(bumpMap, vary_texcoord1.xy);
glossiness *= vNt.a;
- vNt.xyz = vNt.xyz * 2 - 1;
+ vNt.xyz = vNt.xyz * 2 - 1;
float sign = vary_sign;
vec3 vN = vary_normal;
vec3 vT = vary_tangent.xyz;
-
+
vec3 vB = sign * cross(vN, vT);
vec3 tnorm = normalize( vNt.x * vT + vNt.y * vB + vNt.z * vN );
- return tnorm;
+ return tnorm;
#else
- return normalize(vary_normal);
+ return normalize(vary_normal);
#endif
}
@@ -269,9 +269,9 @@ void waterClip()
float getEmissive(vec4 diffcol)
{
#if (DIFFUSE_ALPHA_MODE != DIFFUSE_ALPHA_MODE_EMISSIVE)
- return emissive_brightness;
+ return emissive_brightness;
#else
- return max(diffcol.a, emissive_brightness);
+ return max(diffcol.a, emissive_brightness);
#endif
}
@@ -295,7 +295,7 @@ void main()
// diffcol == diffuse map combined with vertex color
vec4 diffcol = texture(diffuseMap, vary_texcoord0.xy);
- diffcol.rgb *= vertex_color.rgb;
+ diffcol.rgb *= vertex_color.rgb;
alphaMask(diffcol.a);
// spec == specular map combined with specular color
@@ -328,7 +328,7 @@ void main()
vec3 additive;
vec3 atten;
calcAtmosphericVarsLinear(pos.xyz, norm.xyz, light_dir, sunlit, amblit, additive, atten);
-
+
vec3 sunlit_linear = srgb_to_linear(sunlit);
vec3 amblit_linear = amblit;
@@ -336,7 +336,7 @@ void main()
vec3 glossenv;
vec3 legacyenv;
sampleReflectionProbesLegacy(ambenv, glossenv, legacyenv, pos.xy*0.5+0.5, pos.xyz, norm.xyz, glossiness, env, true, amblit_linear);
-
+
color = ambenv;
float da = clamp(dot(norm.xyz, light_dir.xyz), 0.0, 1.0);
@@ -408,7 +408,7 @@ void main()
frag_color = max(vec4(color, al), vec4(0));
-#else // mode is not DIFFUSE_ALPHA_MODE_BLEND, encode to gbuffer
+#else // mode is not DIFFUSE_ALPHA_MODE_BLEND, encode to gbuffer
// deferred path // See: C++: addDeferredAttachment(), shader: softenLightF.glsl
float flag = GBUFFER_FLAG_HAS_ATMOS;
diff --git a/indra/newview/app_settings/shaders/class3/environment/underWaterF.glsl b/indra/newview/app_settings/shaders/class3/environment/underWaterF.glsl
index ef086fc3be..728d70ebb2 100644
--- a/indra/newview/app_settings/shaders/class3/environment/underWaterF.glsl
+++ b/indra/newview/app_settings/shaders/class3/environment/underWaterF.glsl
@@ -4,25 +4,25 @@
* $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$
*/
-
+
out vec4 frag_color;
uniform sampler2D diffuseMap;
@@ -57,27 +57,27 @@ in vec3 vary_position;
vec4 applyWaterFogViewLinearNoClip(vec3 pos, vec4 color);
void mirrorClip(vec3 position);
-void main()
+void main()
{
- mirrorClip(vary_position);
- vec4 color;
+ mirrorClip(vary_position);
+ vec4 color;
//get detail normals
- vec3 wave1 = texture(bumpMap, vec2(refCoord.w, view.w)).xyz*2.0-1.0;
- vec3 wave2 = texture(bumpMap, littleWave.xy).xyz*2.0-1.0;
- vec3 wave3 = texture(bumpMap, littleWave.zw).xyz*2.0-1.0;
- vec3 wavef = normalize(wave1+wave2+wave3);
-
- //figure out distortion vector (ripply)
- vec2 distort = (refCoord.xy/refCoord.z) * 0.5 + 0.5;
- distort = distort+wavef.xy*refScale;
+ vec3 wave1 = texture(bumpMap, vec2(refCoord.w, view.w)).xyz*2.0-1.0;
+ vec3 wave2 = texture(bumpMap, littleWave.xy).xyz*2.0-1.0;
+ vec3 wave3 = texture(bumpMap, littleWave.zw).xyz*2.0-1.0;
+ vec3 wavef = normalize(wave1+wave2+wave3);
+
+ //figure out distortion vector (ripply)
+ vec2 distort = (refCoord.xy/refCoord.z) * 0.5 + 0.5;
+ distort = distort+wavef.xy*refScale;
#ifdef TRANSPARENT_WATER
- vec4 fb = texture(screenTex, distort);
+ vec4 fb = texture(screenTex, distort);
#else
vec4 fb = vec4(waterFogColorLinear, 0.0);
#endif
-
+
fb = applyWaterFogViewLinearNoClip(vary_position, fb);
frag_color = max(fb, vec4(0));
diff --git a/indra/newview/app_settings/shaders/class3/environment/waterF.glsl b/indra/newview/app_settings/shaders/class3/environment/waterF.glsl
index b2a81aa025..a5592188a9 100644
--- a/indra/newview/app_settings/shaders/class3/environment/waterF.glsl
+++ b/indra/newview/app_settings/shaders/class3/environment/waterF.glsl
@@ -1,28 +1,28 @@
-/**
+/**
* @file waterF.glsl
*
* $LicenseInfo:firstyear=2022&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2022, 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$
*/
-
+
// class3/environment/waterF.glsl
out vec4 frag_color;
@@ -129,7 +129,7 @@ void sampleReflectionProbesWater(inout vec3 ambenv, inout vec3 glossenv,
vec3 getPositionWithNDC(vec3 ndc);
-void main()
+void main()
{
mirrorClip(vary_position);
vN = vary_normal;
@@ -160,7 +160,7 @@ void main()
vec3 wave3 = BlendNormal(wave3_a, wave3_b);
vec2 distort = (refCoord.xy/refCoord.z) * 0.5 + 0.5;
-
+
//wave1 = transform_normal(wave1);
//wave2 = transform_normal(wave2);
//wave3 = transform_normal(wave3);
@@ -171,7 +171,7 @@ void main()
vec3 up = transform_normal(vec3(0,0,1));
float vdu = -dot(viewVec, up)*2;
-
+
vec3 wave_ibl = wavef;
wave_ibl.z *= 2.0;
wave_ibl = transform_normal(normalize(wave_ibl));
@@ -185,13 +185,13 @@ void main()
//wavef = vec3(0, 0, 1);
wavef = transform_normal(wavef);
-
- float dist2 = dist;
- dist = max(dist, 5.0);
-
- float dmod = sqrt(dist);
-
- //figure out distortion vector (ripply)
+
+ float dist2 = dist;
+ dist = max(dist, 5.0);
+
+ float dmod = sqrt(dist);
+
+ //figure out distortion vector (ripply)
vec2 distort2 = distort + waver.xy * refScale / max(dmod, 1.0);
distort2 = clamp(distort2, vec2(0), vec2(0.999));
@@ -235,7 +235,7 @@ void main()
float metallic = 0.0;
float perceptualRoughness = 0.05;
float gloss = 1.0 - perceptualRoughness;
-
+
vec3 irradiance = vec3(0);
vec3 radiance = vec3(0);
sampleReflectionProbesWater(irradiance, radiance, distort2, pos.xyz, wave_ibl.xyz, gloss, amblit);
@@ -251,7 +251,7 @@ void main()
vec3 colorEmissive = vec3(0);
float ao = 1.0;
vec3 light_dir = transform_normal(lightDir);
-
+
perceptualRoughness = 0.0;
metallic = 1.0;
@@ -284,7 +284,7 @@ void main()
color = ((1.0 - f) * color) + fb.rgb;
float spec = min(max(max(punctual.r, punctual.g), punctual.b), 0.05);
-
+
frag_color = max(vec4(color, spec), vec4(0));
}