summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xindra/newview/app_settings/shaders/class1/deferred/alphaV.glsl9
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/materialF.glsl12
-rwxr-xr-xindra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl7
-rwxr-xr-xindra/newview/app_settings/shaders/class2/deferred/alphaV.glsl9
-rwxr-xr-xindra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl10
-rwxr-xr-xindra/newview/llpanelface.cpp99
-rwxr-xr-xindra/newview/llviewershadermgr.cpp6
-rwxr-xr-xindra/newview/pipeline.cpp38
8 files changed, 146 insertions, 44 deletions
diff --git a/indra/newview/app_settings/shaders/class1/deferred/alphaV.glsl b/indra/newview/app_settings/shaders/class1/deferred/alphaV.glsl
index 77d02b36ff..247ee0a34f 100755
--- a/indra/newview/app_settings/shaders/class1/deferred/alphaV.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/alphaV.glsl
@@ -86,6 +86,8 @@ uniform vec3 light_direction[8];
uniform vec3 light_attenuation[8];
uniform vec3 light_diffuse[8];
+uniform vec3 sun_dir;
+
vec3 calcDirectionalLight(vec3 n, vec3 l)
{
float a = max(dot(n,l),0.0);
@@ -194,6 +196,13 @@ void main()
// Add windlight lights
col.rgb = atmosAmbient(col.rgb);
+ float ambient = min(abs(dot(norm.xyz, sun_dir.xyz)), 1.0);
+ ambient *= 0.5;
+ ambient *= ambient;
+ ambient = (1.0-ambient);
+
+ col.rgb *= ambient;
+
vary_ambient = col.rgb*diff.rgb;
vary_directional.rgb = atmosAffectDirectionalLight(1.0f);
diff --git a/indra/newview/app_settings/shaders/class1/deferred/materialF.glsl b/indra/newview/app_settings/shaders/class1/deferred/materialF.glsl
index 599477ad9e..fc4b8b33f8 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/materialF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/materialF.glsl
@@ -579,6 +579,14 @@ void main()
final_da = max(final_da, 0.0f);
col.rgb = atmosAmbient(col);
+
+ float ambient = min(abs(dot(norm.xyz, sun_dir.xyz)), 1.0);
+ ambient *= 0.5;
+ ambient *= ambient;
+ ambient = (1.0-ambient);
+
+ col.rgb *= ambient;
+
col.rgb = col.rgb + atmosAffectDirectionalLight(final_da * 2.6);
col.rgb *= diffuse.rgb;
@@ -625,13 +633,13 @@ void main()
#define LIGHT_LOOP(i) col.rgb = col.rgb + calcPointLightOrSpotLight(light_diffuse[i].rgb, npos, diffuse.rgb, final_specular, pos.xyz, norm.xyz, light_position[i], light_direction[i].xyz, light_attenuation[i].x, light_attenuation[i].y, light_attenuation[i].z, glare);
- /*LIGHT_LOOP(1)
+ LIGHT_LOOP(1)
LIGHT_LOOP(2)
LIGHT_LOOP(3)
LIGHT_LOOP(4)
LIGHT_LOOP(5)
LIGHT_LOOP(6)
- LIGHT_LOOP(7)*/
+ LIGHT_LOOP(7)
frag_color.rgb = col.rgb;
glare = min(glare, 1.0);
diff --git a/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl b/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl
index a1dff9188f..9197df2628 100755
--- a/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl
@@ -301,6 +301,13 @@ void main()
calcAtmospherics(pos.xyz, 1.0);
col = atmosAmbient(vec3(0));
+ float ambient = min(abs(dot(norm.xyz, sun_dir.xyz)), 1.0);
+ ambient *= 0.5;
+ ambient *= ambient;
+ ambient = (1.0-ambient);
+
+ col.rgb *= ambient;
+
col += atmosAffectDirectionalLight(max(min(da, 1.0) * 2.6, diffuse.a));
col *= diffuse.rgb;
diff --git a/indra/newview/app_settings/shaders/class2/deferred/alphaV.glsl b/indra/newview/app_settings/shaders/class2/deferred/alphaV.glsl
index 127c1709b8..13c6ffc607 100755
--- a/indra/newview/app_settings/shaders/class2/deferred/alphaV.glsl
+++ b/indra/newview/app_settings/shaders/class2/deferred/alphaV.glsl
@@ -83,6 +83,8 @@ uniform vec3 light_direction[8];
uniform vec3 light_attenuation[8];
uniform vec3 light_diffuse[8];
+uniform vec3 sun_dir;
+
vec3 calcDirectionalLight(vec3 n, vec3 l)
{
float a = max(dot(n,l),0.0);
@@ -190,6 +192,13 @@ void main()
// Add windlight lights
col.rgb = atmosAmbient(col.rgb);
+ float ambient = min(abs(dot(norm.xyz, sun_dir.xyz)), 1.0);
+ ambient *= 0.5;
+ ambient *= ambient;
+ ambient = (1.0-ambient);
+
+ col.rgb *= ambient;
+
vary_directional.rgb = atmosAffectDirectionalLight(1.0f);
vary_ambient = col.rgb*dff;
diff --git a/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl b/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl
index 10a598a85c..ee6aaddb00 100755
--- a/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl
+++ b/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl
@@ -296,7 +296,7 @@ void main()
float da = max(dot(norm.xyz, sun_dir.xyz), 0.0);
vec4 diffuse = texture2DRect(diffuseRect, tc);
-
+
vec3 col;
float bloom = 0.0;
@@ -310,6 +310,14 @@ void main()
calcAtmospherics(pos.xyz, ambocc);
col = atmosAmbient(vec3(0));
+
+ float ambient = min(abs(dot(norm.xyz, sun_dir.xyz)), 1.0);
+ ambient *= 0.5;
+ ambient *= ambient;
+ ambient = (1.0-ambient);
+
+ col *= ambient;
+
col += atmosAffectDirectionalLight(max(min(da, scol) * 2.6, diffuse.a));
col *= diffuse.rgb;
diff --git a/indra/newview/llpanelface.cpp b/indra/newview/llpanelface.cpp
index 302a4294e4..1d99e9d162 100755
--- a/indra/newview/llpanelface.cpp
+++ b/indra/newview/llpanelface.cpp
@@ -657,6 +657,42 @@ void LLPanelFace::updateUI()
LLUUID normmap_id;
LLUUID specmap_id;
+ // Color swatch
+ {
+ getChildView("color label")->setEnabled(editable);
+ }
+ LLColorSwatchCtrl* mColorSwatch = getChild<LLColorSwatchCtrl>("colorswatch");
+ LLColor4 color = LLColor4::white;
+ if(mColorSwatch)
+ {
+ struct f7 : public LLSelectedTEGetFunctor<LLColor4>
+ {
+ LLColor4 get(LLViewerObject* object, S32 face)
+ {
+ return object->getTE(face)->getColor();
+ }
+ } func;
+ identical = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &func, color );
+
+ mColorSwatch->setOriginal(color);
+ mColorSwatch->set(color, TRUE);
+
+ mColorSwatch->setValid(editable);
+ mColorSwatch->setEnabled( editable );
+ mColorSwatch->setCanApplyImmediately( editable );
+ }
+
+ // Color transparency
+ {
+ getChildView("color trans")->setEnabled(editable);
+ }
+
+ F32 transparency = (1.f - color.mV[VALPHA]) * 100.f;
+ {
+ getChild<LLUICtrl>("ColorTrans")->setValue(editable ? transparency : 0);
+ getChildView("ColorTrans")->setEnabled(editable);
+ }
+
// Texture
{
struct f1 : public LLSelectedTEGetFunctor<LLUUID>
@@ -792,10 +828,17 @@ void LLPanelFace::updateUI()
if (combobox_alphamode)
{
+
+ if (transparency > 0.f)
+ { //it is invalid to have any alpha mode other than blend if transparency is greater than zero ...
+ alpha_mode = LLMaterial::DIFFUSE_ALPHA_MODE_BLEND;
+ }
+
if (!mIsAlpha)
- {
+ { // ... unless there is no alpha channel in the texture, in which case alpha mode MUST ebe none
alpha_mode = LLMaterial::DIFFUSE_ALPHA_MODE_NONE;
}
+
combobox_alphamode->selectNthItem(alpha_mode);
}
@@ -814,7 +857,7 @@ void LLPanelFace::updateUI()
texture_ctrl->setTentative( FALSE );
texture_ctrl->setEnabled( editable );
texture_ctrl->setImageAssetID( id );
- getChildView("combobox alphamode")->setEnabled(editable && mIsAlpha);
+ getChildView("combobox alphamode")->setEnabled(editable && mIsAlpha && transparency <= 0.f);
getChildView("label alphamode")->setEnabled(editable && mIsAlpha);
getChildView("maskcutoff")->setEnabled(editable && mIsAlpha);
getChildView("label maskcutoff")->setEnabled(editable && mIsAlpha);
@@ -836,7 +879,7 @@ void LLPanelFace::updateUI()
texture_ctrl->setTentative( TRUE );
texture_ctrl->setEnabled( editable );
texture_ctrl->setImageAssetID( id );
- getChildView("combobox alphamode")->setEnabled(editable && mIsAlpha);
+ getChildView("combobox alphamode")->setEnabled(editable && mIsAlpha && transparency <= 0.f);
getChildView("label alphamode")->setEnabled(editable && mIsAlpha);
getChildView("maskcutoff")->setEnabled(editable && mIsAlpha);
getChildView("label maskcutoff")->setEnabled(editable && mIsAlpha);
@@ -1281,42 +1324,6 @@ void LLPanelFace::updateUI()
getChildView("bumpyRot")->setEnabled(editable && normmap_id.notNull());
}
- // Color swatch
- {
- getChildView("color label")->setEnabled(editable);
- }
- LLColorSwatchCtrl* mColorSwatch = getChild<LLColorSwatchCtrl>("colorswatch");
- LLColor4 color = LLColor4::white;
- if(mColorSwatch)
- {
- struct f7 : public LLSelectedTEGetFunctor<LLColor4>
- {
- LLColor4 get(LLViewerObject* object, S32 face)
- {
- return object->getTE(face)->getColor();
- }
- } func;
- identical = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &func, color );
-
- mColorSwatch->setOriginal(color);
- mColorSwatch->set(color, TRUE);
-
- mColorSwatch->setValid(editable);
- mColorSwatch->setEnabled( editable );
- mColorSwatch->setCanApplyImmediately( editable );
- }
-
- // Color transparency
- {
- getChildView("color trans")->setEnabled(editable);
- }
-
- F32 transparency = (1.f - color.mV[VALPHA]) * 100.f;
- {
- getChild<LLUICtrl>("ColorTrans")->setValue(editable ? transparency : 0);
- getChildView("ColorTrans")->setEnabled(editable);
- }
-
{
F32 glow = 0.f;
struct f8 : public LLSelectedTEGetFunctor<F32>
@@ -1586,7 +1593,19 @@ void LLPanelFace::updateUI()
childGetSelectionInterface("combobox alphamode");
if (combobox_alphamode)
{
- combobox_alphamode->selectNthItem(material->getDiffuseAlphaMode());
+ U32 alpha_mode = material->getDiffuseAlphaMode();
+
+ if (transparency > 0.f)
+ { //it is invalid to have any alpha mode other than blend if transparency is greater than zero ...
+ alpha_mode = LLMaterial::DIFFUSE_ALPHA_MODE_BLEND;
+ }
+
+ if (!mIsAlpha)
+ { // ... unless there is no alpha channel in the texture, in which case alpha mode MUST ebe none
+ alpha_mode = LLMaterial::DIFFUSE_ALPHA_MODE_NONE;
+ }
+
+ combobox_alphamode->selectNthItem(alpha_mode);
}
else
{
diff --git a/indra/newview/llviewershadermgr.cpp b/indra/newview/llviewershadermgr.cpp
index 022ddb69ce..14d98d9a5a 100755
--- a/indra/newview/llviewershadermgr.cpp
+++ b/indra/newview/llviewershadermgr.cpp
@@ -466,6 +466,12 @@ void LLViewerShaderMgr::setShaders()
S32 deferred_class = 0;
S32 transform_class = gGLManager.mHasTransformFeedback ? 1 : 0;
+ static LLCachedControl<bool> use_transform_feedback(gSavedSettings, "RenderUseTransformFeedback");
+ if (!use_transform_feedback)
+ {
+ transform_class = 0;
+ }
+
if (LLFeatureManager::getInstance()->isFeatureAvailable("RenderDeferred") &&
gSavedSettings.getBOOL("RenderDeferred") &&
gSavedSettings.getBOOL("RenderAvatarVP") &&
diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp
index bcbd752550..19ff1e852d 100755
--- a/indra/newview/pipeline.cpp
+++ b/indra/newview/pipeline.cpp
@@ -5765,8 +5765,15 @@ void LLPipeline::setupAvatarLights(BOOL for_edit)
LLLightState* light = gGL.getLight(1);
- mHWLightColors[1] = diffuse;
+ if (LLPipeline::sRenderDeferred)
+ {
+ diffuse.mV[0] = powf(diffuse.mV[0], 2.2f);
+ diffuse.mV[1] = powf(diffuse.mV[1], 2.2f);
+ diffuse.mV[2] = powf(diffuse.mV[2], 2.2f);
+ }
+ mHWLightColors[1] = diffuse;
+
light->setDiffuse(diffuse);
light->setAmbient(LLColor4::black);
light->setSpecular(LLColor4::black);
@@ -5805,6 +5812,13 @@ void LLPipeline::setupAvatarLights(BOOL for_edit)
}
backlight_diffuse *= backlight_mag / max_component;
+ if (LLPipeline::sRenderDeferred)
+ {
+ backlight_diffuse.mV[0] = powf(backlight_diffuse.mV[0], 2.2f);
+ backlight_diffuse.mV[1] = powf(backlight_diffuse.mV[1], 2.2f);
+ backlight_diffuse.mV[2] = powf(backlight_diffuse.mV[2], 2.2f);
+ }
+
mHWLightColors[1] = backlight_diffuse;
LLLightState* light = gGL.getLight(1);
@@ -6011,6 +6025,14 @@ void LLPipeline::setupHWLights(LLDrawPool* pool)
LLVector4 light_pos(mSunDir, 0.0f);
LLColor4 light_diffuse = mSunDiffuse;
+
+ if (LLPipeline::sRenderDeferred)
+ {
+ light_diffuse.mV[0] = powf(light_diffuse.mV[0], 2.2f);
+ light_diffuse.mV[1] = powf(light_diffuse.mV[1], 2.2f);
+ light_diffuse.mV[2] = powf(light_diffuse.mV[2], 2.2f);
+ }
+
mHWLightColors[0] = light_diffuse;
LLLightState* light = gGL.getLight(0);
@@ -6079,6 +6101,13 @@ void LLPipeline::setupHWLights(LLDrawPool* pool)
F32 x = (3.f * (1.f + light->getLightFalloff())); // why this magic? probably trying to match a historic behavior.
float linatten = x / (light_radius); // % of brightness at radius
+ if (LLPipeline::sRenderDeferred)
+ {
+ light_color.mV[0] = powf(light_color.mV[0], 2.2f);
+ light_color.mV[1] = powf(light_color.mV[1], 2.2f);
+ light_color.mV[2] = powf(light_color.mV[2], 2.2f);
+ }
+
mHWLightColors[cur_light] = light_color;
LLLightState* light_state = gGL.getLight(cur_light);
@@ -6152,6 +6181,13 @@ void LLPipeline::setupHWLights(LLDrawPool* pool)
F32 x = 3.f;
float linatten = x / (light_radius); // % of brightness at radius
+ if (LLPipeline::sRenderDeferred)
+ {
+ light_color.mV[0] = powf(light_color.mV[0], 2.2f);
+ light_color.mV[1] = powf(light_color.mV[1], 2.2f);
+ light_color.mV[2] = powf(light_color.mV[2], 2.2f);
+ }
+
mHWLightColors[2] = light_color;
LLLightState* light = gGL.getLight(2);