Merge branch 'master' of git://github.com/Shyotl/SingularityViewer

This commit is contained in:
Latif Khalifa
2013-11-13 13:01:21 +01:00
10 changed files with 49 additions and 54 deletions

View File

@@ -184,28 +184,6 @@
<string>Boolean</string>
<key>Value</key>
<integer>0</integer>
</map>
<key>SHPackDeferredNormals</key>
<map>
<key>Comment</key>
<string>Pack deferred normals into two components.</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>Boolean</string>
<key>Value</key>
<integer>0</integer>
</map>
<key>SHPrecisionDeferredNormals</key>
<map>
<key>Comment</key>
<string>Enable usage of RGB10A2 for the deferred normalMap format. Reduces normalmapping artifacts.</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>Boolean</string>
<key>Value</key>
<integer>0</integer>
</map>
<key>SHOcclusionFudge</key>
<map>
@@ -240,5 +218,16 @@
<key>Value</key>
<real>0.09</real>
</map>
<key>SHAlwaysSoftenShadows</key>
<map>
<key>Comment</key>
<string>Enable optional blur pass on shadows.</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>Boolean</string>
<key>Value</key>
<real>1</real>
</map>
</map>
</llsd>

View File

@@ -60,7 +60,7 @@ uniform sampler2DShadow shadowMap0;
uniform sampler2DShadow shadowMap1;
uniform sampler2DShadow shadowMap2;
uniform sampler2DShadow shadowMap3;
uniform sampler2D noiseMap;
//uniform sampler2D noiseMap; //Random dither.
uniform vec2 shadow_res;
@@ -204,10 +204,11 @@ float pcfShadow(sampler2DShadow shadowMap, vec4 stc, vec2 pos_screen)
stc.xyz /= stc.w;
stc.z += shadow_bias;
stc.x += (((texture2D(noiseMap, pos_screen/128.0).x)-.5)/shadow_res.x);
//stc.x = floor(stc.x*shadow_res.x + fract(stc.y*shadow_res.y*12345))/shadow_res.x; // add some chaotic jitter to X sample pos according to Y to disguise the snapping going on here
//stc.x += (((texture2D(noiseMap, pos_screen/128.0).x)-.5)/shadow_res.x); //Random dither.
stc.x = floor(stc.x*shadow_res.x + fract(pos_screen.y*0.666666666))/shadow_res.x; // add some chaotic jitter to X sample pos according to Y to disguise the snapping going on here
float cs = shadow2D(shadowMap, stc.xyz).x;
float shadow = cs;
shadow += shadow2D(shadowMap, stc.xyz+vec3(2.0/shadow_res.x, 1.5/shadow_res.y, 0.0)).x;

View File

@@ -82,7 +82,7 @@ uniform sampler2DShadow shadowMap0;
uniform sampler2DShadow shadowMap1;
uniform sampler2DShadow shadowMap2;
uniform sampler2DShadow shadowMap3;
uniform sampler2D noiseMap;
//uniform sampler2D noiseMap; //Random dither.
VARYING vec2 vary_fragcoord;
uniform mat4 shadow_matrix[6];
@@ -95,10 +95,11 @@ float pcfShadow(sampler2DShadow shadowMap, vec4 stc, vec2 pos_screen)
stc.xyz /= stc.w;
stc.z += shadow_bias;
stc.x += (((texture2D(noiseMap, pos_screen/128.0).x)-.5)/shadow_res.x);
//stc.x = floor(stc.x*shadow_res.x + fract(stc.y*shadow_res.y*12345))/shadow_res.x; // add some chaotic jitter to X sample pos according to Y to disguise the snapping going on here
//stc.x += (((texture2D(noiseMap, pos_screen/128.0).x)-.5)/shadow_res.x); //Random dither.
stc.x = floor(stc.x*shadow_res.x + fract(pos_screen.y*0.666666666))/shadow_res.x; // add some chaotic jitter to X sample pos according to Y to disguise the snapping going on here
float cs = shadow2D(shadowMap, stc.xyz).x;
float shadow = cs;
shadow += shadow2D(shadowMap, stc.xyz+vec3(2.0/shadow_res.x, 1.5/shadow_res.y, 0.0)).x;

View File

@@ -391,24 +391,23 @@ void main()
float envIntensity = norm.z;
norm.xyz = decode_normal(norm.xy); // unpack norm
float da = dot(norm.xyz, sun_dir.xyz);
float final_da = max(0.0,da);
final_da = min(final_da, 1.0f);
final_da = pow(final_da, 1.0/1.3);
vec4 diffuse = texture2DRect(diffuseRect, tc);
//convert to gamma space
diffuse.rgb = linear_to_srgb(diffuse.rgb);
vec4 spec = texture2DRect(specularRect, vary_fragcoord.xy);
vec3 col;
float bloom = 0.0;
{
vec4 spec = texture2DRect(specularRect, vary_fragcoord.xy);
bloom = spec.r*norm.w;
if (norm.w < 0.5)
{
float da = dot(norm.xyz, sun_dir.xyz);
float final_da = max(0.0,da);
final_da = min(final_da, 1.0f);
final_da = pow(final_da, 1.0/1.3);
calcAtmospherics(pos.xyz, 1.0);
col = atmosAmbient(vec3(0));

View File

@@ -400,12 +400,6 @@ void main()
float envIntensity = norm.z;
norm.xyz = decode_normal(norm.xy); // unpack norm
float da = max(dot(norm.xyz, sun_dir.xyz), 0.0);
float light_gamma = 1.0/1.3;
da = pow(da, light_gamma);
vec4 diffuse = texture2DRect(diffuseRect, tc);
//convert to gamma space
@@ -419,6 +413,12 @@ void main()
if (norm.w < 0.5)
{
float da = max(dot(norm.xyz, sun_dir.xyz), 0.0);
float light_gamma = 1.0/1.3;
da = pow(da, light_gamma);
vec2 scol_ambocc = texture2DRect(lightMap, vary_fragcoord.xy).rg;
scol_ambocc = pow(scol_ambocc, vec2(light_gamma));
@@ -466,8 +466,8 @@ void main()
{ //add environmentmap
vec3 env_vec = env_mat * refnormpersp;
vec3 refcol = textureCube(environmentMap, env_vec).rgb*scol_ambocc.r;
bloom = (luminance(refcol) - .45)*.25;
vec3 refcol = textureCube(environmentMap, env_vec).rgb; //Perhaps mix with a cubemap without sun, in the future.
bloom = (luminance(refcol) - .45)*.25*scol_ambocc.r;
col = mix(col.rgb, refcol,
envIntensity);

View File

@@ -41,7 +41,7 @@ uniform sampler2DShadow shadowMap2;
uniform sampler2DShadow shadowMap3;
uniform sampler2DShadow shadowMap4;
uniform sampler2DShadow shadowMap5;
uniform sampler2D noiseMap;
//uniform sampler2D noiseMap; //Random dither.
// Inputs
uniform mat4 shadow_matrix[6];
@@ -100,8 +100,9 @@ float pcfShadow(sampler2DShadow shadowMap, vec4 stc, float scl, vec2 pos_screen)
stc.xyz /= stc.w;
stc.z += shadow_bias;
stc.x += (((texture2D(noiseMap, pos_screen/128.0).x)-.5)/shadow_res.x);
//stc.x = floor(stc.x*shadow_res.x + fract(pos_screen.y*0.666666666))/shadow_res.x; // add some chaotic jitter to X sample pos according to Y to disguise the snapping going on here
//stc.x += (((texture2D(noiseMap, pos_screen/128.0).x)-.5)/shadow_res.x); //Random dither.
stc.x = floor(stc.x*shadow_res.x + fract(pos_screen.y*0.666666666))/shadow_res.x; // add some chaotic jitter to X sample pos according to Y to disguise the snapping going on here
float cs = shadow2D(shadowMap, stc.xyz).x;
float shadow = cs;
@@ -119,8 +120,8 @@ float pcfSpotShadow(sampler2DShadow shadowMap, vec4 stc, float scl, vec2 pos_scr
{
stc.xyz /= stc.w;
stc.z += spot_shadow_bias*scl;
stc.x += (((texture2D(noiseMap, pos_screen/128.0).x)-.5)/proj_shadow_res.x);
//stc.x = floor(proj_shadow_res.x * stc.x + fract(pos_screen.y*0.666666666)) / proj_shadow_res.x; // snap
//stc.x += (((texture2D(noiseMap, pos_screen/128.0).x)-.5)/proj_shadow_res.x); //Random dither.
stc.x = floor(proj_shadow_res.x * stc.x + fract(pos_screen.y*0.666666666)) / proj_shadow_res.x; // snap
float cs = shadow2D(shadowMap, stc.xyz).x;
float shadow = cs;

View File

@@ -156,8 +156,9 @@ float pcfShadow(sampler2DShadow shadowMap, vec4 stc, float scl, vec2 pos_screen)
stc.xyz /= stc.w;
stc.z += shadow_bias;
stc.x += (((texture2D(noiseMap, pos_screen/128.0).x)-.5)/shadow_res.x);
//stc.x = floor(stc.x*shadow_res.x + fract(pos_screen.y*0.666666666))/shadow_res.x;
//stc.x += (((texture2D(noiseMap, pos_screen/128.0).x)-.5)/shadow_res.x); //Random dither.
stc.x = floor(stc.x*shadow_res.x + fract(pos_screen.y*0.666666666))/shadow_res.x;
float cs = shadow2D(shadowMap, stc.xyz).x;
float shadow = cs;
@@ -174,8 +175,8 @@ float pcfSpotShadow(sampler2DShadow shadowMap, vec4 stc, float scl, vec2 pos_scr
{
stc.xyz /= stc.w;
stc.z += spot_shadow_bias*scl;
stc.x += (((texture2D(noiseMap, pos_screen/128.0).x)-.5)/proj_shadow_res.x);
//stc.x = floor(proj_shadow_res.x * stc.x + fract(pos_screen.y*0.666666666)) / proj_shadow_res.x; // snap
//stc.x += (((texture2D(noiseMap, pos_screen/128.0).x)-.5)/proj_shadow_res.x); //Random dither.
stc.x = floor(proj_shadow_res.x * stc.x + fract(pos_screen.y*0.666666666)) / proj_shadow_res.x; // snap
float cs = shadow2D(shadowMap, stc.xyz).x;
float shadow = cs;

View File

@@ -598,6 +598,7 @@ void LLDrawPoolAlpha::renderAlpha(U32 mask, S32 pass)
// If this alpha mesh has glow, then draw it a second time to add the destination-alpha (=glow). Interleaving these state-changing calls could be expensive, but glow must be drawn Z-sorted with alpha.
if (current_shader &&
draw_glow_for_this_partition &&
params.mHasGlow && //only do this second pass for batches that actually have glow
params.mVertexBuffer->hasDataType(LLVertexBuffer::TYPE_EMISSIVE))
{
// install glow-accumulating blend mode

View File

@@ -716,7 +716,8 @@ void LLVOPartGroup::getGeometry(S32 idx,
*colorsp++ = color;
*colorsp++ = color;
//if (pglow.mV[3] || part.mGlow.mV[3])
//Only add emissive attributes if glowing (doing it for all particles is INCREDIBLY inefficient as it leads to a second, slower, render pass.)
if (pglow.mV[3] > F_ALMOST_ZERO || part.mGlow.mV[3] > F_ALMOST_ZERO)
{ //only write glow if it is not zero
*emissivep++ = pglow;
*emissivep++ = pglow;

View File

@@ -7994,7 +7994,8 @@ void LLPipeline::renderDeferredLighting()
mDeferredLight.flush();
}
if (RenderDeferredSSAO)
static const LLCachedControl<bool> SHAlwaysSoftenShadows("SHAlwaysSoftenShadows",true);
if (RenderDeferredSSAO || (RenderShadowDetail > 0 && SHAlwaysSoftenShadows))
{ //soften direct lighting lightmap
LLFastTimer ftm(FTM_SOFTEN_SHADOW);
//blur lightmap