Drop emissive on old Intel GPUs (#3110)
* #3103 Add the ability to disable the emissive buffer for older GPUs with low memory bandwidth. * #3135 Add a "vintage" mode for slower GPUs * #2719 Fix for skies being overbrightened * #2632 Do not apply tonemapping on legacy skiesmaster
parent
7ef6e8fce7
commit
d65fb7cec8
|
|
@ -601,7 +601,7 @@ void LLSettingsSky::blend(LLSettingsBase::ptr_t &end, F64 blendf)
|
|||
|
||||
mSettingFlags |= other->mSettingFlags;
|
||||
|
||||
mCanAutoAdjust = false; // no point?
|
||||
mCanAutoAdjust = other->mCanAutoAdjust;
|
||||
|
||||
mSunRotation = slerp((F32)blendf, mSunRotation, other->mSunRotation);
|
||||
mMoonRotation = slerp((F32)blendf, mMoonRotation, other->mMoonRotation);
|
||||
|
|
@ -1177,6 +1177,11 @@ void LLSettingsSky::loadValuesFromLLSD()
|
|||
mReflectionProbeAmbiance = (F32)settings[SETTING_REFLECTION_PROBE_AMBIANCE].asReal();
|
||||
}
|
||||
|
||||
mHDRMax = 2.0f;
|
||||
mHDRMin = 0.5f;
|
||||
mHDROffset = 1.0f;
|
||||
mTonemapMix = 1.0f;
|
||||
|
||||
mSunTextureId = settings[SETTING_SUN_TEXTUREID].asUUID();
|
||||
mMoonTextureId = settings[SETTING_MOON_TEXTUREID].asUUID();
|
||||
mCloudTextureId = settings[SETTING_CLOUD_TEXTUREID].asUUID();
|
||||
|
|
@ -2027,6 +2032,38 @@ F32 LLSettingsSky::getGamma() const
|
|||
return mGamma;
|
||||
}
|
||||
|
||||
F32 LLSettingsSky::getHDRMin() const
|
||||
{
|
||||
if (mCanAutoAdjust)
|
||||
return 0.f;
|
||||
|
||||
return mHDRMin;
|
||||
}
|
||||
|
||||
F32 LLSettingsSky::getHDRMax() const
|
||||
{
|
||||
if (mCanAutoAdjust)
|
||||
return 0.f;
|
||||
|
||||
return mHDRMax;
|
||||
}
|
||||
|
||||
F32 LLSettingsSky::getHDROffset() const
|
||||
{
|
||||
if (mCanAutoAdjust)
|
||||
return 1.0f;
|
||||
|
||||
return mHDROffset;
|
||||
}
|
||||
|
||||
F32 LLSettingsSky::getTonemapMix() const
|
||||
{
|
||||
if (mCanAutoAdjust)
|
||||
return 0.0f;
|
||||
|
||||
return mTonemapMix;
|
||||
}
|
||||
|
||||
void LLSettingsSky::setGamma(F32 val)
|
||||
{
|
||||
mGamma = val;
|
||||
|
|
|
|||
|
|
@ -209,6 +209,11 @@ public:
|
|||
|
||||
F32 getGamma() const;
|
||||
|
||||
F32 getHDRMin() const;
|
||||
F32 getHDRMax() const;
|
||||
F32 getHDROffset() const;
|
||||
F32 getTonemapMix() const;
|
||||
|
||||
void setGamma(F32 val);
|
||||
|
||||
LLColor3 getGlow() const;
|
||||
|
|
@ -380,6 +385,10 @@ protected:
|
|||
F32 mCloudVariance;
|
||||
F32 mCloudShadow;
|
||||
F32 mCloudScale;
|
||||
F32 mTonemapMix;
|
||||
F32 mHDROffset;
|
||||
F32 mHDRMax;
|
||||
F32 mHDRMin;
|
||||
LLVector2 mScrollRate;
|
||||
LLColor3 mCloudPosDensity1;
|
||||
LLColor3 mCloudPosDensity2;
|
||||
|
|
|
|||
|
|
@ -1866,6 +1866,23 @@ void LLGLSLShader::uniform3f(const LLStaticHashedString& uniform, GLfloat x, GLf
|
|||
}
|
||||
}
|
||||
|
||||
void LLGLSLShader::uniform4f(const LLStaticHashedString& uniform, GLfloat x, GLfloat y, GLfloat z, GLfloat w)
|
||||
{
|
||||
LL_PROFILE_ZONE_SCOPED_CATEGORY_SHADER;
|
||||
GLint location = getUniformLocation(uniform);
|
||||
|
||||
if (location >= 0)
|
||||
{
|
||||
const auto& iter = mValue.find(location);
|
||||
LLVector4 vec(x, y, z, w);
|
||||
if (iter == mValue.end() || shouldChange(iter->second, vec))
|
||||
{
|
||||
glUniform4f(location, x, y, z, w);
|
||||
mValue[location] = vec;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void LLGLSLShader::uniform1fv(const LLStaticHashedString& uniform, U32 count, const GLfloat* v)
|
||||
{
|
||||
LL_PROFILE_ZONE_SCOPED_CATEGORY_SHADER;
|
||||
|
|
|
|||
|
|
@ -52,6 +52,7 @@ public:
|
|||
bool hasAmbientOcclusion = false;
|
||||
bool hasSrgb = false;
|
||||
bool isDeferred = false;
|
||||
bool hasFullGBuffer = false;
|
||||
bool hasScreenSpaceReflections = false;
|
||||
bool hasAlphaMask = false;
|
||||
bool hasReflectionProbes = false;
|
||||
|
|
@ -221,6 +222,7 @@ public:
|
|||
void uniform1f(const LLStaticHashedString& uniform, GLfloat v);
|
||||
void uniform2f(const LLStaticHashedString& uniform, GLfloat x, GLfloat y);
|
||||
void uniform3f(const LLStaticHashedString& uniform, GLfloat x, GLfloat y, GLfloat z);
|
||||
void uniform4f(const LLStaticHashedString& uniform, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
|
||||
void uniform1fv(const LLStaticHashedString& uniform, U32 count, const GLfloat* v);
|
||||
void uniform2fv(const LLStaticHashedString& uniform, U32 count, const GLfloat* v);
|
||||
void uniform3fv(const LLStaticHashedString& uniform, U32 count, const GLfloat* v);
|
||||
|
|
|
|||
|
|
@ -259,8 +259,8 @@ void LLImageGL::initClass(LLWindow* window, S32 num_catagories, bool skip_analyz
|
|||
if (thread_texture_loads || thread_media_updates)
|
||||
{
|
||||
LLImageGLThread::createInstance(window);
|
||||
LLImageGLThread::sEnabledTextures = thread_texture_loads;
|
||||
LLImageGLThread::sEnabledMedia = thread_media_updates;
|
||||
LLImageGLThread::sEnabledTextures = gGLManager.mGLVersion > 3.95f ? thread_texture_loads : false;
|
||||
LLImageGLThread::sEnabledMedia = gGLManager.mGLVersion > 3.95f ? thread_media_updates : false;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -332,6 +332,7 @@ S32 LLImageGL::dataFormatBits(S32 dataformat)
|
|||
case GL_RGB8: return 24;
|
||||
case GL_RGBA: return 32;
|
||||
case GL_RGBA8: return 32;
|
||||
case GL_RGB10_A2: return 32;
|
||||
case GL_SRGB_ALPHA: return 32;
|
||||
case GL_BGRA: return 32; // Used for QuickTime media textures on the Mac
|
||||
case GL_DEPTH_COMPONENT: return 24;
|
||||
|
|
|
|||
|
|
@ -223,6 +223,14 @@ bool LLShaderMgr::attachShaderFeatures(LLGLSLShader * shader)
|
|||
}
|
||||
}
|
||||
|
||||
if (features->hasFullGBuffer)
|
||||
{
|
||||
if (!shader->attachFragmentObject("deferred/gbufferUtil.glsl"))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (features->hasScreenSpaceReflections || features->hasReflectionProbes)
|
||||
{
|
||||
if (!shader->attachFragmentObject("deferred/screenSpaceReflUtil.glsl"))
|
||||
|
|
@ -606,7 +614,7 @@ GLuint LLShaderMgr::loadShaderFile(const std::string& filename, S32 & shader_lev
|
|||
extra_code_text[extra_code_count++] = strdup("#define GBUFFER_FLAG_HAS_ATMOS 0.34\n"); // bit 0
|
||||
extra_code_text[extra_code_count++] = strdup("#define GBUFFER_FLAG_HAS_PBR 0.67\n"); // bit 1
|
||||
extra_code_text[extra_code_count++] = strdup("#define GBUFFER_FLAG_HAS_HDRI 1.0\n"); // bit 2
|
||||
extra_code_text[extra_code_count++] = strdup("#define GET_GBUFFER_FLAG(flag) (abs(norm.w-flag)< 0.1)\n");
|
||||
extra_code_text[extra_code_count++] = strdup("#define GET_GBUFFER_FLAG(data, flag) (abs(data-flag)< 0.1)\n");
|
||||
|
||||
if (defines)
|
||||
{
|
||||
|
|
@ -717,6 +725,9 @@ GLuint LLShaderMgr::loadShaderFile(const std::string& filename, S32 & shader_lev
|
|||
}
|
||||
}
|
||||
|
||||
// Master definition can be found in deferredUtil.glsl
|
||||
extra_code_text[extra_code_count++] = strdup("struct GBufferInfo { vec4 albedo; vec4 specular; vec3 normal; vec4 emissive; float gbufferFlag; float envIntensity; };\n");
|
||||
|
||||
//copy file into memory
|
||||
enum {
|
||||
flag_write_to_out_of_extra_block_area = 0x01
|
||||
|
|
@ -1249,6 +1260,7 @@ void LLShaderMgr::initAttribsAndUniforms()
|
|||
mReservedUniforms.push_back("sky_hdr_scale");
|
||||
mReservedUniforms.push_back("sky_sunlight_scale");
|
||||
mReservedUniforms.push_back("sky_ambient_scale");
|
||||
mReservedUniforms.push_back("classic_mode");
|
||||
mReservedUniforms.push_back("blue_horizon");
|
||||
mReservedUniforms.push_back("blue_density");
|
||||
mReservedUniforms.push_back("haze_horizon");
|
||||
|
|
|
|||
|
|
@ -121,6 +121,7 @@ public:
|
|||
SKY_HDR_SCALE, // "sky_hdr_scale"
|
||||
SKY_SUNLIGHT_SCALE, // "sky_sunlight_scale"
|
||||
SKY_AMBIENT_SCALE, // "sky_ambient_scale"
|
||||
CLASSIC_MODE, // "classic_mode"
|
||||
BLUE_HORIZON, // "blue_horizon"
|
||||
BLUE_DENSITY, // "blue_density"
|
||||
HAZE_HORIZON, // "haze_horizon"
|
||||
|
|
|
|||
|
|
@ -7717,6 +7717,17 @@
|
|||
<key>Value</key>
|
||||
<integer>0</integer>
|
||||
</map>
|
||||
<key>RenderEnableEmissiveBuffer</key>
|
||||
<map>
|
||||
<key>Comment</key>
|
||||
<string>Enable emissive buffer in gbuffer. Should only be disabled in GL3 mode.</string>
|
||||
<key>Persist</key>
|
||||
<integer>1</integer>
|
||||
<key>Type</key>
|
||||
<string>Boolean</string>
|
||||
<key>Value</key>
|
||||
<integer>1</integer>
|
||||
</map>
|
||||
<key>RenderHDRIExposure</key>
|
||||
<map>
|
||||
<key>Comment</key>
|
||||
|
|
@ -7764,7 +7775,7 @@
|
|||
<key>RenderMaxOpenGLVersion</key>
|
||||
<map>
|
||||
<key>Comment</key>
|
||||
<string>Maximum OpenGL version to attempt use (minimum 3.2 maximum 4.6). Requires restart.</string>
|
||||
<string>Maximum OpenGL version to attempt use (minimum 3.1 maximum 4.6). Requires restart.</string>
|
||||
<key>Persist</key>
|
||||
<integer>1</integer>
|
||||
<key>Type</key>
|
||||
|
|
@ -9234,14 +9245,25 @@
|
|||
<key>RenderSkySunlightScale</key>
|
||||
<map>
|
||||
<key>Comment</key>
|
||||
<string>Sunlight scale fudge factor for matching with pre-PBR viewer</string>
|
||||
<string>Sunlight scale fudge factor for matching with pre-PBR viewer when HDR is disabled</string>
|
||||
<key>Persist</key>
|
||||
<integer>1</integer>
|
||||
<integer>0</integer>
|
||||
<key>Type</key>
|
||||
<string>F32</string>
|
||||
<key>Value</key>
|
||||
<real>1.0</real>
|
||||
</map>
|
||||
<key>RenderHDRSkySunlightScale</key>
|
||||
<map>
|
||||
<key>Comment</key>
|
||||
<string>Sunlight scale fudge factor for matching with pre-PBR viewer when HDR is enabled</string>
|
||||
<key>Persist</key>
|
||||
<integer>0</integer>
|
||||
<key>Type</key>
|
||||
<string>F32</string>
|
||||
<key>Value</key>
|
||||
<real>1.0</real>
|
||||
</map>
|
||||
<key>RenderSkyAmbientScale</key>
|
||||
<map>
|
||||
<key>Comment</key>
|
||||
|
|
@ -9251,7 +9273,7 @@
|
|||
<key>Type</key>
|
||||
<string>F32</string>
|
||||
<key>Value</key>
|
||||
<real>0.7</real>
|
||||
<real>1.0</real>
|
||||
</map>
|
||||
|
||||
<key>RenderReflectionProbeMaxLocalLightAmbiance</key>
|
||||
|
|
@ -16049,5 +16071,16 @@
|
|||
<key>Value</key>
|
||||
<integer>1</integer>
|
||||
</map>
|
||||
<key>RenderVintageMode</key>
|
||||
<map>
|
||||
<key>Comment</key>
|
||||
<string>Disable different rendering pipeline features to improve performance on older machines that makes the world look closer to how it used to prior to V7.</string>
|
||||
<key>Persist</key>
|
||||
<integer>1</integer>
|
||||
<key>Type</key>
|
||||
<string>Boolean</string>
|
||||
<key>Value</key>
|
||||
<integer>0</integer>
|
||||
</map>
|
||||
</map>
|
||||
</llsd>
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ in vec2 vary_texcoord0;
|
|||
in vec3 vary_position;
|
||||
|
||||
void mirrorClip(vec3 pos);
|
||||
vec4 encodeNormal(vec3 norm, float gbuffer_flag);
|
||||
vec4 encodeNormal(vec3 n, float env, float gbuffer_flag);
|
||||
|
||||
void main()
|
||||
{
|
||||
|
|
@ -52,7 +52,10 @@ void main()
|
|||
frag_data[0] = vec4(diff.rgb, 0.0);
|
||||
frag_data[1] = vec4(0,0,0,0);
|
||||
vec3 nvn = normalize(vary_normal);
|
||||
frag_data[2] = encodeNormal(nvn.xyz, GBUFFER_FLAG_HAS_ATMOS);
|
||||
frag_data[2] = encodeNormal(nvn.xyz, 0, GBUFFER_FLAG_HAS_ATMOS);
|
||||
|
||||
#if defined(HAS_EMISSIVE)
|
||||
frag_data[3] = vec4(0);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ in vec2 vary_texcoord0;
|
|||
in vec3 vary_position;
|
||||
|
||||
void mirrorClip(vec3 pos);
|
||||
vec4 encodeNormal(vec3 norm, float gbuffer_flag);
|
||||
vec4 encodeNormal(vec3 n, float env, float gbuffer_flag);
|
||||
|
||||
void main()
|
||||
{
|
||||
|
|
@ -52,18 +52,21 @@ void main()
|
|||
{
|
||||
discard;
|
||||
}
|
||||
col *= vertex_color;
|
||||
col *= vertex_color;
|
||||
|
||||
vec3 norm = texture(bumpMap, vary_texcoord0.xy).rgb * 2.0 - 1.0;
|
||||
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] = encodeNormal(nvn, GBUFFER_FLAG_HAS_ATMOS);
|
||||
frag_data[3] = vec4(vertex_color.a, 0, 0, 0);
|
||||
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] = encodeNormal(nvn, vertex_color.a, GBUFFER_FLAG_HAS_ATMOS);
|
||||
|
||||
#if defined(HAS_EMISSIVE)
|
||||
frag_data[3] = vec4(0, 0, 0, 0);
|
||||
#endif
|
||||
}
|
||||
|
|
|
|||
|
|
@ -114,9 +114,15 @@ void main()
|
|||
color.rgb *= 2.0;
|
||||
|
||||
/// Gamma correct for WL (soft clip effect).
|
||||
frag_data[0] = vec4(0);
|
||||
|
||||
frag_data[1] = vec4(0.0,0.0,0.0,0.0);
|
||||
frag_data[2] = vec4(0,0,0,GBUFFER_FLAG_SKIP_ATMOS);
|
||||
|
||||
#if defined(HAS_EMISSIVE)
|
||||
frag_data[0] = vec4(0);
|
||||
frag_data[3] = vec4(color.rgb, alpha1);
|
||||
#else
|
||||
frag_data[0] = vec4(color.rgb, alpha1);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -48,8 +48,8 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|||
SOFTWARE.
|
||||
*/
|
||||
|
||||
uniform sampler2D normalMap;
|
||||
uniform sampler2D depthMap;
|
||||
uniform sampler2D normalMap;
|
||||
uniform sampler2D depthMap;
|
||||
uniform sampler2D projectionMap; // rgba
|
||||
uniform sampler2D brdfLut;
|
||||
|
||||
|
|
@ -62,6 +62,8 @@ uniform float proj_lod ; // (number of mips in proj map)
|
|||
uniform float proj_range; // range between near clip and far clip plane of projection
|
||||
uniform float proj_ambiance;
|
||||
|
||||
uniform int classic_mode;
|
||||
|
||||
// light params
|
||||
uniform vec3 color; // light_color
|
||||
uniform float size; // light_size
|
||||
|
|
@ -73,11 +75,11 @@ const float M_PI = 3.14159265;
|
|||
const float ONE_OVER_PI = 0.3183098861;
|
||||
|
||||
vec3 srgb_to_linear(vec3 cs);
|
||||
vec3 linear_to_srgb(vec3 cs);
|
||||
vec3 atmosFragLightingLinear(vec3 light, vec3 additive, vec3 atten);
|
||||
|
||||
vec4 decodeNormal(vec4 norm);
|
||||
|
||||
|
||||
float calcLegacyDistanceAttenuation(float distance, float falloff)
|
||||
{
|
||||
float dist_atten = 1.0 - clamp((distance + falloff)/(1.0 + falloff), 0.0, 1.0);
|
||||
|
|
@ -152,6 +154,12 @@ vec4 getNorm(vec2 screenpos)
|
|||
return norm;
|
||||
}
|
||||
|
||||
vec4 getNormRaw(vec2 screenpos)
|
||||
{
|
||||
vec4 norm = texture(normalMap, screenpos.xy);
|
||||
return norm;
|
||||
}
|
||||
|
||||
// get linear depth value given a depth buffer sample d and znear and zfar values
|
||||
float linearDepth(float d, float znear, float zfar)
|
||||
{
|
||||
|
|
@ -352,13 +360,15 @@ vec2 BRDF(float NoV, float roughness)
|
|||
}
|
||||
|
||||
// set colorDiffuse and colorSpec to the results of GLTF PBR style IBL
|
||||
vec3 pbrIbl(vec3 diffuseColor,
|
||||
void pbrIbl(vec3 diffuseColor,
|
||||
vec3 specularColor,
|
||||
vec3 radiance, // radiance map sample
|
||||
vec3 irradiance, // irradiance map sample
|
||||
float ao, // ambient occlusion factor
|
||||
float nv, // normal dot view vector
|
||||
float perceptualRough)
|
||||
float perceptualRough,
|
||||
out vec3 diffuseOut,
|
||||
out vec3 specularOut)
|
||||
{
|
||||
// retrieve a scale and bias to F0. See [1], Figure 3
|
||||
vec2 brdf = BRDF(clamp(nv, 0, 1), 1.0-perceptualRough);
|
||||
|
|
@ -368,7 +378,8 @@ vec3 pbrIbl(vec3 diffuseColor,
|
|||
vec3 diffuse = diffuseLight * diffuseColor;
|
||||
vec3 specular = specularLight * (specularColor * brdf.x + brdf.y);
|
||||
|
||||
return (diffuse + specular) * ao;
|
||||
diffuseOut = diffuse * ao;
|
||||
specularOut = specular * ao;
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -431,12 +442,15 @@ float microfacetDistribution(PBRInfo pbrInputs)
|
|||
return roughnessSq / (M_PI * f * f);
|
||||
}
|
||||
|
||||
vec3 pbrPunctual(vec3 diffuseColor, vec3 specularColor,
|
||||
void pbrPunctual(vec3 diffuseColor, vec3 specularColor,
|
||||
float perceptualRoughness,
|
||||
float metallic,
|
||||
vec3 n, // normal
|
||||
vec3 v, // surface point to camera
|
||||
vec3 l) //surface point to light
|
||||
vec3 l,
|
||||
out float nl,
|
||||
out vec3 diff,
|
||||
out vec3 spec) //surface point to light
|
||||
{
|
||||
// make sure specular highlights from punctual lights don't fall off of polished surfaces
|
||||
perceptualRoughness = max(perceptualRoughness, 8.0/255.0);
|
||||
|
|
@ -485,10 +499,11 @@ vec3 pbrPunctual(vec3 diffuseColor, vec3 specularColor,
|
|||
// 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));
|
||||
nl = NdotL;
|
||||
|
||||
diff = diffuseContrib;
|
||||
spec = specContrib;
|
||||
}
|
||||
|
||||
vec3 pbrCalcPointLightOrSpotLight(vec3 diffuseColor, vec3 specularColor,
|
||||
|
|
@ -522,7 +537,12 @@ vec3 pbrCalcPointLightOrSpotLight(vec3 diffuseColor, vec3 specularColor,
|
|||
|
||||
vec3 intensity = spot_atten * dist_atten * lightColor * 3.0; //magic number to balance with legacy materials
|
||||
|
||||
color = intensity*pbrPunctual(diffuseColor, specularColor, perceptualRoughness, metallic, n.xyz, v, lv);
|
||||
float nl = 0;
|
||||
vec3 diffPunc = vec3(0);
|
||||
vec3 specPunc = vec3(0);
|
||||
|
||||
pbrPunctual(diffuseColor, specularColor, perceptualRoughness, metallic, n.xyz, v, lv, nl, diffPunc, specPunc);
|
||||
color = intensity * clamp(nl * (diffPunc + specPunc), vec3(0), vec3(10));
|
||||
}
|
||||
|
||||
return color;
|
||||
|
|
@ -541,10 +561,44 @@ 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);
|
||||
vec3 iblDiff = vec3(0);
|
||||
vec3 iblSpec = vec3(0);
|
||||
pbrIbl(diffuseColor, specularColor, radiance, irradiance, ao, NdotV, perceptualRoughness, iblDiff, iblSpec);
|
||||
|
||||
color += pbrIbl(diffuseColor, specularColor, radiance, irradiance, ao, NdotV, perceptualRoughness);
|
||||
color += iblDiff;
|
||||
|
||||
color += pbrPunctual(diffuseColor, specularColor, perceptualRoughness, metallic, norm, v, normalize(light_dir)) * sunlit * 3.0 * scol; //magic number to balance with legacy materials
|
||||
// For classic mode, we use a special version of pbrPunctual that basically gives us a deconstructed form of the lighting.
|
||||
float nl = 0;
|
||||
vec3 diffPunc = vec3(0);
|
||||
vec3 specPunc = vec3(0);
|
||||
pbrPunctual(diffuseColor, specularColor, perceptualRoughness, metallic, norm, v, normalize(light_dir), nl, diffPunc, specPunc);
|
||||
|
||||
// Depending on the sky, we combine these differently.
|
||||
if (classic_mode > 0)
|
||||
{
|
||||
// Reconstruct the diffuse lighting that we do for blinn-phong materials here.
|
||||
// A special note about why we do some really janky stuff for classic mode.
|
||||
// Since adding classic mode, we've moved the lambertian diffuse multiply out from pbrPunctual and instead handle it in the different light type calcs.
|
||||
// For classic mode, this baiscally introduces a double multiplication that we need to somehow avoid
|
||||
// Using one of the old mobile gamma correction tricks (val * val to "linearize", sqrt(val) to bring back into sRGB), we can _mostly_ avert this
|
||||
// This will never be 100% correct, but at the very least we can make it look mostly correct with legacy skies and classic mode.
|
||||
|
||||
float da = pow(sqrt(nl), 1.2);
|
||||
|
||||
vec3 sun_contrib = vec3(min(da, scol));
|
||||
|
||||
// Multiply by PI to account for lambertian diffuse colors. Otherwise things will be too dark when lit by the sun on legacy skies.
|
||||
sun_contrib = srgb_to_linear(color.rgb * 0.9 + linear_to_srgb(sun_contrib) * sunlit * 0.7) * M_PI;
|
||||
|
||||
// Manually recombine everything here. We have to separate the shading to ensure that lighting is able to more closely match blinn-phong.
|
||||
color.rgb = srgb_to_linear(iblDiff) + clamp(sun_contrib * (da * (diffPunc.rgb + specPunc.rgb) * scol), vec3(0), vec3(10));
|
||||
}
|
||||
else
|
||||
{
|
||||
color += clamp(nl * (diffPunc + specPunc), vec3(0), vec3(10)) * sunlit * 3.0 * scol;
|
||||
}
|
||||
|
||||
color.rgb += iblSpec.rgb;
|
||||
|
||||
color += colorEmissive;
|
||||
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@ in vec2 vary_texcoord0;
|
|||
|
||||
void mirrorClip(vec3 pos);
|
||||
|
||||
vec4 encodeNormal(vec3 norm, float gbuffer_flag);
|
||||
vec4 encodeNormal(vec3 n, float env, float gbuffer_flag);
|
||||
|
||||
void main()
|
||||
{
|
||||
|
|
@ -55,7 +55,10 @@ void main()
|
|||
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] = encodeNormal(nvn.xyz, GBUFFER_FLAG_HAS_ATMOS);
|
||||
frag_data[2] = encodeNormal(nvn.xyz, 0, GBUFFER_FLAG_HAS_ATMOS);
|
||||
|
||||
#if defined(HAS_EMISSIVE)
|
||||
frag_data[3] = vec4(0);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ in vec4 vertex_color;
|
|||
in vec2 vary_texcoord0;
|
||||
|
||||
void mirrorClip(vec3 pos);
|
||||
vec4 encodeNormal(vec3 norm, float gbuffer_flag);
|
||||
vec4 encodeNormal(vec3 n, float env, float gbuffer_flag);
|
||||
|
||||
void main()
|
||||
{
|
||||
|
|
@ -52,6 +52,9 @@ void main()
|
|||
frag_data[0] = vec4(col.rgb, 0.0);
|
||||
frag_data[1] = vec4(0,0,0,0);
|
||||
vec3 nvn = normalize(vary_normal);
|
||||
frag_data[2] = encodeNormal(nvn.xyz, GBUFFER_FLAG_HAS_ATMOS);
|
||||
frag_data[2] = encodeNormal(nvn.xyz, 0, GBUFFER_FLAG_HAS_ATMOS);
|
||||
|
||||
#if defined(HAS_EMISSIVE)
|
||||
frag_data[3] = vec4(0);
|
||||
#endif
|
||||
}
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ uniform sampler2D diffuseMap;
|
|||
|
||||
in vec3 vary_normal;
|
||||
in vec2 vary_texcoord0;
|
||||
vec4 encodeNormal(vec3 norm, float gbuffer_flag);
|
||||
vec4 encodeNormal(vec3 n, float env, float gbuffer_flag);
|
||||
|
||||
void main()
|
||||
{
|
||||
|
|
@ -47,7 +47,10 @@ void main()
|
|||
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] = encodeNormal(nvn.xyz, GBUFFER_FLAG_HAS_ATMOS);
|
||||
frag_data[2] = encodeNormal(nvn.xyz, 0, GBUFFER_FLAG_HAS_ATMOS);
|
||||
|
||||
#if defined(HAS_EMISSIVE)
|
||||
frag_data[3] = vec4(0);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ in vec2 vary_texcoord0;
|
|||
in vec3 vary_position;
|
||||
|
||||
void mirrorClip(vec3 pos);
|
||||
vec4 encodeNormal(vec3 norm, float gbuffer_flag);
|
||||
vec4 encodeNormal(vec3 n, float env, float gbuffer_flag);
|
||||
|
||||
void main()
|
||||
{
|
||||
|
|
@ -44,7 +44,10 @@ void main()
|
|||
frag_data[0] = vec4(col, 0.0);
|
||||
frag_data[1] = vertex_color.aaaa; // spec
|
||||
vec3 nvn = normalize(vary_normal);
|
||||
frag_data[2] = encodeNormal(nvn.xyz, GBUFFER_FLAG_HAS_ATMOS);
|
||||
frag_data[3] = vec4(vertex_color.a, 0, 0, 0);
|
||||
frag_data[2] = encodeNormal(nvn.xyz, vertex_color.a, GBUFFER_FLAG_HAS_ATMOS);
|
||||
|
||||
#if defined(HAS_EMISSIVE)
|
||||
frag_data[3] = vec4(0, 0, 0, 0);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ in vec2 vary_texcoord0;
|
|||
in vec3 vary_position;
|
||||
|
||||
void mirrorClip(vec3 pos);
|
||||
vec4 encodeNormal(vec3 norm, float gbuffer_flag);
|
||||
vec4 encodeNormal(vec3 n, float env, float gbuffer_flag);
|
||||
|
||||
vec3 linear_to_srgb(vec3 c);
|
||||
|
||||
|
|
@ -48,6 +48,9 @@ void main()
|
|||
frag_data[0] = vec4(col, 0.0);
|
||||
frag_data[1] = vec4(spec, vertex_color.a); // spec
|
||||
vec3 nvn = normalize(vary_normal);
|
||||
frag_data[2] = encodeNormal(nvn.xyz, GBUFFER_FLAG_HAS_ATMOS);
|
||||
frag_data[3] = vec4(vertex_color.a, 0, 0, 0);
|
||||
frag_data[2] = encodeNormal(nvn.xyz, vertex_color.a, GBUFFER_FLAG_HAS_ATMOS);
|
||||
|
||||
#if defined(HAS_EMISSIVE)
|
||||
frag_data[3] = vec4(0, 0, 0, 0);
|
||||
#endif
|
||||
}
|
||||
|
|
|
|||
|
|
@ -35,7 +35,8 @@ uniform sampler2D exposureMap;
|
|||
uniform float dt;
|
||||
uniform vec2 noiseVec;
|
||||
|
||||
uniform vec3 dynamic_exposure_params;
|
||||
uniform vec4 dynamic_exposure_params;
|
||||
uniform vec4 dynamic_exposure_params2;
|
||||
|
||||
float lum(vec3 col)
|
||||
{
|
||||
|
|
@ -53,11 +54,11 @@ void main()
|
|||
L /= max_L;
|
||||
L = pow(L, 2.0);
|
||||
float s = mix(dynamic_exposure_params.z, dynamic_exposure_params.y, L);
|
||||
|
||||
#ifdef USE_LAST_EXPOSURE
|
||||
float prev = texture(exposureMap, vec2(0.5,0.5)).r;
|
||||
|
||||
s = mix(prev, s, min(dt*2.0*abs(prev-s), 0.04));
|
||||
float speed = -log(dynamic_exposure_params.w) / dynamic_exposure_params2.w;
|
||||
s = mix(prev, s, 1 - exp(-speed * dt));
|
||||
#endif
|
||||
|
||||
frag_color = max(vec4(s, s, s, dt), vec4(0.0));
|
||||
|
|
|
|||
|
|
@ -0,0 +1,59 @@
|
|||
/**
|
||||
* @file class1/deferred/gbufferUtil.glsl
|
||||
*
|
||||
* $LicenseInfo:firstyear=2024&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 sampler2D diffuseRect;
|
||||
uniform sampler2D specularRect;
|
||||
|
||||
#if defined(HAS_EMISSIVE)
|
||||
uniform sampler2D emissiveRect;
|
||||
#endif
|
||||
|
||||
vec4 getNormRaw(vec2 screenpos);
|
||||
vec4 decodeNormal(vec4 norm);
|
||||
|
||||
GBufferInfo getGBuffer(vec2 screenpos)
|
||||
{
|
||||
GBufferInfo ret;
|
||||
vec4 diffInfo = vec4(0);
|
||||
vec4 specInfo = vec4(0);
|
||||
vec4 emissInfo = vec4(0);
|
||||
|
||||
diffInfo = texture(diffuseRect, screenpos.xy);
|
||||
specInfo = texture(specularRect, screenpos.xy);
|
||||
vec4 normInfo = getNormRaw(screenpos);
|
||||
|
||||
#if defined(HAS_EMISSIVE)
|
||||
emissInfo = texture(emissiveRect, screenpos.xy);
|
||||
#endif
|
||||
|
||||
ret.albedo = diffInfo;
|
||||
ret.normal = decodeNormal(normInfo).xyz;
|
||||
ret.specular = specInfo;
|
||||
ret.envIntensity = normInfo.b;
|
||||
ret.gbufferFlag = normInfo.w;
|
||||
ret.emissive = emissInfo;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
|
@ -43,15 +43,19 @@ void mirrorClip(vec3 pos)
|
|||
}
|
||||
}
|
||||
|
||||
vec4 encodeNormal(vec3 norm, float gbuffer_flag)
|
||||
vec4 encodeNormal(vec3 n, float env, float gbuffer_flag)
|
||||
{
|
||||
return vec4(norm * 0.5 + 0.5, gbuffer_flag);
|
||||
float f = sqrt(8 * n.z + 8);
|
||||
return vec4(n.xy / f + 0.5, env, gbuffer_flag);
|
||||
}
|
||||
|
||||
vec4 decodeNormal(vec4 norm)
|
||||
{
|
||||
norm.xyz = norm.xyz * 2.0 - 1.0;
|
||||
return norm;
|
||||
vec2 fenc = norm.xy*4-2;
|
||||
float f = dot(fenc,fenc);
|
||||
float g = sqrt(1-f/4);
|
||||
vec4 n;
|
||||
n.xy = fenc*g;
|
||||
n.z = 1-f/2;
|
||||
return n;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -35,5 +35,8 @@ void main()
|
|||
frag_data[0] = color*texture(diffuseMap, vary_texcoord0.xy);
|
||||
frag_data[1] = vec4(0.0);
|
||||
frag_data[2] = vec4(0.0, 1.0, 0.0, GBUFFER_FLAG_SKIP_ATMOS);
|
||||
|
||||
#if defined(HAS_EMISSIVE)
|
||||
frag_data[3] = vec4(0);
|
||||
#endif
|
||||
}
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ in vec2 vary_texcoord0;
|
|||
|
||||
vec3 linear_to_srgb(vec3 c);
|
||||
|
||||
vec4 encodeNormal(vec3 norm, float gbuffer_flag);
|
||||
vec4 encodeNormal(vec3 n, float env, float gbuffer_flag);
|
||||
|
||||
void main()
|
||||
{
|
||||
|
|
@ -55,5 +55,8 @@ void main()
|
|||
frag_data[0] = vec4(col.rgb, 0.0);
|
||||
frag_data[1] = spec;
|
||||
frag_data[2] = vec4(norm.xyz, GBUFFER_FLAG_HAS_ATMOS);
|
||||
|
||||
#if defined(HAS_EMISSIVE)
|
||||
frag_data[3] = vec4(0);
|
||||
#endif
|
||||
}
|
||||
|
|
|
|||
|
|
@ -51,8 +51,8 @@ void main()
|
|||
|
||||
vec4 norm = texture(normalMap, tc);
|
||||
|
||||
if (!GET_GBUFFER_FLAG(GBUFFER_FLAG_HAS_HDRI) &&
|
||||
!GET_GBUFFER_FLAG(GBUFFER_FLAG_SKIP_ATMOS))
|
||||
if (!GET_GBUFFER_FLAG(norm.w, GBUFFER_FLAG_HAS_HDRI) &&
|
||||
!GET_GBUFFER_FLAG(norm.w, GBUFFER_FLAG_SKIP_ATMOS))
|
||||
{
|
||||
// Apply the diffuse luminance scale to objects but not the sky
|
||||
// Prevents underexposing when looking at bright environments
|
||||
|
|
|
|||
|
|
@ -44,7 +44,9 @@ void main()
|
|||
frag_data[0] = vec4(0.5, 0, 1, 0); // gbuffer is sRGB for legacy materials
|
||||
frag_data[1] = vec4(0); // XYZ = Specular color. W = Specular exponent.
|
||||
frag_data[2] = vec4(0); // XY = Normal. Z = Env. intensity. W = 1 skip atmos (mask off fog)
|
||||
#if defined(HAS_EMISSIVE)
|
||||
frag_data[3] = vec4(0);
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -56,7 +56,13 @@ void main()
|
|||
frag_data[0] = vec4(0);
|
||||
frag_data[1] = vec4(0.0);
|
||||
frag_data[2] = vec4(0.0, 0.0, 0.0, GBUFFER_FLAG_SKIP_ATMOS);
|
||||
|
||||
#if defined(HAS_EMISSIVE)
|
||||
frag_data[0] = vec4(0);
|
||||
frag_data[3] = vec4(c.rgb, c.a);
|
||||
#else
|
||||
frag_data[0] = vec4(c.rgb, c.a);
|
||||
#endif
|
||||
|
||||
// Added and commented out for a ground truth. Do not uncomment - Geenz
|
||||
//gl_FragDepth = 0.999985f;
|
||||
|
|
|
|||
|
|
@ -61,7 +61,7 @@ uniform vec4 clipPlane;
|
|||
uniform float clipSign;
|
||||
|
||||
void mirrorClip(vec3 pos);
|
||||
vec4 encodeNormal(vec3 norm, float gbuffer_flag);
|
||||
vec4 encodeNormal(vec3 n, float env, float gbuffer_flag);
|
||||
|
||||
uniform mat3 normal_matrix;
|
||||
|
||||
|
|
@ -114,8 +114,11 @@ void main()
|
|||
// See: C++: addDeferredAttachments(), GLSL: softenLightF
|
||||
frag_data[0] = max(vec4(col, 0.0), vec4(0)); // Diffuse
|
||||
frag_data[1] = max(vec4(spec.rgb,0.0), vec4(0)); // PBR linear packed Occlusion, Roughness, Metal.
|
||||
frag_data[2] = encodeNormal(tnorm, GBUFFER_FLAG_HAS_PBR); // normal, environment intensity, flags
|
||||
frag_data[2] = encodeNormal(tnorm, 0, GBUFFER_FLAG_HAS_PBR); // normal, environment intensity, flags
|
||||
|
||||
#if defined(HAS_EMISSIVE)
|
||||
frag_data[3] = max(vec4(emissive,0), vec4(0)); // PBR sRGB Emissive
|
||||
#endif
|
||||
}
|
||||
|
||||
#else
|
||||
|
|
|
|||
|
|
@ -162,7 +162,7 @@ in vec4[2] vary_coords;
|
|||
#endif
|
||||
|
||||
void mirrorClip(vec3 position);
|
||||
vec4 encodeNormal(vec3 norm, float gbuffer_flag);
|
||||
vec4 encodeNormal(vec3 n, float env, float gbuffer_flag);
|
||||
|
||||
float terrain_mix(TerrainMix tm, vec4 tms4);
|
||||
|
||||
|
|
@ -430,7 +430,10 @@ void main()
|
|||
#endif
|
||||
frag_data[0] = max(vec4(pbr_mix.col.xyz, 0.0), vec4(0)); // Diffuse
|
||||
frag_data[1] = max(vec4(mix_orm.rgb, base_color_factor_alpha), vec4(0)); // PBR linear packed Occlusion, Roughness, Metal.
|
||||
frag_data[2] = encodeNormal(tnorm, GBUFFER_FLAG_HAS_PBR); // normal, flags
|
||||
frag_data[2] = encodeNormal(tnorm, 0, GBUFFER_FLAG_HAS_PBR); // normal, flags
|
||||
|
||||
#if defined(HAS_EMISSIVE)
|
||||
frag_data[3] = max(vec4(mix_emissive,0), vec4(0)); // PBR sRGB Emissive
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -117,8 +117,13 @@ void main()
|
|||
frag_data[2] = vec4(0.0,0.0,0.0,GBUFFER_FLAG_SKIP_ATMOS);
|
||||
}
|
||||
|
||||
frag_data[0] = vec4(0);
|
||||
frag_data[1] = vec4(0);
|
||||
|
||||
#if defined(HAS_EMISSIVE)
|
||||
frag_data[0] = vec4(0);
|
||||
frag_data[3] = vec4(color.rgb, 1.0);
|
||||
#else
|
||||
frag_data[0] = vec4(color.rgb, 1.0);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -58,9 +58,14 @@ void main()
|
|||
col.a = (col.a * factor) * 32.0f;
|
||||
col.a *= twinkle();
|
||||
|
||||
frag_data[0] = vec4(0);
|
||||
frag_data[1] = vec4(0.0f);
|
||||
frag_data[2] = vec4(0.0, 1.0, 0.0, GBUFFER_FLAG_SKIP_ATMOS);
|
||||
|
||||
#if defined(HAS_EMISSIVE)
|
||||
frag_data[0] = vec4(0);
|
||||
frag_data[3] = col;
|
||||
#else
|
||||
frag_data[0] = col;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -48,6 +48,11 @@ void main()
|
|||
frag_data[0] = vec4(0);
|
||||
frag_data[1] = vec4(0.0f);
|
||||
frag_data[2] = vec4(0.0, 1.0, 0.0, GBUFFER_FLAG_SKIP_ATMOS);
|
||||
#if defined(HAS_EMISSIVE)
|
||||
frag_data[0] = vec4(0);
|
||||
frag_data[3] = c;
|
||||
#else
|
||||
frag_data[0] = c;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@ in vec4 vary_texcoord0;
|
|||
in vec4 vary_texcoord1;
|
||||
|
||||
void mirrorClip(vec3 position);
|
||||
vec4 encodeNormal(vec3 norm, float gbuffer_flag);
|
||||
vec4 encodeNormal(vec3 n, float env, float gbuffer_flag);
|
||||
|
||||
void main()
|
||||
{
|
||||
|
|
@ -61,7 +61,10 @@ void main()
|
|||
frag_data[0] = max(outColor, vec4(0));
|
||||
frag_data[1] = vec4(0.0,0.0,0.0,-1.0);
|
||||
vec3 nvn = normalize(vary_normal);
|
||||
frag_data[2] = encodeNormal(nvn.xyz, GBUFFER_FLAG_HAS_ATMOS);
|
||||
frag_data[2] = encodeNormal(nvn.xyz, 0, GBUFFER_FLAG_HAS_ATMOS);
|
||||
|
||||
#if defined(HAS_EMISSIVE)
|
||||
frag_data[3] = vec4(0);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ in vec3 vary_position;
|
|||
uniform float minimum_alpha;
|
||||
|
||||
void mirrorClip(vec3 pos);
|
||||
vec4 encodeNormal(vec3 norm, float gbuffer_flag);
|
||||
vec4 encodeNormal(vec3 n, float env, float gbuffer_flag);
|
||||
|
||||
void main()
|
||||
{
|
||||
|
|
@ -51,6 +51,9 @@ void main()
|
|||
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] = encodeNormal(nvn.xyz, GBUFFER_FLAG_HAS_ATMOS);
|
||||
frag_data[2] = encodeNormal(nvn.xyz, 0, GBUFFER_FLAG_HAS_ATMOS);
|
||||
|
||||
#if defined(HAS_EMISSIVE)
|
||||
frag_data[3] = vec4(0);
|
||||
#endif
|
||||
}
|
||||
|
|
|
|||
|
|
@ -64,7 +64,7 @@ in vec2 base_color_uv;
|
|||
in vec2 emissive_uv;
|
||||
|
||||
void mirrorClip(vec3 pos);
|
||||
vec4 encodeNormal(vec3 norm, float gbuffer_flag);
|
||||
vec4 encodeNormal(vec3 n, float env, float gbuffer_flag);
|
||||
|
||||
vec3 linear_to_srgb(vec3 c);
|
||||
vec3 srgb_to_linear(vec3 c);
|
||||
|
|
@ -243,8 +243,11 @@ void main()
|
|||
#else
|
||||
frag_data[0] = max(vec4(basecolor.rgb, 0.0), vec4(0));
|
||||
frag_data[1] = max(vec4(orm.rgb,0.0), vec4(0));
|
||||
frag_data[2] = encodeNormal(norm, GBUFFER_FLAG_HAS_PBR);
|
||||
frag_data[2] = encodeNormal(norm, 0, GBUFFER_FLAG_HAS_PBR);
|
||||
|
||||
//#if defined(HAS_EMISSIVE)
|
||||
frag_data[3] = max(vec4(emissive,0), vec4(0));
|
||||
//#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
|
|
|||
|
|
@ -197,7 +197,7 @@ out vec3 vary_fragcoord;
|
|||
|
||||
layout (std140) uniform GLTFJoints
|
||||
{
|
||||
mat3x4 gltf_joints[MAX_NODES_PER_GLTF_OBJECT];
|
||||
vec4 gltf_joints[MAX_NODES_PER_GLTF_OBJECT];
|
||||
};
|
||||
|
||||
|
||||
|
|
@ -210,27 +210,22 @@ mat4 getGLTFTransform()
|
|||
|
||||
vec4 w = weight4;
|
||||
|
||||
uint i1 = joint.x;
|
||||
uint i2 = joint.y;
|
||||
uint i3 = joint.z;
|
||||
uint i4 = joint.w;
|
||||
uint i1 = joint.x*3u;
|
||||
uint i2 = joint.y*3u;
|
||||
uint i3 = joint.z*3u;
|
||||
uint i4 = joint.w*3u;
|
||||
|
||||
mat3 mat = mat3(gltf_joints[i1])*w.x;
|
||||
mat += mat3(gltf_joints[i2])*w.y;
|
||||
mat += mat3(gltf_joints[i3])*w.z;
|
||||
mat += mat3(gltf_joints[i4])*w.w;
|
||||
|
||||
vec3 trans = vec3(gltf_joints[i1][0].w,gltf_joints[i1][1].w,gltf_joints[i1][2].w)*w.x;
|
||||
trans += vec3(gltf_joints[i2][0].w,gltf_joints[i2][1].w,gltf_joints[i2][2].w)*w.y;
|
||||
trans += vec3(gltf_joints[i3][0].w,gltf_joints[i3][1].w,gltf_joints[i3][2].w)*w.z;
|
||||
trans += vec3(gltf_joints[i4][0].w,gltf_joints[i4][1].w,gltf_joints[i4][2].w)*w.w;
|
||||
// lerp the joints
|
||||
vec4 v0 = gltf_joints[i1+0u] * w.x + gltf_joints[i2+0u] * w.y + gltf_joints[i3+0u] * w.z + gltf_joints[i4+0u] * w.w;
|
||||
vec4 v1 = gltf_joints[i1+1u] * w.x + gltf_joints[i2+1u] * w.y + gltf_joints[i3+1u] * w.z + gltf_joints[i4+1u] * w.w;
|
||||
vec4 v2 = gltf_joints[i1+2u] * w.x + gltf_joints[i2+2u] * w.y + gltf_joints[i3+2u] * w.z + gltf_joints[i4+2u] * w.w;
|
||||
|
||||
//unpack into return matrix
|
||||
mat4 ret;
|
||||
|
||||
ret[0] = vec4(mat[0], 0);
|
||||
ret[1] = vec4(mat[1], 0);
|
||||
ret[2] = vec4(mat[2], 0);
|
||||
ret[3] = vec4(trans, 1.0);
|
||||
ret[0] = vec4(v0.xyz, 0);
|
||||
ret[1] = vec4(v1.xyz, 0);
|
||||
ret[2] = vec4(v2.xyz, 0);
|
||||
ret[3] = vec4(v0.w, v1.w, v2.w, 1.0);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
|
@ -239,7 +234,7 @@ mat4 getGLTFTransform()
|
|||
|
||||
layout (std140) uniform GLTFNodes
|
||||
{
|
||||
mat3x4 gltf_nodes[MAX_NODES_PER_GLTF_OBJECT];
|
||||
vec4 gltf_nodes[MAX_NODES_PER_GLTF_OBJECT];
|
||||
};
|
||||
|
||||
uniform int gltf_node_id = 0;
|
||||
|
|
@ -247,13 +242,17 @@ uniform int gltf_node_id = 0;
|
|||
mat4 getGLTFTransform()
|
||||
{
|
||||
mat4 ret;
|
||||
mat3x4 src = gltf_nodes[gltf_node_id];
|
||||
int idx = gltf_node_id*3;
|
||||
|
||||
ret[0] = vec4(src[0].xyz, 0);
|
||||
ret[1] = vec4(src[1].xyz, 0);
|
||||
ret[2] = vec4(src[2].xyz, 0);
|
||||
vec4 src0 = gltf_nodes[idx+0];
|
||||
vec4 src1 = gltf_nodes[idx+1];
|
||||
vec4 src2 = gltf_nodes[idx+2];
|
||||
|
||||
ret[3] = vec4(src[0].w, src[1].w, src[2].w, 1);
|
||||
ret[0] = vec4(src0.xyz, 0);
|
||||
ret[1] = vec4(src1.xyz, 0);
|
||||
ret[2] = vec4(src2.xyz, 0);
|
||||
|
||||
ret[3] = vec4(src0.w, src1.w, src2.w, 1);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -31,5 +31,8 @@ void main()
|
|||
frag_data[0] = vec4(0, 0, 0, 0);
|
||||
frag_data[1] = vec4(0, 0, 0, 0);
|
||||
frag_data[2] = vec4(1, 0, 0, GBUFFER_FLAG_HAS_PBR);
|
||||
|
||||
#if defined(HAS_EMISSIVE)
|
||||
frag_data[3] = vec4(1, 0, 0, 0);
|
||||
#endif
|
||||
}
|
||||
|
|
|
|||
|
|
@ -41,6 +41,7 @@ uniform float scene_light_strength;
|
|||
uniform float sun_moon_glow_factor;
|
||||
uniform float sky_sunlight_scale;
|
||||
uniform float sky_ambient_scale;
|
||||
uniform int classic_mode;
|
||||
|
||||
float getAmbientClamp() { return 1.0f; }
|
||||
|
||||
|
|
@ -121,7 +122,7 @@ void calcAtmosphericVars(vec3 inPositionEye, vec3 light_dir, float ambFactor, ou
|
|||
// brightness of surface both sunlight and ambient
|
||||
|
||||
sunlit = sunlight.rgb;
|
||||
amblit = tmpAmbient;
|
||||
amblit = pow(tmpAmbient.rgb, vec3(0.9)) * 0.57;
|
||||
|
||||
additive *= vec3(1.0 - combined_haze);
|
||||
|
||||
|
|
@ -142,18 +143,22 @@ float ambientLighting(vec3 norm, vec3 light_dir)
|
|||
return ambient;
|
||||
}
|
||||
|
||||
|
||||
// return lit amblit in linear space, leave sunlit and additive in sRGB space
|
||||
void calcAtmosphericVarsLinear(vec3 inPositionEye, vec3 norm, vec3 light_dir, out vec3 sunlit, out vec3 amblit, out vec3 additive,
|
||||
out vec3 atten)
|
||||
{
|
||||
calcAtmosphericVars(inPositionEye, light_dir, 1.0, sunlit, amblit, additive, atten);
|
||||
|
||||
amblit *= ambientLighting(norm, light_dir);
|
||||
|
||||
if (classic_mode < 1)
|
||||
{
|
||||
amblit = srgb_to_linear(amblit);
|
||||
sunlit = srgb_to_linear(sunlit);
|
||||
}
|
||||
|
||||
// multiply to get similar colors as when the "scaleSoftClip" implementation was doubling color values
|
||||
// (allows for mixing of light sources other than sunlight e.g. reflection probes)
|
||||
sunlit *= sky_sunlight_scale;
|
||||
amblit *= sky_ambient_scale;
|
||||
|
||||
amblit = srgb_to_linear(amblit);
|
||||
amblit *= ambientLighting(norm, light_dir);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -111,13 +111,6 @@ vec3 pbrBaseLight(vec3 diffuseColor,
|
|||
vec3 additive,
|
||||
vec3 atten);
|
||||
|
||||
vec3 pbrPunctual(vec3 diffuseColor, vec3 specularColor,
|
||||
float perceptualRoughness,
|
||||
float metallic,
|
||||
vec3 n, // normal
|
||||
vec3 v, // surface point to camera
|
||||
vec3 l); //surface point to light
|
||||
|
||||
vec3 pbrCalcPointLightOrSpotLight(vec3 diffuseColor, vec3 specularColor,
|
||||
float perceptualRoughness,
|
||||
float metallic,
|
||||
|
|
|
|||
|
|
@ -32,11 +32,12 @@ uniform samplerCube environmentMap;
|
|||
uniform mat3 env_mat;
|
||||
|
||||
vec3 srgb_to_linear(vec3 c);
|
||||
vec3 linear_to_srgb(vec3 c);
|
||||
|
||||
void sampleReflectionProbes(inout vec3 ambenv, inout vec3 glossenv,
|
||||
vec2 tc, vec3 pos, vec3 norm, float glossiness, bool transparent, vec3 amblit_linear)
|
||||
{
|
||||
ambenv = vec3(reflection_probe_ambiance * 0.25);
|
||||
ambenv = mix(ambenv, vec3(reflection_probe_ambiance * 0.25), reflection_probe_ambiance);
|
||||
|
||||
vec3 refnormpersp = normalize(reflect(pos.xyz, norm.xyz));
|
||||
vec3 env_vec = env_mat * refnormpersp;
|
||||
|
|
@ -58,12 +59,12 @@ vec4 sampleReflectionProbesDebug(vec3 pos)
|
|||
void sampleReflectionProbesLegacy(inout vec3 ambenv, inout vec3 glossenv, inout vec3 legacyenv,
|
||||
vec2 tc, vec3 pos, vec3 norm, float glossiness, float envIntensity, bool transparent, vec3 amblit_linear)
|
||||
{
|
||||
ambenv = vec3(reflection_probe_ambiance * 0.25);
|
||||
ambenv = mix(ambenv, vec3(reflection_probe_ambiance * 0.25), reflection_probe_ambiance);
|
||||
|
||||
vec3 refnormpersp = normalize(reflect(pos.xyz, norm.xyz));
|
||||
vec3 env_vec = env_mat * refnormpersp;
|
||||
|
||||
legacyenv = srgb_to_linear(texture(environmentMap, env_vec).rgb);
|
||||
legacyenv = texture(environmentMap, env_vec).rgb;
|
||||
|
||||
glossenv = legacyenv;
|
||||
}
|
||||
|
|
@ -75,6 +76,6 @@ void applyGlossEnv(inout vec3 color, vec3 glossenv, vec4 spec, vec3 pos, vec3 no
|
|||
|
||||
void applyLegacyEnv(inout vec3 color, vec3 legacyenv, vec4 spec, vec3 pos, vec3 norm, float envIntensity)
|
||||
{
|
||||
color = mix(color.rgb, legacyenv*1.5, envIntensity);
|
||||
color = srgb_to_linear(mix(linear_to_srgb(color.rgb), legacyenv*2.0, envIntensity));
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -64,8 +64,6 @@ void main()
|
|||
|
||||
calcAtmosphericVarsLinear(pos.xyz, norm.xyz, light_dir, sunlit, amblit, additive, atten);
|
||||
|
||||
vec3 sunlit_linear = srgb_to_linear(sunlit);
|
||||
|
||||
// mask off atmospherics below water (when camera is under water)
|
||||
bool do_atmospherics = false;
|
||||
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ uniform mat3 normal_matrix;
|
|||
in vec3 vary_position;
|
||||
|
||||
void mirrorClip(vec3 pos);
|
||||
vec4 encodeNormal(vec3 norm, float gbuffer_flag);
|
||||
vec4 encodeNormal(vec3 n, float env, float gbuffer_flag);
|
||||
|
||||
#if (DIFFUSE_ALPHA_MODE == DIFFUSE_ALPHA_MODE_BLEND)
|
||||
|
||||
|
|
@ -415,8 +415,11 @@ void main()
|
|||
|
||||
frag_data[0] = max(vec4(diffcol.rgb, emissive), vec4(0)); // gbuffer is sRGB for legacy materials
|
||||
frag_data[1] = max(vec4(spec.rgb, glossiness), vec4(0)); // XYZ = Specular color. W = Specular exponent.
|
||||
frag_data[2] = encodeNormal(norm, flag); // XY = Normal. Z = Env. intensity. W = 1 skip atmos (mask off fog)
|
||||
frag_data[3] = vec4(env, 0, 0, 0);
|
||||
frag_data[2] = encodeNormal(norm, env, flag); // XY = Normal. Z = Env. intensity. W = 1 skip atmos (mask off fog)
|
||||
|
||||
#if defined(HAS_EMISSIVE)
|
||||
frag_data[3] = vec4(0, 0, 0, 0);
|
||||
#endif
|
||||
|
||||
#endif
|
||||
}
|
||||
|
|
|
|||
|
|
@ -27,9 +27,6 @@
|
|||
|
||||
out vec4 frag_color;
|
||||
|
||||
uniform sampler2D diffuseRect;
|
||||
uniform sampler2D specularRect;
|
||||
uniform sampler2D emissiveRect; // PBR linear packed Occlusion, Roughness, Metal. See: pbropaqueF.glsl
|
||||
uniform sampler2D lightFunc;
|
||||
|
||||
uniform vec3 env_mat[3];
|
||||
|
|
@ -55,13 +52,17 @@ vec3 srgb_to_linear(vec3 c);
|
|||
// Util
|
||||
vec3 hue_to_rgb(float hue);
|
||||
|
||||
vec3 pbrPunctual(vec3 diffuseColor, vec3 specularColor,
|
||||
void pbrPunctual(vec3 diffuseColor, vec3 specularColor,
|
||||
float perceptualRoughness,
|
||||
float metallic,
|
||||
vec3 n, // normal
|
||||
vec3 v, // surface point to camera
|
||||
vec3 l); //surface point to light
|
||||
vec3 l, // surface point to light
|
||||
out float nl,
|
||||
out vec3 diff,
|
||||
out vec3 spec);
|
||||
|
||||
GBufferInfo getGBuffer(vec2 screenpos);
|
||||
|
||||
void main()
|
||||
{
|
||||
|
|
@ -73,18 +74,19 @@ void main()
|
|||
discard;
|
||||
}
|
||||
|
||||
vec4 norm = getNorm(tc); // need `norm.w` for GET_GBUFFER_FLAG()
|
||||
vec3 n = norm.xyz;
|
||||
GBufferInfo gb = getGBuffer(tc);
|
||||
|
||||
vec4 spec = texture(specularRect, tc);
|
||||
vec3 diffuse = texture(diffuseRect, tc).rgb;
|
||||
vec3 n = gb.normal;
|
||||
|
||||
vec4 spec = gb.specular;
|
||||
vec3 diffuse = gb.albedo.rgb;
|
||||
|
||||
vec3 h, l, v = -normalize(pos);
|
||||
float nh, nv, vh, lightDist;
|
||||
|
||||
if (GET_GBUFFER_FLAG(GBUFFER_FLAG_HAS_PBR))
|
||||
if (GET_GBUFFER_FLAG(gb.gbufferFlag, GBUFFER_FLAG_HAS_PBR))
|
||||
{
|
||||
vec3 colorEmissive = texture(emissiveRect, tc).rgb;
|
||||
vec3 colorEmissive = gb.emissive.rgb;
|
||||
vec3 orm = spec.rgb;
|
||||
float perceptualRoughness = orm.g;
|
||||
float metallic = orm.b;
|
||||
|
|
@ -113,8 +115,11 @@ void main()
|
|||
float dist_atten = calcLegacyDistanceAttenuation(dist, falloff);
|
||||
|
||||
vec3 intensity = dist_atten * lightColor * 3.25;
|
||||
|
||||
final_color += intensity*pbrPunctual(diffuseColor, specularColor, perceptualRoughness, metallic, n.xyz, v, lv);
|
||||
float nl = 0;
|
||||
vec3 diff = vec3(0);
|
||||
vec3 specPunc = vec3(0);
|
||||
pbrPunctual(diffuseColor, specularColor, perceptualRoughness, metallic, n.xyz, v, lv, nl, diff, specPunc);
|
||||
final_color += intensity * clamp(nl * (diff + specPunc), vec3(0), vec3(10));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -27,9 +27,6 @@
|
|||
|
||||
out vec4 frag_color;
|
||||
|
||||
uniform sampler2D diffuseRect;
|
||||
uniform sampler2D specularRect;
|
||||
uniform sampler2D emissiveRect; // PBR linear packed Occlusion, Roughness, Metal. See: pbropaqueF.glsl
|
||||
uniform sampler2D lightFunc;
|
||||
|
||||
uniform vec3 env_mat[3];
|
||||
|
|
@ -57,24 +54,29 @@ vec2 getScreenCoord(vec4 clip);
|
|||
vec3 srgb_to_linear(vec3 c);
|
||||
float getDepth(vec2 tc);
|
||||
|
||||
vec3 pbrPunctual(vec3 diffuseColor, vec3 specularColor,
|
||||
void pbrPunctual(vec3 diffuseColor, vec3 specularColor,
|
||||
float perceptualRoughness,
|
||||
float metallic,
|
||||
vec3 n, // normal
|
||||
vec3 v, // surface point to camera
|
||||
vec3 l); //surface point to light
|
||||
vec3 l, // surface point to light
|
||||
out float nl,
|
||||
out vec3 diff,
|
||||
out vec3 spec);
|
||||
|
||||
GBufferInfo getGBuffer(vec2 screenpos);
|
||||
|
||||
void main()
|
||||
{
|
||||
vec3 final_color = vec3(0);
|
||||
vec2 tc = getScreenCoord(vary_fragcoord);
|
||||
vec3 pos = getPosition(tc).xyz;
|
||||
GBufferInfo gb = getGBuffer(tc);
|
||||
|
||||
vec4 norm = getNorm(tc); // need `norm.w` for GET_GBUFFER_FLAG()
|
||||
vec3 n = norm.xyz;
|
||||
vec3 n = gb.normal;
|
||||
|
||||
vec3 diffuse = texture(diffuseRect, tc).rgb;
|
||||
vec4 spec = texture(specularRect, tc);
|
||||
vec3 diffuse = gb.albedo.rgb;
|
||||
vec4 spec = gb.specular;
|
||||
|
||||
// Common half vectors calcs
|
||||
vec3 lv = trans_center.xyz-pos;
|
||||
|
|
@ -89,9 +91,9 @@ void main()
|
|||
float dist = lightDist / size;
|
||||
float dist_atten = calcLegacyDistanceAttenuation(dist, falloff);
|
||||
|
||||
if (GET_GBUFFER_FLAG(GBUFFER_FLAG_HAS_PBR))
|
||||
if (GET_GBUFFER_FLAG(gb.gbufferFlag, GBUFFER_FLAG_HAS_PBR))
|
||||
{
|
||||
vec3 colorEmissive = texture(emissiveRect, tc).rgb;
|
||||
vec3 colorEmissive = gb.emissive.rgb;
|
||||
vec3 orm = spec.rgb;
|
||||
float perceptualRoughness = orm.g;
|
||||
float metallic = orm.b;
|
||||
|
|
@ -104,7 +106,14 @@ void main()
|
|||
vec3 specularColor = mix(f0, baseColor.rgb, metallic);
|
||||
|
||||
vec3 intensity = dist_atten * color * 3.25; // Legacy attenuation, magic number to balance with legacy materials
|
||||
final_color += intensity*pbrPunctual(diffuseColor, specularColor, perceptualRoughness, metallic, n.xyz, v, normalize(lv));
|
||||
|
||||
float nl = 0;
|
||||
vec3 diffPunc = vec3(0);
|
||||
vec3 specPunc = vec3(0);
|
||||
|
||||
pbrPunctual(diffuseColor, specularColor, perceptualRoughness, metallic, n.xyz, v, normalize(lv), nl, diffPunc, specPunc);
|
||||
|
||||
final_color += intensity* clamp(nl * (diffPunc + specPunc), vec3(0), vec3(10));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
|||
|
|
@ -66,7 +66,7 @@ void main()
|
|||
|
||||
vec4 fcol = texture(diffuseMap, tc);
|
||||
|
||||
if (GET_GBUFFER_FLAG(GBUFFER_FLAG_HAS_PBR))
|
||||
if (GET_GBUFFER_FLAG(norm.w, GBUFFER_FLAG_HAS_PBR))
|
||||
{
|
||||
vec3 orm = specCol.rgb;
|
||||
float perceptualRoughness = orm.g;
|
||||
|
|
|
|||
|
|
@ -23,16 +23,12 @@
|
|||
* $/LicenseInfo$
|
||||
*/
|
||||
|
||||
/*[EXTRA_CODE_HERE]*/
|
||||
|
||||
#define FLT_MAX 3.402823466e+38
|
||||
|
||||
out vec4 frag_color;
|
||||
|
||||
vec4 decodeNormal(vec4 norm);
|
||||
|
||||
uniform sampler2D diffuseRect;
|
||||
uniform sampler2D specularRect;
|
||||
uniform sampler2D emissiveRect; // PBR linear packed Occlusion, Roughness, Metal. See: pbropaqueF.glsl
|
||||
|
||||
const float M_PI = 3.14159265;
|
||||
|
||||
#if defined(HAS_SUN_SHADOW) || defined(HAS_SSAO)
|
||||
|
|
@ -56,6 +52,8 @@ uniform mat3 ssao_effect_mat;
|
|||
uniform vec3 sun_dir;
|
||||
uniform vec3 moon_dir;
|
||||
uniform int sun_up_factor;
|
||||
uniform int classic_mode;
|
||||
|
||||
in vec2 vary_fragcoord;
|
||||
|
||||
uniform mat4 inv_proj;
|
||||
|
|
@ -105,13 +103,7 @@ vec3 pbrBaseLight(vec3 diffuseColor,
|
|||
vec3 additive,
|
||||
vec3 atten);
|
||||
|
||||
vec3 pbrPunctual(vec3 diffuseColor, vec3 specularColor,
|
||||
float perceptualRoughness,
|
||||
float metallic,
|
||||
vec3 n, // normal
|
||||
vec3 v, // surface point to camera
|
||||
vec3 l); //surface point to light
|
||||
|
||||
GBufferInfo getGBuffer(vec2 screenpos);
|
||||
|
||||
void adjustIrradiance(inout vec3 irradiance, float ambocc)
|
||||
{
|
||||
|
|
@ -128,13 +120,15 @@ void main()
|
|||
vec2 tc = vary_fragcoord.xy;
|
||||
float depth = getDepth(tc.xy);
|
||||
vec4 pos = getPositionWithDepth(tc, depth);
|
||||
vec4 norm = getNorm(tc);
|
||||
vec3 colorEmissive = texture(emissiveRect, tc).rgb;
|
||||
float envIntensity = colorEmissive.r;
|
||||
|
||||
GBufferInfo gb = getGBuffer(tc);
|
||||
|
||||
vec3 colorEmissive = gb.emissive.rgb;
|
||||
float envIntensity = gb.envIntensity;
|
||||
vec3 light_dir = (sun_up_factor == 1) ? sun_dir : moon_dir;
|
||||
|
||||
vec4 baseColor = texture(diffuseRect, tc);
|
||||
vec4 spec = texture(specularRect, tc); // NOTE: PBR linear Emissive
|
||||
vec4 baseColor = gb.albedo;
|
||||
vec4 spec = gb.specular; // NOTE: PBR linear Emissive
|
||||
|
||||
#if defined(HAS_SUN_SHADOW) || defined(HAS_SSAO)
|
||||
vec2 scol_ambocc = texture(lightMap, vary_fragcoord.xy).rg;
|
||||
|
|
@ -159,26 +153,26 @@ void main()
|
|||
vec3 additive;
|
||||
vec3 atten;
|
||||
|
||||
calcAtmosphericVarsLinear(pos.xyz, norm.xyz, light_dir, sunlit, amblit, additive, atten);
|
||||
calcAtmosphericVarsLinear(pos.xyz, gb.normal, light_dir, sunlit, amblit, additive, atten);
|
||||
|
||||
vec3 sunlit_linear = srgb_to_linear(sunlit);
|
||||
vec3 sunlit_linear = sunlit;
|
||||
vec3 amblit_linear = amblit;
|
||||
|
||||
vec3 irradiance = vec3(0);
|
||||
vec3 radiance = vec3(0);
|
||||
|
||||
if (GET_GBUFFER_FLAG(GBUFFER_FLAG_HAS_PBR))
|
||||
if (GET_GBUFFER_FLAG(gb.gbufferFlag, GBUFFER_FLAG_HAS_PBR))
|
||||
{
|
||||
vec3 orm = spec.rgb;
|
||||
float perceptualRoughness = orm.g;
|
||||
float metallic = orm.b;
|
||||
float ao = orm.r;
|
||||
|
||||
vec3 irradiance = amblit_linear;
|
||||
|
||||
// PBR IBL
|
||||
float gloss = 1.0 - perceptualRoughness;
|
||||
|
||||
sampleReflectionProbes(irradiance, radiance, tc, pos.xyz, norm.xyz, gloss, false, amblit_linear);
|
||||
sampleReflectionProbes(irradiance, radiance, tc, pos.xyz, gb.normal, gloss, false, amblit_linear);
|
||||
|
||||
adjustIrradiance(irradiance, ambocc);
|
||||
|
||||
|
|
@ -187,17 +181,21 @@ void main()
|
|||
calcDiffuseSpecular(baseColor.rgb, metallic, diffuseColor, specularColor);
|
||||
|
||||
vec3 v = -normalize(pos.xyz);
|
||||
color = pbrBaseLight(diffuseColor, specularColor, metallic, v, norm.xyz, perceptualRoughness, light_dir, sunlit_linear, scol, radiance, irradiance, colorEmissive, ao, additive, atten);
|
||||
color = pbrBaseLight(diffuseColor, specularColor, metallic, v, gb.normal, perceptualRoughness, light_dir, sunlit_linear, scol, radiance, irradiance, colorEmissive, ao, additive, atten);
|
||||
}
|
||||
else if (GET_GBUFFER_FLAG(GBUFFER_FLAG_HAS_HDRI))
|
||||
else if (GET_GBUFFER_FLAG(gb.gbufferFlag, GBUFFER_FLAG_HAS_HDRI))
|
||||
{
|
||||
// actual HDRI sky, just copy color value
|
||||
color = colorEmissive.rgb;
|
||||
}
|
||||
else if (GET_GBUFFER_FLAG(GBUFFER_FLAG_SKIP_ATMOS))
|
||||
else if (GET_GBUFFER_FLAG(gb.gbufferFlag, GBUFFER_FLAG_SKIP_ATMOS))
|
||||
{
|
||||
//should only be true of WL sky, port over base color value and scale for fake HDR
|
||||
#if defined(HAS_EMISSIVE)
|
||||
color = colorEmissive.rgb;
|
||||
#else
|
||||
color = baseColor.rgb;
|
||||
#endif
|
||||
color = srgb_to_linear(color);
|
||||
color *= sky_hdr_scale;
|
||||
}
|
||||
|
|
@ -208,31 +206,43 @@ void main()
|
|||
|
||||
spec.rgb = srgb_to_linear(spec.rgb);
|
||||
|
||||
float da = clamp(dot(norm.xyz, light_dir.xyz), 0.0, 1.0);
|
||||
float da = clamp(dot(gb.normal, light_dir.xyz), 0.0, 1.0);
|
||||
|
||||
vec3 irradiance = vec3(0);
|
||||
vec3 irradiance = amblit;
|
||||
vec3 glossenv = vec3(0);
|
||||
vec3 legacyenv = vec3(0);
|
||||
|
||||
sampleReflectionProbesLegacy(irradiance, glossenv, legacyenv, tc, pos.xyz, norm.xyz, spec.a, envIntensity, false, amblit_linear);
|
||||
sampleReflectionProbesLegacy(irradiance, glossenv, legacyenv, tc, pos.xyz, gb.normal, spec.a, envIntensity, false, amblit_linear);
|
||||
|
||||
adjustIrradiance(irradiance, ambocc);
|
||||
|
||||
// apply lambertian IBL only (see pbrIbl)
|
||||
color.rgb = irradiance;
|
||||
|
||||
vec3 sun_contrib = min(da, scol) * sunlit_linear;
|
||||
color.rgb += sun_contrib;
|
||||
if (classic_mode > 0)
|
||||
{
|
||||
da = pow(da,1.2);
|
||||
vec3 sun_contrib = vec3(min(da, scol));
|
||||
|
||||
color.rgb = srgb_to_linear(color.rgb * 0.9 + linear_to_srgb(sun_contrib) * sunlit_linear * 0.7);
|
||||
sunlit_linear = srgb_to_linear(sunlit_linear);
|
||||
}
|
||||
else
|
||||
{
|
||||
vec3 sun_contrib = min(da, scol) * sunlit_linear;
|
||||
color.rgb += sun_contrib;
|
||||
}
|
||||
|
||||
color.rgb *= baseColor.rgb;
|
||||
|
||||
vec3 refnormpersp = reflect(pos.xyz, norm.xyz);
|
||||
vec3 refnormpersp = reflect(pos.xyz, gb.normal);
|
||||
|
||||
if (spec.a > 0.0)
|
||||
{
|
||||
vec3 lv = light_dir.xyz;
|
||||
vec3 h, l, v = -normalize(pos.xyz);
|
||||
float nh, nl, nv, vh, lightDist;
|
||||
vec3 n = norm.xyz;
|
||||
vec3 n = gb.normal;
|
||||
calcHalfVectors(lv, n, v, h, l, nh, nl, nv, vh, lightDist);
|
||||
|
||||
if (nl > 0.0 && nh > 0.0)
|
||||
|
|
@ -249,7 +259,7 @@ void main()
|
|||
}
|
||||
|
||||
// add radiance map
|
||||
applyGlossEnv(color, glossenv, spec, pos.xyz, norm.xyz);
|
||||
applyGlossEnv(color, glossenv, spec, pos.xyz, gb.normal);
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -257,10 +267,11 @@ void main()
|
|||
|
||||
if (envIntensity > 0.0)
|
||||
{ // add environment map
|
||||
applyLegacyEnv(color, legacyenv, spec, pos.xyz, norm.xyz, envIntensity);
|
||||
applyLegacyEnv(color, legacyenv, spec, pos.xyz, gb.normal, envIntensity);
|
||||
}
|
||||
}
|
||||
|
||||
//color.r = classic_mode > 0 ? 1.0 : 0.0;
|
||||
frag_color.rgb = max(color.rgb, vec3(0)); //output linear since local lights will be added to this shader's results
|
||||
frag_color.a = 0.0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -27,9 +27,6 @@
|
|||
|
||||
out vec4 frag_color;
|
||||
|
||||
uniform sampler2D diffuseRect;
|
||||
uniform sampler2D specularRect;
|
||||
uniform sampler2D emissiveRect; // PBR linear packed Occlusion, Roughness, Metal. See: pbropaqueF.glsl
|
||||
uniform samplerCube environmentMap;
|
||||
uniform sampler2D lightMap;
|
||||
uniform sampler2D lightFunc;
|
||||
|
|
@ -80,12 +77,17 @@ vec4 getPosition(vec2 pos_screen);
|
|||
|
||||
const float M_PI = 3.14159265;
|
||||
|
||||
vec3 pbrPunctual(vec3 diffuseColor, vec3 specularColor,
|
||||
void pbrPunctual(vec3 diffuseColor, vec3 specularColor,
|
||||
float perceptualRoughness,
|
||||
float metallic,
|
||||
vec3 n, // normal
|
||||
vec3 v, // surface point to camera
|
||||
vec3 l); //surface point to light
|
||||
vec3 l, // surface point to light
|
||||
out float nl,
|
||||
out vec3 diff,
|
||||
out vec3 spec);
|
||||
|
||||
GBufferInfo getGBuffer(vec2 screenpos);
|
||||
|
||||
void main()
|
||||
{
|
||||
|
|
@ -118,8 +120,9 @@ void main()
|
|||
shadow = clamp(shadow, 0.0, 1.0);
|
||||
}
|
||||
|
||||
vec4 norm = getNorm(tc);
|
||||
vec3 n = norm.xyz;
|
||||
GBufferInfo gb = getGBuffer(tc);
|
||||
|
||||
vec3 n = gb.normal;
|
||||
|
||||
float dist_atten = calcLegacyDistanceAttenuation(dist, falloff);
|
||||
if (dist_atten <= 0.0)
|
||||
|
|
@ -132,14 +135,14 @@ void main()
|
|||
float nh, nl, nv, vh, lightDist;
|
||||
calcHalfVectors(lv, n, v, h, l, nh, nl, nv, vh, lightDist);
|
||||
|
||||
vec3 diffuse = texture(diffuseRect, tc).rgb;
|
||||
vec4 spec = texture(specularRect, tc);
|
||||
vec3 diffuse = gb.albedo.rgb;
|
||||
vec4 spec = gb.specular;
|
||||
vec3 dlit = vec3(0, 0, 0);
|
||||
vec3 slit = vec3(0, 0, 0);
|
||||
|
||||
vec3 amb_rgb = vec3(0);
|
||||
|
||||
if (GET_GBUFFER_FLAG(GBUFFER_FLAG_HAS_PBR))
|
||||
if (GET_GBUFFER_FLAG(gb.gbufferFlag, GBUFFER_FLAG_HAS_PBR))
|
||||
{
|
||||
vec3 orm = spec.rgb;
|
||||
float perceptualRoughness = orm.g;
|
||||
|
|
@ -151,6 +154,8 @@ void main()
|
|||
diffuseColor *= 1.0 - metallic;
|
||||
|
||||
vec3 specularColor = mix(f0, baseColor.rgb, metallic);
|
||||
vec3 diffPunc = vec3(0);
|
||||
vec3 specPunc = vec3(0);
|
||||
|
||||
// We need this additional test inside a light's frustum since a spotlight's ambiance can be applied
|
||||
if (proj_tc.x > 0.0 && proj_tc.x < 1.0
|
||||
|
|
@ -168,16 +173,21 @@ void main()
|
|||
dlit = getProjectedLightDiffuseColor( l_dist, proj_tc.xy );
|
||||
|
||||
vec3 intensity = dist_atten * dlit * 3.25 * shadow; // Legacy attenuation, magic number to balance with legacy materials
|
||||
final_color += intensity*pbrPunctual(diffuseColor, specularColor, perceptualRoughness, metallic, n.xyz, v, lv);
|
||||
|
||||
pbrPunctual(diffuseColor, specularColor, perceptualRoughness, metallic, n.xyz, v, normalize(lv), nl, diffPunc, specPunc);
|
||||
|
||||
final_color += intensity * clamp(nl * (diffPunc + specPunc), vec3(0), vec3(10));
|
||||
}
|
||||
|
||||
amb_rgb = getProjectedLightAmbiance( amb_da, dist_atten, lit, nl, 1.0, proj_tc.xy ) * 3.25; //magic number to balance with legacy ambiance
|
||||
final_color += amb_rgb * pbrPunctual(diffuseColor, specularColor, perceptualRoughness, metallic, n.xyz, v, -lv);
|
||||
pbrPunctual(diffuseColor, specularColor, perceptualRoughness, metallic, n.xyz, v, normalize(lv), nl, diffPunc, specPunc);
|
||||
|
||||
final_color += amb_rgb * clamp(nl * (diffPunc + specPunc), vec3(0), vec3(10));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
float envIntensity = texture(emissiveRect, tc).r;
|
||||
float envIntensity = gb.envIntensity;
|
||||
|
||||
diffuse = srgb_to_linear(diffuse);
|
||||
spec.rgb = srgb_to_linear(spec.rgb);
|
||||
|
|
|
|||
|
|
@ -42,20 +42,25 @@ vec2 BRDF(float NoV, float roughness);
|
|||
|
||||
void calcDiffuseSpecular(vec3 baseColor, float metallic, inout vec3 diffuseColor, inout vec3 specularColor);
|
||||
|
||||
vec3 pbrIbl(vec3 diffuseColor,
|
||||
void pbrIbl(vec3 diffuseColor,
|
||||
vec3 specularColor,
|
||||
vec3 radiance, // radiance map sample
|
||||
vec3 irradiance, // irradiance map sample
|
||||
float ao, // ambient occlusion factor
|
||||
float nv, // normal dot view vector
|
||||
float perceptualRoughness);
|
||||
|
||||
vec3 pbrPunctual(vec3 diffuseColor, vec3 specularColor,
|
||||
float perceptualRoughness,
|
||||
float metallic,
|
||||
vec3 n, // normal
|
||||
vec3 v, // surface point to camera
|
||||
vec3 l); //surface point to light
|
||||
out vec3 diffuse,
|
||||
out vec3 specular);
|
||||
|
||||
void pbrPunctual(vec3 diffuseColor, vec3 specularColor,
|
||||
float perceptualRoughness,
|
||||
float metallic,
|
||||
vec3 n, // normal
|
||||
vec3 v, // surface point to camera
|
||||
vec3 l, // surface point to light
|
||||
out float nl,
|
||||
out vec3 diff,
|
||||
out vec3 spec);
|
||||
|
||||
vec3 pbrBaseLight(vec3 diffuseColor,
|
||||
vec3 specularColor,
|
||||
|
|
@ -257,13 +262,20 @@ void main()
|
|||
|
||||
float NdotV = clamp(abs(dot(norm, v)), 0.001, 1.0);
|
||||
|
||||
vec3 punctual = pbrPunctual(vec3(0), specularColor, 0.1, metallic, normalize(wavef+up*max(dist, 32.0)/32.0*(1.0-vdu)), v, normalize(light_dir));
|
||||
float nl = 0;
|
||||
vec3 diffPunc = vec3(0);
|
||||
vec3 specPunc = vec3(0);
|
||||
|
||||
pbrPunctual(vec3(0), specularColor, 0.1, metallic, normalize(wavef+up*max(dist, 32.0)/32.0*(1.0-vdu)), v, normalize(light_dir), nl, diffPunc, specPunc);
|
||||
|
||||
vec3 punctual = clamp(nl * (diffPunc + specPunc), vec3(0), vec3(10));
|
||||
|
||||
vec3 color = punctual * sunlit_linear * 2.75 * shadow;
|
||||
vec3 iblDiff;
|
||||
vec3 iblSpec;
|
||||
pbrIbl(vec3(0), vec3(1), radiance, vec3(0), ao, NdotV, 0.0, iblDiff, iblSpec);
|
||||
|
||||
vec3 ibl = pbrIbl(vec3(0), vec3(1), radiance, vec3(0), ao, NdotV, 0.0);
|
||||
|
||||
color += ibl;
|
||||
color += iblDiff + iblSpec;
|
||||
|
||||
float nv = clamp(abs(dot(norm.xyz, v)), 0.001, 1.0);
|
||||
vec2 brdf = BRDF(clamp(nv, 0, 1), 1.0);
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
version 64
|
||||
version 71
|
||||
// The version number above should be incremented IF AND ONLY IF some
|
||||
// change has been made that is sufficiently important to justify
|
||||
// resetting the graphics preferences of all users to the recommended
|
||||
|
|
@ -84,6 +84,9 @@ RenderCASSharpness 1 1
|
|||
RenderExposure 1 4
|
||||
RenderTonemapType 1 1
|
||||
RenderTonemapMix 1 1
|
||||
RenderEnableEmissiveBuffer 1 1
|
||||
RenderHDREnabled 1 1
|
||||
RenderVintageMode 1 1
|
||||
|
||||
//
|
||||
// Low Graphics Settings
|
||||
|
|
@ -100,7 +103,7 @@ RenderGlowResolutionPow 1 8
|
|||
RenderLocalLightCount 1 8
|
||||
RenderMaxPartCount 1 0
|
||||
RenderTransparentWater 1 0
|
||||
RenderReflectionsEnabled 1 1
|
||||
RenderReflectionsEnabled 1 0
|
||||
RenderReflectionProbeDetail 1 0
|
||||
RenderTerrainDetail 1 0
|
||||
RenderTerrainLODFactor 1 1
|
||||
|
|
@ -124,6 +127,9 @@ RenderCASSharpness 1 0
|
|||
RenderExposure 1 1
|
||||
RenderTonemapType 1 1
|
||||
RenderTonemapMix 1 0.7
|
||||
RenderEnableEmissiveBuffer 1 0
|
||||
RenderHDREnabled 1 0
|
||||
RenderVintageMode 1 1
|
||||
|
||||
//
|
||||
// Medium Low Graphics Settings
|
||||
|
|
@ -164,6 +170,9 @@ RenderCASSharpness 1 0
|
|||
RenderExposure 1 1
|
||||
RenderTonemapType 1 1
|
||||
RenderTonemapMix 1 0.7
|
||||
RenderEnableEmissiveBuffer 1 1
|
||||
RenderHDREnabled 1 1
|
||||
RenderVintageMode 1 0
|
||||
|
||||
//
|
||||
// Medium Graphics Settings (standard)
|
||||
|
|
@ -204,6 +213,9 @@ RenderCASSharpness 1 0
|
|||
RenderExposure 1 1
|
||||
RenderTonemapType 1 1
|
||||
RenderTonemapMix 1 0.7
|
||||
RenderEnableEmissiveBuffer 1 1
|
||||
RenderHDREnabled 1 1
|
||||
RenderVintageMode 1 0
|
||||
|
||||
//
|
||||
// Medium High Graphics Settings
|
||||
|
|
@ -244,6 +256,9 @@ RenderCASSharpness 1 0
|
|||
RenderExposure 1 1
|
||||
RenderTonemapType 1 1
|
||||
RenderTonemapMix 1 0.7
|
||||
RenderEnableEmissiveBuffer 1 1
|
||||
RenderHDREnabled 1 1
|
||||
RenderVintageMode 1 0
|
||||
|
||||
//
|
||||
// High Graphics Settings (SSAO + sun shadows)
|
||||
|
|
@ -284,6 +299,9 @@ RenderCASSharpness 1 0.4
|
|||
RenderExposure 1 1
|
||||
RenderTonemapType 1 1
|
||||
RenderTonemapMix 1 0.7
|
||||
RenderEnableEmissiveBuffer 1 1
|
||||
RenderHDREnabled 1 1
|
||||
RenderVintageMode 1 0
|
||||
|
||||
//
|
||||
// High Ultra Graphics Settings (deferred + SSAO + all shadows)
|
||||
|
|
@ -324,6 +342,9 @@ RenderCASSharpness 1 0.4
|
|||
RenderExposure 1 1
|
||||
RenderTonemapType 1 1
|
||||
RenderTonemapMix 1 0.7
|
||||
RenderEnableEmissiveBuffer 1 1
|
||||
RenderHDREnabled 1 1
|
||||
RenderVintageMode 1 0
|
||||
|
||||
//
|
||||
// Ultra graphics (REALLY PURTY!)
|
||||
|
|
@ -364,6 +385,9 @@ RenderCASSharpness 1 0.4
|
|||
RenderExposure 1 1
|
||||
RenderTonemapType 1 1
|
||||
RenderTonemapMix 1 0.7
|
||||
RenderEnableEmissiveBuffer 1 1
|
||||
RenderHDREnabled 1 1
|
||||
RenderVintageMode 1 0
|
||||
|
||||
//
|
||||
// Class Unknown Hardware (unknown)
|
||||
|
|
@ -372,6 +396,8 @@ list Unknown
|
|||
RenderShadowDetail 1 0
|
||||
RenderDeferredSSAO 1 0
|
||||
RenderMirrors 1 0
|
||||
RenderEnableEmissiveBuffer 1 0
|
||||
RenderVintageMode 1 1
|
||||
|
||||
//
|
||||
// VRAM > 512MB
|
||||
|
|
@ -394,6 +420,7 @@ RenderDeferredSSAO 0 0
|
|||
RenderShadowDetail 0 0
|
||||
RenderReflectionProbeDetail 0 -1
|
||||
RenderMirrors 0 0
|
||||
RenderVintageMode 1 1
|
||||
|
||||
list Intel
|
||||
RenderAnisotropic 1 0
|
||||
|
|
@ -412,6 +439,11 @@ RenderFSAASamples 0 0
|
|||
RenderReflectionsEnabled 0 0
|
||||
RenderReflectionProbeDetail 0 0
|
||||
RenderMirrors 0 0
|
||||
RenderEnableEmissiveBuffer 1 0
|
||||
RenderGLMultiThreadedTextures 0 0
|
||||
RenderGLMultiThreadedMedia 0 0
|
||||
RenderHDREnabled 1 0
|
||||
RenderVintageMode 1 1
|
||||
|
||||
list TexUnit16orLess
|
||||
RenderTerrainPBRDetail 1 -1
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
version 63
|
||||
version 65
|
||||
// The version number above should be incremented IF AND ONLY IF some
|
||||
// change has been made that is sufficiently important to justify
|
||||
// resetting the graphics preferences of all users to the recommended
|
||||
|
|
@ -83,6 +83,7 @@ RenderCASSharpness 1 1
|
|||
RenderExposure 1 1
|
||||
RenderTonemapType 1 1
|
||||
RenderTonemapMix 1 1
|
||||
RenderVintageMode 1 1
|
||||
|
||||
//
|
||||
// Low Graphics Settings
|
||||
|
|
@ -123,6 +124,7 @@ RenderCASSharpness 1 0
|
|||
RenderExposure 1 1
|
||||
RenderTonemapType 1 1
|
||||
RenderTonemapMix 1 0.7
|
||||
RenderVintageMode 1 1
|
||||
|
||||
//
|
||||
// Medium Low Graphics Settings
|
||||
|
|
@ -163,6 +165,7 @@ RenderCASSharpness 1 0
|
|||
RenderExposure 1 1
|
||||
RenderTonemapType 1 1
|
||||
RenderTonemapMix 1 0.7
|
||||
RenderVintageMode 1 0
|
||||
|
||||
//
|
||||
// Medium Graphics Settings (standard)
|
||||
|
|
@ -203,6 +206,7 @@ RenderCASSharpness 1 0
|
|||
RenderExposure 1 1
|
||||
RenderTonemapType 1 1
|
||||
RenderTonemapMix 1 0.7
|
||||
RenderVintageMode 1 0
|
||||
|
||||
//
|
||||
// Medium High Graphics Settings
|
||||
|
|
@ -243,6 +247,7 @@ RenderCASSharpness 1 0
|
|||
RenderExposure 1 1
|
||||
RenderTonemapType 1 1
|
||||
RenderTonemapMix 1 0.7
|
||||
RenderVintageMode 1 0
|
||||
|
||||
//
|
||||
// High Graphics Settings (SSAO + sun shadows)
|
||||
|
|
@ -283,6 +288,7 @@ RenderCASSharpness 1 0
|
|||
RenderExposure 1 1
|
||||
RenderTonemapType 1 1
|
||||
RenderTonemapMix 1 0.7
|
||||
RenderVintageMode 1 0
|
||||
|
||||
//
|
||||
// High Ultra Graphics Settings (SSAO + all shadows)
|
||||
|
|
@ -323,6 +329,7 @@ RenderCASSharpness 1 0.4
|
|||
RenderExposure 1 1
|
||||
RenderTonemapType 1 1
|
||||
RenderTonemapMix 1 0.7
|
||||
RenderVintageMode 1 0
|
||||
|
||||
//
|
||||
// Ultra graphics (REALLY PURTY!)
|
||||
|
|
@ -363,6 +370,7 @@ RenderCASSharpness 1 0.4
|
|||
RenderExposure 1 1
|
||||
RenderTonemapType 1 1
|
||||
RenderTonemapMix 1 0.7
|
||||
RenderVintageMode 1 0
|
||||
|
||||
//
|
||||
// Class Unknown Hardware (unknown)
|
||||
|
|
@ -371,6 +379,7 @@ list Unknown
|
|||
RenderShadowDetail 1 0
|
||||
RenderDeferredSSAO 1 0
|
||||
RenderMirrors 1 0
|
||||
RenderVintageMode 1 1
|
||||
|
||||
|
||||
//
|
||||
|
|
@ -392,6 +401,7 @@ RenderTerrainDetail 1 0
|
|||
RenderDeferredSSAO 0 0
|
||||
RenderShadowDetail 0 0
|
||||
RenderMirrors 0 0
|
||||
RenderVintageMode 1 1
|
||||
|
||||
list TexUnit8orLess
|
||||
RenderDeferredSSAO 0 0
|
||||
|
|
@ -420,3 +430,4 @@ RenderFSAASamples 0 0
|
|||
RenderReflectionProbeDetail 0 0
|
||||
RenderReflectionsEnabled 0 0
|
||||
RenderMirrors 0 0
|
||||
RenderVintageMode 1 1
|
||||
|
|
|
|||
|
|
@ -816,7 +816,7 @@ const F64Seconds LLEnvironment::TRANSITION_ALTITUDE(5.0f);
|
|||
|
||||
const LLUUID LLEnvironment::KNOWN_SKY_SUNRISE("01e41537-ff51-2f1f-8ef7-17e4df760bfb");
|
||||
const LLUUID LLEnvironment::KNOWN_SKY_MIDDAY("c46226b4-0e43-5a56-9708-d27ca1df3292");
|
||||
const LLUUID LLEnvironment::KNOWN_SKY_LEGACY_MIDDAY("cef49723-0292-af49-9b14-9598a616b8a3");
|
||||
const LLUUID LLEnvironment::KNOWN_SKY_LEGACY_MIDDAY("6c83e853-e7f8-cad7-8ee6-5f31c453721c");
|
||||
const LLUUID LLEnvironment::KNOWN_SKY_SUNSET("084e26cd-a900-28e8-08d0-64a9de5c15e2");
|
||||
const LLUUID LLEnvironment::KNOWN_SKY_MIDNIGHT("8a01b97a-cb20-c1ea-ac63-f7ea84ad0090");
|
||||
|
||||
|
|
|
|||
|
|
@ -705,6 +705,10 @@ void LLFeatureManager::applyBaseMasks()
|
|||
if (gGLManager.mGLVersion < 3.99f)
|
||||
{
|
||||
maskFeatures("GL3");
|
||||
|
||||
// make sure to disable background context activity in GL3 mode
|
||||
LLImageGLThread::sEnabledMedia = false;
|
||||
LLImageGLThread::sEnabledTextures = false;
|
||||
}
|
||||
|
||||
// now mask by gpu string
|
||||
|
|
|
|||
|
|
@ -318,6 +318,18 @@ void LLFloaterPreferenceGraphicsAdvanced::disableUnavailableSettings()
|
|||
ctrl_shadows->setValue(0);
|
||||
shadows_text->setEnabled(false);
|
||||
}
|
||||
|
||||
// Vintage mode
|
||||
LLCachedControl<bool> is_vintage(gSavedSettings, "RenderVintageMode");
|
||||
LLSliderCtrl* tonemapMix = getChild<LLSliderCtrl>("TonemapMix");
|
||||
LLComboBox* tonemapSelect = getChild<LLComboBox>("TonemapType");
|
||||
LLTextBox* tonemapLabel = getChild<LLTextBox>("TonemapTypeText");
|
||||
LLSliderCtrl* exposureSlider = getChild<LLSliderCtrl>("RenderExposure");
|
||||
|
||||
tonemapSelect->setEnabled(!is_vintage);
|
||||
tonemapLabel->setEnabled(!is_vintage);
|
||||
tonemapMix->setEnabled(!is_vintage);
|
||||
exposureSlider->setEnabled(!is_vintage);
|
||||
}
|
||||
|
||||
void LLFloaterPreferenceGraphicsAdvanced::refreshEnabledState()
|
||||
|
|
|
|||
|
|
@ -463,7 +463,7 @@ void LLReflectionMapManager::update()
|
|||
|
||||
LLReflectionMap* LLReflectionMapManager::addProbe(LLSpatialGroup* group)
|
||||
{
|
||||
if (gGLManager.mGLVersion < 4.05f)
|
||||
if (gGLManager.mGLVersion < 4.05f || !LLPipeline::sReflectionProbesEnabled)
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
|
@ -579,6 +579,11 @@ LLReflectionMap* LLReflectionMapManager::registerSpatialGroup(LLSpatialGroup* gr
|
|||
|
||||
LLReflectionMap* LLReflectionMapManager::registerViewerObject(LLViewerObject* vobj)
|
||||
{
|
||||
if (!LLPipeline::sReflectionProbesEnabled)
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
llassert(vobj != nullptr);
|
||||
|
||||
LLReflectionMap* probe = new LLReflectionMap();
|
||||
|
|
|
|||
|
|
@ -794,6 +794,7 @@ void LLSettingsVOSky::applySpecial(void *ptarget, bool force)
|
|||
|
||||
F32 g = getGamma();
|
||||
|
||||
static LLCachedControl<bool> hdr(gSavedSettings, "RenderHDREnabled");
|
||||
static LLCachedControl<bool> should_auto_adjust(gSavedSettings, "RenderSkyAutoAdjustLegacy", true);
|
||||
static LLCachedControl<F32> auto_adjust_ambient_scale(gSavedSettings, "RenderSkyAutoAdjustAmbientScale", 0.75f);
|
||||
static LLCachedControl<F32> auto_adjust_hdr_scale(gSavedSettings, "RenderSkyAutoAdjustHDRScale", 2.f);
|
||||
|
|
@ -801,10 +802,15 @@ void LLSettingsVOSky::applySpecial(void *ptarget, bool force)
|
|||
static LLCachedControl<F32> auto_adjust_blue_density_scale(gSavedSettings, "RenderSkyAutoAdjustBlueDensityScale", 1.f);
|
||||
static LLCachedControl<F32> auto_adjust_sun_color_scale(gSavedSettings, "RenderSkyAutoAdjustSunColorScale", 1.f);
|
||||
static LLCachedControl<F32> sunlight_scale(gSavedSettings, "RenderSkySunlightScale", 1.5f);
|
||||
static LLCachedControl<F32> sunlight_hdr_scale(gSavedSettings, "RenderHDRSkySunlightScale", 1.5f);
|
||||
static LLCachedControl<F32> ambient_scale(gSavedSettings, "RenderSkyAmbientScale", 1.5f);
|
||||
|
||||
shader->uniform1f(LLShaderMgr::SKY_SUNLIGHT_SCALE, sunlight_scale);
|
||||
// sky is a "classic" sky following pre SL 7.0 shading
|
||||
bool classic_mode = psky->canAutoAdjust();
|
||||
|
||||
shader->uniform1f(LLShaderMgr::SKY_SUNLIGHT_SCALE, hdr ? sunlight_hdr_scale : sunlight_scale);
|
||||
shader->uniform1f(LLShaderMgr::SKY_AMBIENT_SCALE, ambient_scale);
|
||||
shader->uniform1i(LLShaderMgr::CLASSIC_MODE, classic_mode);
|
||||
|
||||
F32 probe_ambiance = getReflectionProbeAmbiance();
|
||||
|
||||
|
|
|
|||
|
|
@ -243,6 +243,23 @@ static bool handleReleaseGLBufferChanged(const LLSD& newvalue)
|
|||
return true;
|
||||
}
|
||||
|
||||
static bool handleEnableEmissiveChanged(const LLSD& newvalue)
|
||||
{
|
||||
return handleReleaseGLBufferChanged(newvalue) && handleSetShaderChanged(newvalue);
|
||||
}
|
||||
|
||||
static bool handleEnableClassicMode(const LLSD& newvalue)
|
||||
{
|
||||
gSavedSettings.setBOOL("RenderEnableEmissiveBuffer", !newvalue.asBoolean());
|
||||
gSavedSettings.setBOOL("RenderHDREnabled", !newvalue.asBoolean());
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool handleEnableHDR(const LLSD& newvalue)
|
||||
{
|
||||
return handleReleaseGLBufferChanged(newvalue) && handleSetShaderChanged(newvalue);
|
||||
}
|
||||
|
||||
static bool handleLUTBufferChanged(const LLSD& newvalue)
|
||||
{
|
||||
if (gPipeline.isInit())
|
||||
|
|
@ -780,6 +797,9 @@ void settings_setup_listeners()
|
|||
setting_setup_signal_listener(gSavedSettings, "RenderGlow", handleSetShaderChanged);
|
||||
setting_setup_signal_listener(gSavedSettings, "RenderGlowResolutionPow", handleReleaseGLBufferChanged);
|
||||
setting_setup_signal_listener(gSavedSettings, "RenderGlowHDR", handleReleaseGLBufferChanged);
|
||||
setting_setup_signal_listener(gSavedSettings, "RenderEnableEmissiveBuffer", handleEnableEmissiveChanged);
|
||||
setting_setup_signal_listener(gSavedSettings, "RenderVintageMode", handleEnableClassicMode);
|
||||
setting_setup_signal_listener(gSavedSettings, "RenderHDREnabled", handleEnableHDR);
|
||||
setting_setup_signal_listener(gSavedSettings, "RenderGlowNoise", handleSetShaderChanged);
|
||||
setting_setup_signal_listener(gSavedSettings, "RenderGammaFull", handleSetShaderChanged);
|
||||
setting_setup_signal_listener(gSavedSettings, "RenderVolumeLODFactor", handleVolumeLODChanged);
|
||||
|
|
|
|||
|
|
@ -957,30 +957,17 @@ void display(bool rebuild, F32 zoom_factor, int subfield, bool for_snapshot)
|
|||
|
||||
gGL.setColorMask(true, true);
|
||||
|
||||
if (LLPipeline::sRenderDeferred)
|
||||
gPipeline.mRT->deferredScreen.bindTarget();
|
||||
if (gUseWireframe)
|
||||
{
|
||||
gPipeline.mRT->deferredScreen.bindTarget();
|
||||
if (gUseWireframe)
|
||||
{
|
||||
F32 g = 0.5f;
|
||||
glClearColor(g, g, g, 1.f);
|
||||
}
|
||||
else
|
||||
{
|
||||
glClearColor(1, 0, 1, 1);
|
||||
}
|
||||
gPipeline.mRT->deferredScreen.clear();
|
||||
F32 g = 0.5f;
|
||||
glClearColor(g, g, g, 1.f);
|
||||
}
|
||||
else
|
||||
{
|
||||
gPipeline.mRT->screen.bindTarget();
|
||||
if (LLPipeline::sUnderWaterRender && !gPipeline.canUseWindLightShaders())
|
||||
{
|
||||
const LLColor4 &col = LLEnvironment::instance().getCurrentWater()->getWaterFogColor();
|
||||
glClearColor(col.mV[0], col.mV[1], col.mV[2], 0.f);
|
||||
}
|
||||
gPipeline.mRT->screen.clear();
|
||||
glClearColor(1, 0, 1, 1);
|
||||
}
|
||||
gPipeline.mRT->deferredScreen.clear();
|
||||
|
||||
gGL.setColorMask(true, false);
|
||||
|
||||
|
|
|
|||
|
|
@ -256,6 +256,16 @@ static bool make_rigged_variant(LLGLSLShader& shader, LLGLSLShader& riggedShader
|
|||
return riggedShader.createShader();
|
||||
}
|
||||
|
||||
static void add_common_permutations(LLGLSLShader* shader)
|
||||
{
|
||||
LLCachedControl<bool> emissive(gSavedSettings, "RenderEnableEmissiveBuffer", false);
|
||||
|
||||
if (emissive)
|
||||
{
|
||||
shader->addPermutation("HAS_EMISSIVE", "1");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static bool make_gltf_variant(LLGLSLShader& shader, LLGLSLShader& variant, bool alpha_blend, bool rigged, bool unlit, bool multi_uv, bool use_sun_shadow)
|
||||
{
|
||||
|
|
@ -772,6 +782,13 @@ std::string LLViewerShaderMgr::loadBasicShaders()
|
|||
attribs["MAX_JOINTS_PER_MESH_OBJECT"] =
|
||||
std::to_string(LLSkinningUtil::getMaxJointCount());
|
||||
|
||||
LLCachedControl<bool> emissive(gSavedSettings, "RenderEnableEmissiveBuffer", false);
|
||||
|
||||
if (emissive)
|
||||
{
|
||||
attribs["HAS_EMISSIVE"] = "1";
|
||||
}
|
||||
|
||||
bool ssr = gSavedSettings.getBOOL("RenderScreenSpaceReflections");
|
||||
|
||||
bool mirrors = gSavedSettings.getBOOL("RenderMirrors");
|
||||
|
|
@ -852,6 +869,7 @@ std::string LLViewerShaderMgr::loadBasicShaders()
|
|||
index_channels.push_back(-1); shaders.push_back( make_pair( "environment/waterFogF.glsl", mShaderLevel[SHADER_WATER] ) );
|
||||
index_channels.push_back(-1); shaders.push_back( make_pair( "environment/srgbF.glsl", mShaderLevel[SHADER_ENVIRONMENT] ) );
|
||||
index_channels.push_back(-1); shaders.push_back( make_pair( "deferred/deferredUtil.glsl", 1) );
|
||||
index_channels.push_back(-1); shaders.push_back( make_pair( "deferred/gbufferUtil.glsl", 1) );
|
||||
index_channels.push_back(-1); shaders.push_back( make_pair( "deferred/globalF.glsl", 1));
|
||||
index_channels.push_back(-1); shaders.push_back( make_pair( "deferred/shadowUtil.glsl", 1) );
|
||||
index_channels.push_back(-1); shaders.push_back( make_pair( "deferred/aoUtil.glsl", 1) );
|
||||
|
|
@ -1175,6 +1193,7 @@ bool LLViewerShaderMgr::loadShadersDeferred()
|
|||
gDeferredHighlightProgram.mShaderFiles.push_back(make_pair("interface/highlightV.glsl", GL_VERTEX_SHADER));
|
||||
gDeferredHighlightProgram.mShaderFiles.push_back(make_pair("deferred/highlightF.glsl", GL_FRAGMENT_SHADER));
|
||||
gDeferredHighlightProgram.mShaderLevel = mShaderLevel[SHADER_INTERFACE];
|
||||
add_common_permutations(&gDeferredHighlightProgram);
|
||||
success = gDeferredHighlightProgram.createShader();
|
||||
}
|
||||
|
||||
|
|
@ -1187,6 +1206,7 @@ bool LLViewerShaderMgr::loadShadersDeferred()
|
|||
gDeferredDiffuseProgram.mShaderFiles.push_back(make_pair("deferred/diffuseIndexedF.glsl", GL_FRAGMENT_SHADER));
|
||||
gDeferredDiffuseProgram.mFeatures.mIndexedTextureChannels = LLGLSLShader::sIndexedTextureChannels;
|
||||
gDeferredDiffuseProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED];
|
||||
add_common_permutations(&gDeferredDiffuseProgram);
|
||||
success = make_rigged_variant(gDeferredDiffuseProgram, gDeferredSkinnedDiffuseProgram);
|
||||
success = success && gDeferredDiffuseProgram.createShader();
|
||||
}
|
||||
|
|
@ -1199,6 +1219,7 @@ bool LLViewerShaderMgr::loadShadersDeferred()
|
|||
gDeferredDiffuseAlphaMaskProgram.mShaderFiles.push_back(make_pair("deferred/diffuseAlphaMaskIndexedF.glsl", GL_FRAGMENT_SHADER));
|
||||
gDeferredDiffuseAlphaMaskProgram.mFeatures.mIndexedTextureChannels = LLGLSLShader::sIndexedTextureChannels;
|
||||
gDeferredDiffuseAlphaMaskProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED];
|
||||
add_common_permutations(&gDeferredDiffuseAlphaMaskProgram);
|
||||
success = make_rigged_variant(gDeferredDiffuseAlphaMaskProgram, gDeferredSkinnedDiffuseAlphaMaskProgram);
|
||||
success = success && gDeferredDiffuseAlphaMaskProgram.createShader();
|
||||
}
|
||||
|
|
@ -1210,6 +1231,7 @@ bool LLViewerShaderMgr::loadShadersDeferred()
|
|||
gDeferredNonIndexedDiffuseAlphaMaskProgram.mShaderFiles.push_back(make_pair("deferred/diffuseV.glsl", GL_VERTEX_SHADER));
|
||||
gDeferredNonIndexedDiffuseAlphaMaskProgram.mShaderFiles.push_back(make_pair("deferred/diffuseAlphaMaskF.glsl", GL_FRAGMENT_SHADER));
|
||||
gDeferredNonIndexedDiffuseAlphaMaskProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED];
|
||||
add_common_permutations(&gDeferredNonIndexedDiffuseAlphaMaskProgram);
|
||||
success = gDeferredNonIndexedDiffuseAlphaMaskProgram.createShader();
|
||||
llassert(success);
|
||||
}
|
||||
|
|
@ -1221,6 +1243,7 @@ bool LLViewerShaderMgr::loadShadersDeferred()
|
|||
gDeferredNonIndexedDiffuseAlphaMaskNoColorProgram.mShaderFiles.push_back(make_pair("deferred/diffuseNoColorV.glsl", GL_VERTEX_SHADER));
|
||||
gDeferredNonIndexedDiffuseAlphaMaskNoColorProgram.mShaderFiles.push_back(make_pair("deferred/diffuseAlphaMaskNoColorF.glsl", GL_FRAGMENT_SHADER));
|
||||
gDeferredNonIndexedDiffuseAlphaMaskNoColorProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED];
|
||||
add_common_permutations(&gDeferredNonIndexedDiffuseAlphaMaskNoColorProgram);
|
||||
success = gDeferredNonIndexedDiffuseAlphaMaskNoColorProgram.createShader();
|
||||
llassert(success);
|
||||
}
|
||||
|
|
@ -1232,6 +1255,7 @@ bool LLViewerShaderMgr::loadShadersDeferred()
|
|||
gDeferredBumpProgram.mShaderFiles.push_back(make_pair("deferred/bumpV.glsl", GL_VERTEX_SHADER));
|
||||
gDeferredBumpProgram.mShaderFiles.push_back(make_pair("deferred/bumpF.glsl", GL_FRAGMENT_SHADER));
|
||||
gDeferredBumpProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED];
|
||||
add_common_permutations(&gDeferredBumpProgram);
|
||||
success = make_rigged_variant(gDeferredBumpProgram, gDeferredSkinnedBumpProgram);
|
||||
success = success && gDeferredBumpProgram.createShader();
|
||||
llassert(success);
|
||||
|
|
@ -1297,6 +1321,7 @@ bool LLViewerShaderMgr::loadShadersDeferred()
|
|||
gDeferredMaterialProgram[i].addPermutation("HAS_SUN_SHADOW", "1");
|
||||
}
|
||||
|
||||
add_common_permutations(&gDeferredMaterialProgram[i]);
|
||||
|
||||
gDeferredMaterialProgram[i].mFeatures.hasSrgb = true;
|
||||
gDeferredMaterialProgram[i].mFeatures.calculatesAtmospherics = true;
|
||||
|
|
@ -1340,6 +1365,8 @@ bool LLViewerShaderMgr::loadShadersDeferred()
|
|||
gDeferredPBROpaqueProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED];
|
||||
gDeferredPBROpaqueProgram.clearPermutations();
|
||||
|
||||
add_common_permutations(&gDeferredPBROpaqueProgram);
|
||||
|
||||
success = make_rigged_variant(gDeferredPBROpaqueProgram, gDeferredSkinnedPBROpaqueProgram);
|
||||
if (success)
|
||||
{
|
||||
|
|
@ -1361,6 +1388,8 @@ bool LLViewerShaderMgr::loadShadersDeferred()
|
|||
gGLTFPBRMetallicRoughnessProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED];
|
||||
gGLTFPBRMetallicRoughnessProgram.clearPermutations();
|
||||
|
||||
add_common_permutations(&gGLTFPBRMetallicRoughnessProgram);
|
||||
|
||||
success = make_gltf_variants(gGLTFPBRMetallicRoughnessProgram, use_sun_shadow);
|
||||
|
||||
//llassert(success);
|
||||
|
|
@ -1383,6 +1412,8 @@ bool LLViewerShaderMgr::loadShadersDeferred()
|
|||
gPBRGlowProgram.mShaderFiles.push_back(make_pair("deferred/pbrglowF.glsl", GL_FRAGMENT_SHADER));
|
||||
gPBRGlowProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED];
|
||||
|
||||
add_common_permutations(&gPBRGlowProgram);
|
||||
|
||||
success = make_rigged_variant(gPBRGlowProgram, gPBRGlowSkinnedProgram);
|
||||
if (success)
|
||||
{
|
||||
|
|
@ -1402,13 +1433,13 @@ bool LLViewerShaderMgr::loadShadersDeferred()
|
|||
gHUDPBROpaqueProgram.clearPermutations();
|
||||
gHUDPBROpaqueProgram.addPermutation("IS_HUD", "1");
|
||||
|
||||
add_common_permutations(&gHUDPBROpaqueProgram);
|
||||
|
||||
success = gHUDPBROpaqueProgram.createShader();
|
||||
|
||||
llassert(success);
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (success)
|
||||
{
|
||||
LLGLSLShader* shader = &gDeferredPBRAlphaProgram;
|
||||
|
|
@ -1438,6 +1469,8 @@ bool LLViewerShaderMgr::loadShadersDeferred()
|
|||
shader->addPermutation("HAS_EMISSIVE_MAP", "1");
|
||||
shader->addPermutation("USE_VERTEX_COLOR", "1");
|
||||
|
||||
add_common_permutations(shader);
|
||||
|
||||
if (use_sun_shadow)
|
||||
{
|
||||
shader->addPermutation("HAS_SUN_SHADOW", "1");
|
||||
|
|
@ -1475,6 +1508,8 @@ bool LLViewerShaderMgr::loadShadersDeferred()
|
|||
|
||||
shader->addPermutation("IS_HUD", "1");
|
||||
|
||||
add_common_permutations(shader);
|
||||
|
||||
shader->mShaderLevel = mShaderLevel[SHADER_DEFERRED];
|
||||
success = shader->createShader();
|
||||
llassert(success);
|
||||
|
|
@ -1507,6 +1542,9 @@ bool LLViewerShaderMgr::loadShadersDeferred()
|
|||
shader->addPermutation("TERRAIN_PBR_DETAIL", llformat("%d", detail));
|
||||
shader->addPermutation("TERRAIN_PAINT_TYPE", llformat("%d", paint_type));
|
||||
shader->addPermutation("TERRAIN_PLANAR_TEXTURE_SAMPLE_COUNT", llformat("%d", mapping));
|
||||
|
||||
add_common_permutations(shader);
|
||||
|
||||
success = success && shader->createShader();
|
||||
llassert(success);
|
||||
}
|
||||
|
|
@ -1519,6 +1557,9 @@ bool LLViewerShaderMgr::loadShadersDeferred()
|
|||
gDeferredTreeProgram.mShaderFiles.push_back(make_pair("deferred/treeV.glsl", GL_VERTEX_SHADER));
|
||||
gDeferredTreeProgram.mShaderFiles.push_back(make_pair("deferred/treeF.glsl", GL_FRAGMENT_SHADER));
|
||||
gDeferredTreeProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED];
|
||||
|
||||
add_common_permutations(&gDeferredTreeProgram);
|
||||
|
||||
success = gDeferredTreeProgram.createShader();
|
||||
}
|
||||
|
||||
|
|
@ -1554,6 +1595,9 @@ bool LLViewerShaderMgr::loadShadersDeferred()
|
|||
gDeferredImpostorProgram.mShaderFiles.push_back(make_pair("deferred/impostorV.glsl", GL_VERTEX_SHADER));
|
||||
gDeferredImpostorProgram.mShaderFiles.push_back(make_pair("deferred/impostorF.glsl", GL_FRAGMENT_SHADER));
|
||||
gDeferredImpostorProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED];
|
||||
|
||||
add_common_permutations(&gDeferredImpostorProgram);
|
||||
|
||||
success = gDeferredImpostorProgram.createShader();
|
||||
llassert(success);
|
||||
}
|
||||
|
|
@ -1562,6 +1606,7 @@ bool LLViewerShaderMgr::loadShadersDeferred()
|
|||
{
|
||||
gDeferredLightProgram.mName = "Deferred Light Shader";
|
||||
gDeferredLightProgram.mFeatures.isDeferred = true;
|
||||
gDeferredLightProgram.mFeatures.hasFullGBuffer = true;
|
||||
gDeferredLightProgram.mFeatures.hasShadows = true;
|
||||
gDeferredLightProgram.mFeatures.hasSrgb = true;
|
||||
|
||||
|
|
@ -1572,6 +1617,8 @@ bool LLViewerShaderMgr::loadShadersDeferred()
|
|||
|
||||
gDeferredLightProgram.clearPermutations();
|
||||
|
||||
add_common_permutations(&gDeferredLightProgram);
|
||||
|
||||
success = gDeferredLightProgram.createShader();
|
||||
llassert(success);
|
||||
}
|
||||
|
|
@ -1582,6 +1629,7 @@ bool LLViewerShaderMgr::loadShadersDeferred()
|
|||
{
|
||||
gDeferredMultiLightProgram[i].mName = llformat("Deferred MultiLight Shader %d", i);
|
||||
gDeferredMultiLightProgram[i].mFeatures.isDeferred = true;
|
||||
gDeferredMultiLightProgram[i].mFeatures.hasFullGBuffer = true;
|
||||
gDeferredMultiLightProgram[i].mFeatures.hasShadows = true;
|
||||
gDeferredMultiLightProgram[i].mFeatures.hasSrgb = true;
|
||||
|
||||
|
|
@ -1592,6 +1640,8 @@ bool LLViewerShaderMgr::loadShadersDeferred()
|
|||
gDeferredMultiLightProgram[i].mShaderLevel = mShaderLevel[SHADER_DEFERRED];
|
||||
gDeferredMultiLightProgram[i].addPermutation("LIGHT_COUNT", llformat("%d", i+1));
|
||||
|
||||
add_common_permutations(&gDeferredMultiLightProgram[i]);
|
||||
|
||||
success = gDeferredMultiLightProgram[i].createShader();
|
||||
llassert(success);
|
||||
}
|
||||
|
|
@ -1603,6 +1653,7 @@ bool LLViewerShaderMgr::loadShadersDeferred()
|
|||
gDeferredSpotLightProgram.mShaderFiles.clear();
|
||||
gDeferredSpotLightProgram.mFeatures.hasSrgb = true;
|
||||
gDeferredSpotLightProgram.mFeatures.isDeferred = true;
|
||||
gDeferredSpotLightProgram.mFeatures.hasFullGBuffer = true;
|
||||
gDeferredSpotLightProgram.mFeatures.hasShadows = true;
|
||||
|
||||
gDeferredSpotLightProgram.clearPermutations();
|
||||
|
|
@ -1610,6 +1661,8 @@ bool LLViewerShaderMgr::loadShadersDeferred()
|
|||
gDeferredSpotLightProgram.mShaderFiles.push_back(make_pair("deferred/spotLightF.glsl", GL_FRAGMENT_SHADER));
|
||||
gDeferredSpotLightProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED];
|
||||
|
||||
add_common_permutations(&gDeferredSpotLightProgram);
|
||||
|
||||
success = gDeferredSpotLightProgram.createShader();
|
||||
llassert(success);
|
||||
}
|
||||
|
|
@ -1619,6 +1672,7 @@ bool LLViewerShaderMgr::loadShadersDeferred()
|
|||
gDeferredMultiSpotLightProgram.mName = "Deferred MultiSpotLight Shader";
|
||||
gDeferredMultiSpotLightProgram.mFeatures.hasSrgb = true;
|
||||
gDeferredMultiSpotLightProgram.mFeatures.isDeferred = true;
|
||||
gDeferredMultiSpotLightProgram.mFeatures.hasFullGBuffer = true;
|
||||
gDeferredMultiSpotLightProgram.mFeatures.hasShadows = true;
|
||||
|
||||
gDeferredMultiSpotLightProgram.clearPermutations();
|
||||
|
|
@ -1628,6 +1682,8 @@ bool LLViewerShaderMgr::loadShadersDeferred()
|
|||
gDeferredMultiSpotLightProgram.mShaderFiles.push_back(make_pair("deferred/spotLightF.glsl", GL_FRAGMENT_SHADER));
|
||||
gDeferredMultiSpotLightProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED];
|
||||
|
||||
add_common_permutations(&gDeferredMultiSpotLightProgram);
|
||||
|
||||
success = gDeferredMultiSpotLightProgram.createShader();
|
||||
llassert(success);
|
||||
}
|
||||
|
|
@ -1655,6 +1711,8 @@ bool LLViewerShaderMgr::loadShadersDeferred()
|
|||
gDeferredSunProgram.mShaderFiles.push_back(make_pair(fragment, GL_FRAGMENT_SHADER));
|
||||
gDeferredSunProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED];
|
||||
|
||||
add_common_permutations(&gDeferredSunProgram);
|
||||
|
||||
success = gDeferredSunProgram.createShader();
|
||||
llassert(success);
|
||||
}
|
||||
|
|
@ -1670,6 +1728,8 @@ bool LLViewerShaderMgr::loadShadersDeferred()
|
|||
gDeferredSunProbeProgram.mShaderFiles.push_back(make_pair("deferred/sunLightF.glsl", GL_FRAGMENT_SHADER));
|
||||
gDeferredSunProbeProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED];
|
||||
|
||||
add_common_permutations(&gDeferredSunProbeProgram);
|
||||
|
||||
success = gDeferredSunProbeProgram.createShader();
|
||||
llassert(success);
|
||||
}
|
||||
|
|
@ -1684,6 +1744,8 @@ bool LLViewerShaderMgr::loadShadersDeferred()
|
|||
gDeferredBlurLightProgram.mShaderFiles.push_back(make_pair("deferred/blurLightF.glsl", GL_FRAGMENT_SHADER));
|
||||
gDeferredBlurLightProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED];
|
||||
|
||||
add_common_permutations(&gDeferredBlurLightProgram);
|
||||
|
||||
success = gDeferredBlurLightProgram.createShader();
|
||||
llassert(success);
|
||||
}
|
||||
|
|
@ -1738,6 +1800,8 @@ bool LLViewerShaderMgr::loadShadersDeferred()
|
|||
shader->addPermutation("HAS_SUN_SHADOW", "1");
|
||||
}
|
||||
|
||||
add_common_permutations(shader);
|
||||
|
||||
if (rigged)
|
||||
{
|
||||
shader->addPermutation("HAS_SKIN", "1");
|
||||
|
|
@ -1803,6 +1867,8 @@ bool LLViewerShaderMgr::loadShadersDeferred()
|
|||
shader->addPermutation("HAS_SUN_SHADOW", "1");
|
||||
}
|
||||
|
||||
add_common_permutations(shader);
|
||||
|
||||
shader->mRiggedVariant = &gDeferredSkinnedAlphaImpostorProgram;
|
||||
shader->mShaderLevel = mShaderLevel[SHADER_DEFERRED];
|
||||
if (!rigged)
|
||||
|
|
@ -1831,6 +1897,9 @@ bool LLViewerShaderMgr::loadShadersDeferred()
|
|||
gDeferredAvatarEyesProgram.mShaderFiles.push_back(make_pair("deferred/avatarEyesV.glsl", GL_VERTEX_SHADER));
|
||||
gDeferredAvatarEyesProgram.mShaderFiles.push_back(make_pair("deferred/diffuseF.glsl", GL_FRAGMENT_SHADER));
|
||||
gDeferredAvatarEyesProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED];
|
||||
|
||||
add_common_permutations(&gDeferredAvatarEyesProgram);
|
||||
|
||||
success = gDeferredAvatarEyesProgram.createShader();
|
||||
llassert(success);
|
||||
}
|
||||
|
|
@ -1847,6 +1916,9 @@ bool LLViewerShaderMgr::loadShadersDeferred()
|
|||
gDeferredFullbrightProgram.mShaderFiles.push_back(make_pair("deferred/fullbrightV.glsl", GL_VERTEX_SHADER));
|
||||
gDeferredFullbrightProgram.mShaderFiles.push_back(make_pair("deferred/fullbrightF.glsl", GL_FRAGMENT_SHADER));
|
||||
gDeferredFullbrightProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED];
|
||||
|
||||
add_common_permutations(&gDeferredFullbrightProgram);
|
||||
|
||||
success = make_rigged_variant(gDeferredFullbrightProgram, gDeferredSkinnedFullbrightProgram);
|
||||
success = gDeferredFullbrightProgram.createShader();
|
||||
llassert(success);
|
||||
|
|
@ -1866,6 +1938,9 @@ bool LLViewerShaderMgr::loadShadersDeferred()
|
|||
gHUDFullbrightProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED];
|
||||
gHUDFullbrightProgram.clearPermutations();
|
||||
gHUDFullbrightProgram.addPermutation("IS_HUD", "1");
|
||||
|
||||
add_common_permutations(&gHUDFullbrightProgram);
|
||||
|
||||
success = gHUDFullbrightProgram.createShader();
|
||||
llassert(success);
|
||||
}
|
||||
|
|
@ -1884,6 +1959,9 @@ bool LLViewerShaderMgr::loadShadersDeferred()
|
|||
gDeferredFullbrightAlphaMaskProgram.clearPermutations();
|
||||
gDeferredFullbrightAlphaMaskProgram.addPermutation("HAS_ALPHA_MASK","1");
|
||||
gDeferredFullbrightAlphaMaskProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED];
|
||||
|
||||
add_common_permutations(&gDeferredFullbrightAlphaMaskProgram);
|
||||
|
||||
success = make_rigged_variant(gDeferredFullbrightAlphaMaskProgram, gDeferredSkinnedFullbrightAlphaMaskProgram);
|
||||
success = success && gDeferredFullbrightAlphaMaskProgram.createShader();
|
||||
llassert(success);
|
||||
|
|
@ -1903,6 +1981,9 @@ bool LLViewerShaderMgr::loadShadersDeferred()
|
|||
gHUDFullbrightAlphaMaskProgram.clearPermutations();
|
||||
gHUDFullbrightAlphaMaskProgram.addPermutation("HAS_ALPHA_MASK", "1");
|
||||
gHUDFullbrightAlphaMaskProgram.addPermutation("IS_HUD", "1");
|
||||
|
||||
add_common_permutations(&gHUDFullbrightAlphaMaskProgram);
|
||||
|
||||
gHUDFullbrightAlphaMaskProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED];
|
||||
success = gHUDFullbrightAlphaMaskProgram.createShader();
|
||||
llassert(success);
|
||||
|
|
@ -1923,6 +2004,9 @@ bool LLViewerShaderMgr::loadShadersDeferred()
|
|||
gDeferredFullbrightAlphaMaskAlphaProgram.clearPermutations();
|
||||
gDeferredFullbrightAlphaMaskAlphaProgram.addPermutation("HAS_ALPHA_MASK", "1");
|
||||
gDeferredFullbrightAlphaMaskAlphaProgram.addPermutation("IS_ALPHA", "1");
|
||||
|
||||
add_common_permutations(&gDeferredFullbrightAlphaMaskAlphaProgram);
|
||||
|
||||
gDeferredFullbrightAlphaMaskAlphaProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED];
|
||||
success = make_rigged_variant(gDeferredFullbrightAlphaMaskAlphaProgram, gDeferredSkinnedFullbrightAlphaMaskAlphaProgram);
|
||||
success = success && gDeferredFullbrightAlphaMaskAlphaProgram.createShader();
|
||||
|
|
@ -1945,6 +2029,9 @@ bool LLViewerShaderMgr::loadShadersDeferred()
|
|||
gHUDFullbrightAlphaMaskAlphaProgram.addPermutation("HAS_ALPHA_MASK", "1");
|
||||
gHUDFullbrightAlphaMaskAlphaProgram.addPermutation("IS_ALPHA", "1");
|
||||
gHUDFullbrightAlphaMaskAlphaProgram.addPermutation("IS_HUD", "1");
|
||||
|
||||
add_common_permutations(&gHUDFullbrightAlphaMaskAlphaProgram);
|
||||
|
||||
gHUDFullbrightAlphaMaskAlphaProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED];
|
||||
success = success && gHUDFullbrightAlphaMaskAlphaProgram.createShader();
|
||||
llassert(success);
|
||||
|
|
@ -1963,6 +2050,9 @@ bool LLViewerShaderMgr::loadShadersDeferred()
|
|||
gDeferredFullbrightShinyProgram.mShaderFiles.push_back(make_pair("deferred/fullbrightShinyF.glsl", GL_FRAGMENT_SHADER));
|
||||
gDeferredFullbrightShinyProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED];
|
||||
gDeferredFullbrightShinyProgram.mFeatures.hasReflectionProbes = true;
|
||||
|
||||
add_common_permutations(&gDeferredFullbrightShinyProgram);
|
||||
|
||||
success = make_rigged_variant(gDeferredFullbrightShinyProgram, gDeferredSkinnedFullbrightShinyProgram);
|
||||
success = success && gDeferredFullbrightShinyProgram.createShader();
|
||||
llassert(success);
|
||||
|
|
@ -1983,6 +2073,9 @@ bool LLViewerShaderMgr::loadShadersDeferred()
|
|||
gHUDFullbrightShinyProgram.mFeatures.hasReflectionProbes = true;
|
||||
gHUDFullbrightShinyProgram.clearPermutations();
|
||||
gHUDFullbrightShinyProgram.addPermutation("IS_HUD", "1");
|
||||
|
||||
add_common_permutations(&gHUDFullbrightShinyProgram);
|
||||
|
||||
success = gHUDFullbrightShinyProgram.createShader();
|
||||
llassert(success);
|
||||
}
|
||||
|
|
@ -1998,6 +2091,9 @@ bool LLViewerShaderMgr::loadShadersDeferred()
|
|||
gDeferredEmissiveProgram.mShaderFiles.push_back(make_pair("deferred/emissiveV.glsl", GL_VERTEX_SHADER));
|
||||
gDeferredEmissiveProgram.mShaderFiles.push_back(make_pair("deferred/emissiveF.glsl", GL_FRAGMENT_SHADER));
|
||||
gDeferredEmissiveProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED];
|
||||
|
||||
add_common_permutations(&gDeferredEmissiveProgram);
|
||||
|
||||
success = make_rigged_variant(gDeferredEmissiveProgram, gDeferredSkinnedEmissiveProgram);
|
||||
success = success && gDeferredEmissiveProgram.createShader();
|
||||
llassert(success);
|
||||
|
|
@ -2012,10 +2108,12 @@ bool LLViewerShaderMgr::loadShadersDeferred()
|
|||
gDeferredSoftenProgram.mFeatures.hasAtmospherics = true;
|
||||
gDeferredSoftenProgram.mFeatures.hasGamma = true;
|
||||
gDeferredSoftenProgram.mFeatures.isDeferred = true;
|
||||
gDeferredSoftenProgram.mFeatures.hasFullGBuffer = true;
|
||||
gDeferredSoftenProgram.mFeatures.hasShadows = use_sun_shadow;
|
||||
gDeferredSoftenProgram.mFeatures.hasReflectionProbes = mShaderLevel[SHADER_DEFERRED] > 2;
|
||||
|
||||
gDeferredSoftenProgram.clearPermutations();
|
||||
add_common_permutations(&gDeferredSoftenProgram);
|
||||
gDeferredSoftenProgram.mShaderFiles.push_back(make_pair("deferred/softenLightV.glsl", GL_VERTEX_SHADER));
|
||||
gDeferredSoftenProgram.mShaderFiles.push_back(make_pair("deferred/softenLightF.glsl", GL_FRAGMENT_SHADER));
|
||||
|
||||
|
|
@ -2052,6 +2150,8 @@ bool LLViewerShaderMgr::loadShadersDeferred()
|
|||
gHazeProgram.mShaderFiles.push_back(make_pair("deferred/softenLightV.glsl", GL_VERTEX_SHADER));
|
||||
gHazeProgram.mShaderFiles.push_back(make_pair("deferred/hazeF.glsl", GL_FRAGMENT_SHADER));
|
||||
|
||||
add_common_permutations(&gHazeProgram);
|
||||
|
||||
gHazeProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED];
|
||||
|
||||
success = gHazeProgram.createShader();
|
||||
|
|
@ -2076,6 +2176,8 @@ bool LLViewerShaderMgr::loadShadersDeferred()
|
|||
gHazeWaterProgram.mShaderFiles.push_back(make_pair("deferred/waterHazeV.glsl", GL_VERTEX_SHADER));
|
||||
gHazeWaterProgram.mShaderFiles.push_back(make_pair("deferred/waterHazeF.glsl", GL_FRAGMENT_SHADER));
|
||||
|
||||
add_common_permutations(&gHazeWaterProgram);
|
||||
|
||||
gHazeWaterProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED];
|
||||
|
||||
success = gHazeWaterProgram.createShader();
|
||||
|
|
@ -2105,6 +2207,9 @@ bool LLViewerShaderMgr::loadShadersDeferred()
|
|||
gDeferredSkinnedShadowProgram.mShaderFiles.push_back(make_pair("deferred/shadowSkinnedV.glsl", GL_VERTEX_SHADER));
|
||||
gDeferredSkinnedShadowProgram.mShaderFiles.push_back(make_pair("deferred/shadowF.glsl", GL_FRAGMENT_SHADER));
|
||||
gDeferredSkinnedShadowProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED];
|
||||
|
||||
add_common_permutations(&gDeferredSkinnedShadowProgram);
|
||||
|
||||
// gDeferredSkinnedShadowProgram.addPermutation("DEPTH_CLAMP", "1"); // disable depth clamp for now
|
||||
success = gDeferredSkinnedShadowProgram.createShader();
|
||||
llassert(success);
|
||||
|
|
@ -2136,6 +2241,9 @@ bool LLViewerShaderMgr::loadShadersDeferred()
|
|||
gDeferredShadowFullbrightAlphaMaskProgram.clearPermutations();
|
||||
gDeferredShadowFullbrightAlphaMaskProgram.addPermutation("DEPTH_CLAMP", "1");
|
||||
gDeferredShadowFullbrightAlphaMaskProgram.addPermutation("IS_FULLBRIGHT", "1");
|
||||
|
||||
add_common_permutations(&gDeferredShadowFullbrightAlphaMaskProgram);
|
||||
|
||||
gDeferredShadowFullbrightAlphaMaskProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED];
|
||||
success = make_rigged_variant(gDeferredShadowFullbrightAlphaMaskProgram, gDeferredSkinnedShadowFullbrightAlphaMaskProgram);
|
||||
success = success && gDeferredShadowFullbrightAlphaMaskProgram.createShader();
|
||||
|
|
@ -2165,6 +2273,9 @@ bool LLViewerShaderMgr::loadShadersDeferred()
|
|||
gDeferredShadowGLTFAlphaMaskProgram.mShaderFiles.push_back(make_pair("deferred/pbrShadowAlphaMaskF.glsl", GL_FRAGMENT_SHADER));
|
||||
gDeferredShadowGLTFAlphaMaskProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED];
|
||||
gDeferredShadowGLTFAlphaMaskProgram.clearPermutations();
|
||||
|
||||
add_common_permutations(&gDeferredShadowGLTFAlphaMaskProgram);
|
||||
|
||||
success = make_rigged_variant(gDeferredShadowGLTFAlphaMaskProgram, gDeferredSkinnedShadowGLTFAlphaMaskProgram);
|
||||
success = success && gDeferredShadowGLTFAlphaMaskProgram.createShader();
|
||||
llassert(success);
|
||||
|
|
@ -2178,6 +2289,9 @@ bool LLViewerShaderMgr::loadShadersDeferred()
|
|||
gDeferredShadowGLTFAlphaBlendProgram.mShaderFiles.push_back(make_pair("deferred/pbrShadowAlphaBlendF.glsl", GL_FRAGMENT_SHADER));
|
||||
gDeferredShadowGLTFAlphaBlendProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED];
|
||||
gDeferredShadowGLTFAlphaBlendProgram.clearPermutations();
|
||||
|
||||
add_common_permutations(&gDeferredShadowGLTFAlphaBlendProgram);
|
||||
|
||||
success = make_rigged_variant(gDeferredShadowGLTFAlphaBlendProgram, gDeferredSkinnedShadowGLTFAlphaBlendProgram);
|
||||
success = success && gDeferredShadowGLTFAlphaBlendProgram.createShader();
|
||||
llassert(success);
|
||||
|
|
@ -2231,6 +2345,9 @@ bool LLViewerShaderMgr::loadShadersDeferred()
|
|||
gDeferredTerrainProgram.mShaderFiles.clear();
|
||||
gDeferredTerrainProgram.mShaderFiles.push_back(make_pair("deferred/terrainV.glsl", GL_VERTEX_SHADER));
|
||||
gDeferredTerrainProgram.mShaderFiles.push_back(make_pair("deferred/terrainF.glsl", GL_FRAGMENT_SHADER));
|
||||
|
||||
add_common_permutations(&gDeferredTerrainProgram);
|
||||
|
||||
gDeferredTerrainProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED];
|
||||
success = gDeferredTerrainProgram.createShader();
|
||||
llassert(success);
|
||||
|
|
@ -2244,6 +2361,9 @@ bool LLViewerShaderMgr::loadShadersDeferred()
|
|||
gDeferredAvatarProgram.mShaderFiles.push_back(make_pair("deferred/avatarV.glsl", GL_VERTEX_SHADER));
|
||||
gDeferredAvatarProgram.mShaderFiles.push_back(make_pair("deferred/avatarF.glsl", GL_FRAGMENT_SHADER));
|
||||
gDeferredAvatarProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED];
|
||||
|
||||
add_common_permutations(&gDeferredAvatarProgram);
|
||||
|
||||
success = gDeferredAvatarProgram.createShader();
|
||||
llassert(success);
|
||||
}
|
||||
|
|
@ -2277,6 +2397,8 @@ bool LLViewerShaderMgr::loadShadersDeferred()
|
|||
|
||||
gDeferredAvatarAlphaProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED];
|
||||
|
||||
add_common_permutations(&gDeferredAvatarAlphaProgram);
|
||||
|
||||
success = gDeferredAvatarAlphaProgram.createShader();
|
||||
llassert(success);
|
||||
|
||||
|
|
@ -2419,7 +2541,7 @@ bool LLViewerShaderMgr::loadShadersDeferred()
|
|||
}
|
||||
}
|
||||
|
||||
if (success)
|
||||
if (gGLManager.mGLVersion > 3.15f && success)
|
||||
{
|
||||
std::vector<std::pair<std::string, std::string>> quality_levels = { {"SMAA_PRESET_LOW", "Low"},
|
||||
{"SMAA_PRESET_MEDIUM", "Medium"},
|
||||
|
|
@ -2586,6 +2708,7 @@ bool LLViewerShaderMgr::loadShadersDeferred()
|
|||
|
||||
gEnvironmentMapProgram.clearPermutations();
|
||||
gEnvironmentMapProgram.addPermutation("HAS_HDRI", "1");
|
||||
add_common_permutations(&gEnvironmentMapProgram);
|
||||
gEnvironmentMapProgram.mShaderFiles.push_back(make_pair("deferred/skyV.glsl", GL_VERTEX_SHADER));
|
||||
gEnvironmentMapProgram.mShaderFiles.push_back(make_pair("deferred/skyF.glsl", GL_FRAGMENT_SHADER));
|
||||
gEnvironmentMapProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED];
|
||||
|
|
@ -2609,6 +2732,8 @@ bool LLViewerShaderMgr::loadShadersDeferred()
|
|||
gDeferredWLSkyProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED];
|
||||
gDeferredWLSkyProgram.mShaderGroup = LLGLSLShader::SG_SKY;
|
||||
|
||||
add_common_permutations(&gDeferredWLSkyProgram);
|
||||
|
||||
success = gDeferredWLSkyProgram.createShader();
|
||||
llassert(success);
|
||||
}
|
||||
|
|
@ -2627,6 +2752,9 @@ bool LLViewerShaderMgr::loadShadersDeferred()
|
|||
gDeferredWLCloudProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED];
|
||||
gDeferredWLCloudProgram.mShaderGroup = LLGLSLShader::SG_SKY;
|
||||
gDeferredWLCloudProgram.addConstant( LLGLSLShader::SHADER_CONST_CLOUD_MOON_DEPTH ); // SL-14113
|
||||
|
||||
add_common_permutations(&gDeferredWLCloudProgram);
|
||||
|
||||
success = gDeferredWLCloudProgram.createShader();
|
||||
llassert(success);
|
||||
}
|
||||
|
|
@ -2644,6 +2772,9 @@ bool LLViewerShaderMgr::loadShadersDeferred()
|
|||
gDeferredWLSunProgram.mShaderFiles.push_back(make_pair("deferred/sunDiscF.glsl", GL_FRAGMENT_SHADER));
|
||||
gDeferredWLSunProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED];
|
||||
gDeferredWLSunProgram.mShaderGroup = LLGLSLShader::SG_SKY;
|
||||
|
||||
add_common_permutations(&gDeferredWLSunProgram);
|
||||
|
||||
success = gDeferredWLSunProgram.createShader();
|
||||
llassert(success);
|
||||
}
|
||||
|
|
@ -2663,6 +2794,9 @@ bool LLViewerShaderMgr::loadShadersDeferred()
|
|||
gDeferredWLMoonProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED];
|
||||
gDeferredWLMoonProgram.mShaderGroup = LLGLSLShader::SG_SKY;
|
||||
gDeferredWLMoonProgram.addConstant( LLGLSLShader::SHADER_CONST_CLOUD_MOON_DEPTH ); // SL-14113
|
||||
|
||||
add_common_permutations(&gDeferredWLMoonProgram);
|
||||
|
||||
success = gDeferredWLMoonProgram.createShader();
|
||||
llassert(success);
|
||||
}
|
||||
|
|
@ -2676,6 +2810,9 @@ bool LLViewerShaderMgr::loadShadersDeferred()
|
|||
gDeferredStarProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED];
|
||||
gDeferredStarProgram.mShaderGroup = LLGLSLShader::SG_SKY;
|
||||
gDeferredStarProgram.addConstant( LLGLSLShader::SHADER_CONST_STAR_DEPTH ); // SL-14113
|
||||
|
||||
add_common_permutations(&gDeferredWLSkyProgram);
|
||||
|
||||
success = gDeferredStarProgram.createShader();
|
||||
llassert(success);
|
||||
}
|
||||
|
|
@ -2718,6 +2855,9 @@ bool LLViewerShaderMgr::loadShadersDeferred()
|
|||
gDeferredBufferVisualProgram.mShaderFiles.push_back(make_pair("deferred/postDeferredNoTCV.glsl", GL_VERTEX_SHADER));
|
||||
gDeferredBufferVisualProgram.mShaderFiles.push_back(make_pair("deferred/postDeferredVisualizeBuffers.glsl", GL_FRAGMENT_SHADER));
|
||||
gDeferredBufferVisualProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED];
|
||||
|
||||
add_common_permutations(&gDeferredBufferVisualProgram);
|
||||
|
||||
success = gDeferredBufferVisualProgram.createShader();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -350,17 +350,22 @@ bool addDeferredAttachments(LLRenderTarget& target, bool for_impostor = false)
|
|||
U32 emissive = GL_RGB16F;
|
||||
|
||||
bool hdr = gSavedSettings.getBOOL("RenderHDREnabled") && gGLManager.mGLVersion > 4.05f;
|
||||
LLCachedControl<bool> has_emissive(gSavedSettings, "RenderEnableEmissiveBuffer", false);
|
||||
|
||||
if (!hdr)
|
||||
{
|
||||
norm = GL_RGBA;
|
||||
norm = GL_RGB10_A2;
|
||||
emissive = GL_RGB;
|
||||
}
|
||||
|
||||
bool valid = true
|
||||
&& target.addColorAttachment(orm) // frag-data[1] specular OR PBR ORM
|
||||
&& target.addColorAttachment(norm) // frag_data[2] normal+fogmask, See: class1\deferred\materialF.glsl & softenlight
|
||||
&& target.addColorAttachment(emissive); // frag_data[3] PBR emissive OR material env intensity
|
||||
bool valid = true;
|
||||
valid = valid && target.addColorAttachment(orm); // frag-data[1] specular OR PBR ORM
|
||||
valid = valid && target.addColorAttachment(norm);
|
||||
if (has_emissive)
|
||||
{
|
||||
valid = valid && target.addColorAttachment(emissive); // frag_data[3] PBR emissive OR material env intensity
|
||||
}
|
||||
|
||||
return valid;
|
||||
}
|
||||
|
||||
|
|
@ -847,7 +852,7 @@ bool LLPipeline::allocateScreenBufferInternal(U32 resX, U32 resY)
|
|||
|
||||
GLuint screenFormat = hdr ? GL_RGBA16F : GL_RGBA;
|
||||
|
||||
if (!mRT->screen.allocate(resX, resY, screenFormat)) return false;
|
||||
if (!mRT->screen.allocate(resX, resY, GL_RGBA16F)) return false;
|
||||
|
||||
mRT->deferredScreen.shareDepthBuffer(mRT->screen);
|
||||
|
||||
|
|
@ -7059,28 +7064,35 @@ void LLPipeline::generateExposure(LLRenderTarget* src, LLRenderTarget* dst, bool
|
|||
static LLStaticHashedString dt("dt");
|
||||
static LLStaticHashedString noiseVec("noiseVec");
|
||||
static LLStaticHashedString dynamic_exposure_params("dynamic_exposure_params");
|
||||
static LLStaticHashedString dynamic_exposure_params2("dynamic_exposure_params2");
|
||||
static LLStaticHashedString dynamic_exposure_e("dynamic_exposure_enabled");
|
||||
static LLCachedControl<bool> should_auto_adjust(gSavedSettings, "RenderSkyAutoAdjustLegacy", false);
|
||||
static LLCachedControl<bool> dynamic_exposure_enabled(gSavedSettings, "RenderDynamicExposureEnabled", true);
|
||||
static LLCachedControl<F32> dynamic_exposure_coefficient(gSavedSettings, "RenderDynamicExposureCoefficient", 0.175f);
|
||||
static LLCachedControl<bool> should_auto_adjust(gSavedSettings, "RenderSkyAutoAdjustLegacy", true);
|
||||
static LLCachedControl<F32> dynamic_exposure_speed_error(gSavedSettings, "RenderDynamicExposureSpeedError", 0.1f);
|
||||
static LLCachedControl<F32> dynamic_exposure_speed_target(gSavedSettings, "RenderDynamicExposureSpeedTarget", 2.f);
|
||||
|
||||
LLSettingsSky::ptr_t sky = LLEnvironment::instance().getCurrentSky();
|
||||
|
||||
F32 probe_ambiance = LLEnvironment::instance().getCurrentSky()->getReflectionProbeAmbiance(should_auto_adjust);
|
||||
F32 exp_min = 1.f;
|
||||
F32 exp_max = 1.f;
|
||||
F32 exp_min = sky->getHDRMin();
|
||||
F32 exp_max = sky->getHDRMax();
|
||||
|
||||
if (probe_ambiance > 0.f)
|
||||
if (dynamic_exposure_enabled)
|
||||
{
|
||||
F32 hdr_scale = sqrtf(LLEnvironment::instance().getCurrentSky()->getGamma()) * 2.f;
|
||||
|
||||
if (hdr_scale > 1.f)
|
||||
{
|
||||
exp_min = 1.f / hdr_scale;
|
||||
exp_max = hdr_scale;
|
||||
}
|
||||
exp_min = sky->getHDROffset() - exp_min;
|
||||
exp_max = sky->getHDROffset() + exp_max;
|
||||
}
|
||||
else
|
||||
{
|
||||
exp_min = sky->getHDROffset();
|
||||
exp_max = sky->getHDROffset();
|
||||
}
|
||||
|
||||
shader->uniform1f(dt, gFrameIntervalSeconds);
|
||||
shader->uniform2f(noiseVec, ll_frand() * 2.0f - 1.0f, ll_frand() * 2.0f - 1.0f);
|
||||
shader->uniform3f(dynamic_exposure_params, dynamic_exposure_coefficient, exp_min, exp_max);
|
||||
shader->uniform4f(dynamic_exposure_params, dynamic_exposure_coefficient, exp_min, exp_max, dynamic_exposure_speed_error);
|
||||
shader->uniform4f(dynamic_exposure_params2, sky->getHDROffset(), exp_min, exp_max, dynamic_exposure_speed_target);
|
||||
|
||||
mScreenTriangleVB->setBuffer();
|
||||
mScreenTriangleVB->drawArrays(LLRender::TRIANGLES, 0, 3);
|
||||
|
|
@ -7140,7 +7152,7 @@ void LLPipeline::tonemap(LLRenderTarget* src, LLRenderTarget* dst)
|
|||
shader.uniform1i(tonemap_type, tonemap_type_setting);
|
||||
|
||||
static LLCachedControl<F32> tonemap_mix_setting(gSavedSettings, "RenderTonemapMix", 1.f);
|
||||
shader.uniform1f(tonemap_mix, tonemap_mix_setting);
|
||||
shader.uniform1f(tonemap_mix, psky->getTonemapMix());
|
||||
|
||||
mScreenTriangleVB->setBuffer();
|
||||
mScreenTriangleVB->drawArrays(LLRender::TRIANGLES, 0, 3);
|
||||
|
|
@ -8481,6 +8493,7 @@ void LLPipeline::renderDeferredLighting()
|
|||
soften_shader.uniform1f(ssao_max_str, ssao_max);
|
||||
|
||||
LLEnvironment &environment = LLEnvironment::instance();
|
||||
|
||||
soften_shader.uniform1i(LLShaderMgr::SUN_UP_FACTOR, environment.getIsSunUp() ? 1 : 0);
|
||||
soften_shader.uniform3fv(LLShaderMgr::LIGHTNORM, 1, environment.getClampedLightNorm().mV);
|
||||
|
||||
|
|
|
|||
|
|
@ -684,6 +684,20 @@
|
|||
function="Pref.RenderOptionUpdate" />
|
||||
</check_box>
|
||||
|
||||
<check_box
|
||||
control_name="RenderVintageMode"
|
||||
height="16"
|
||||
initial_value="false"
|
||||
label="Vintage Mode"
|
||||
layout="topleft"
|
||||
left="420"
|
||||
name="VintageMode"
|
||||
top_delta="20"
|
||||
width="240">
|
||||
<check_box.commit_callback
|
||||
function="Pref.RenderOptionUpdate" />
|
||||
</check_box>
|
||||
|
||||
<text
|
||||
type="string"
|
||||
length="1"
|
||||
|
|
|
|||
Loading…
Reference in New Issue