summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--indra/llrender/llrender.cpp5
-rw-r--r--indra/llrender/llrender.h1
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl13
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/terrainF.glsl2
-rw-r--r--indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl11
-rw-r--r--indra/newview/pipeline.cpp5
6 files changed, 23 insertions, 14 deletions
diff --git a/indra/llrender/llrender.cpp b/indra/llrender/llrender.cpp
index 812fa7024b..cd827f5091 100644
--- a/indra/llrender/llrender.cpp
+++ b/indra/llrender/llrender.cpp
@@ -1444,6 +1444,11 @@ const glh::matrix4f& LLRender::getModelviewMatrix()
return mMatrix[MM_MODELVIEW][mMatIdx[MM_MODELVIEW]];
}
+const glh::matrix4f& LLRender::getProjectionMatrix()
+{
+ return mMatrix[MM_PROJECTION][mMatIdx[MM_PROJECTION]];
+}
+
void LLRender::translateUI(F32 x, F32 y, F32 z)
{
if (mUIOffset.empty())
diff --git a/indra/llrender/llrender.h b/indra/llrender/llrender.h
index 7581b9f908..fa5f7f311d 100644
--- a/indra/llrender/llrender.h
+++ b/indra/llrender/llrender.h
@@ -348,6 +348,7 @@ public:
void matrixMode(U32 mode);
const glh::matrix4f& getModelviewMatrix();
+ const glh::matrix4f& getProjectionMatrix();
void syncMatrices();
void syncLightState();
diff --git a/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl b/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl
index 60952ea38e..51110ae4df 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl
@@ -35,7 +35,6 @@ uniform sampler2DRect positionMap;
uniform sampler2DRect normalMap;
uniform sampler2DRect lightMap;
uniform sampler2DRect depthMap;
-uniform sampler2D noiseMap;
uniform samplerCube environmentMap;
uniform sampler2D lightFunc;
@@ -60,9 +59,7 @@ uniform vec4 distance_multiplier;
uniform vec4 max_y;
uniform vec4 glow;
uniform float scene_light_strength;
-uniform vec3 env_mat[3];
-//uniform mat4 shadow_matrix[3];
-//uniform vec4 shadow_clip;
+uniform mat3 env_mat;
uniform mat3 ssao_effect_mat;
uniform vec3 sun_dir;
@@ -279,8 +276,7 @@ void main()
vec3 pos = getPosition_d(tc, depth).xyz;
vec3 norm = texture2DRect(normalMap, tc).xyz;
norm = vec3((norm.xy-0.5)*2.0,norm.z); // unpack norm
- //vec3 nz = texture2D(noiseMap, vary_fragcoord.xy/128.0).xyz;
-
+
float da = max(dot(norm.xyz, sun_dir.xyz), 0.0);
vec4 diffuse = texture2DRect(diffuseRect, tc);
@@ -309,6 +305,11 @@ void main()
vec3 spec_contrib = dumbshiny * spec.rgb;
bloom = dot(spec_contrib, spec_contrib);
col += spec_contrib;
+
+ //add environmentmap
+ vec3 env_vec = env_mat * refnormpersp;
+ col = mix(col.rgb, textureCube(environmentMap, env_vec).rgb,
+ max(spec.a-diffuse.a*2.0, 0.0));
}
col = atmosLighting(col);
diff --git a/indra/newview/app_settings/shaders/class1/deferred/terrainF.glsl b/indra/newview/app_settings/shaders/class1/deferred/terrainF.glsl
index e014e53d25..5522e6c41d 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/terrainF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/terrainF.glsl
@@ -52,7 +52,7 @@ void main()
vec4 outColor = mix( mix(color3, color2, alpha2), mix(color1, color0, alpha1), alphaFinal );
gl_FragData[0] = vec4(outColor.rgb, 0.0);
- gl_FragData[1] = vec4(outColor.rgb*0.2, 0.2);
+ gl_FragData[1] = vec4(0,0,0,0);
vec3 nvn = normalize(vary_normal);
gl_FragData[2] = vec4(nvn.xy * 0.5 + 0.5, nvn.z, 0.0);
}
diff --git a/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl b/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl
index eb367d4ad6..97f3063a9e 100644
--- a/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl
+++ b/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl
@@ -34,7 +34,6 @@ uniform sampler2DRect specularRect;
uniform sampler2DRect normalMap;
uniform sampler2DRect lightMap;
uniform sampler2DRect depthMap;
-uniform sampler2D noiseMap;
uniform samplerCube environmentMap;
uniform sampler2D lightFunc;
uniform vec3 gi_quad;
@@ -60,7 +59,7 @@ uniform vec4 distance_multiplier;
uniform vec4 max_y;
uniform vec4 glow;
uniform float scene_light_strength;
-uniform vec3 env_mat[3];
+uniform mat3 env_mat;
uniform vec4 shadow_clip;
uniform mat3 ssao_effect_mat;
@@ -279,8 +278,7 @@ void main()
vec3 pos = getPosition_d(tc, depth).xyz;
vec3 norm = texture2DRect(normalMap, tc).xyz;
norm = vec3((norm.xy-0.5)*2.0,norm.z); // unpack norm
- //vec3 nz = texture2D(noiseMap, vary_fragcoord.xy/128.0).xyz;
-
+
float da = max(dot(norm.xyz, sun_dir.xyz), 0.0);
vec4 diffuse = texture2DRect(diffuseRect, tc);
@@ -315,6 +313,11 @@ void main()
vec3 spec_contrib = dumbshiny * spec.rgb;
bloom = dot(spec_contrib, spec_contrib);
col += spec_contrib;
+
+ //add environmentmap
+ vec3 env_vec = env_mat * refnormpersp;
+ col = mix(col.rgb, textureCube(environmentMap, env_vec).rgb,
+ max(spec.a-diffuse.a*2.0, 0.0));
}
col = atmosLighting(col);
diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp
index 12bec90881..657cdc0e07 100644
--- a/indra/newview/pipeline.cpp
+++ b/indra/newview/pipeline.cpp
@@ -7108,13 +7108,12 @@ void LLPipeline::bindDeferredShader(LLGLSLShader& shader, U32 light_index, U32 n
cube_map->enable(channel);
cube_map->bind();
F32* m = gGLModelView;
-
-
+
F32 mat[] = { m[0], m[1], m[2],
m[4], m[5], m[6],
m[8], m[9], m[10] };
- shader.uniform3fv(LLShaderMgr::DEFERRED_ENV_MAT, 3, mat);
+ shader.uniformMatrix3fv(LLShaderMgr::DEFERRED_ENV_MAT, 1, TRUE, mat);
}
}