SH-1521 FIX -- Lighting and Shadows grayed out on mac
* Modified mac feature table to bring it up to date with latest renderer features including deferred rendering * Changed mac AGL pixel format to no longer allow it to revert to software rendering when shader compilation errors occur. * Fixed up various GLSL shader compilation warnings and errors that came up as a result of the above changes. * Changed initial conditions for the "hardware skinning" checkbox on the preferences floater so it can be modified before login on machines that support avatar vertex programs. * Removed unused avatarAlphaF.glsl files Reviewed by davepmaster
parent
5f6559c0f6
commit
a52019d6d1
|
|
@ -315,7 +315,7 @@ void LLShaderMgr::dumpObjectLog(GLhandleARB ret, BOOL warns)
|
|||
}
|
||||
else
|
||||
{
|
||||
LL_DEBUGS("ShaderLoading") << log << LL_ENDL;
|
||||
LL_INFOS("ShaderLoading") << log << LL_ENDL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -541,20 +541,20 @@ BOOL LLWindowMacOSX::createContext(int x, int y, int width, int height, int bits
|
|||
GLint fullscreenAttrib[] =
|
||||
{
|
||||
AGL_RGBA,
|
||||
AGL_FULLSCREEN,
|
||||
// AGL_NO_RECOVERY, // MBW -- XXX -- Not sure if we want this attribute
|
||||
AGL_SAMPLE_BUFFERS_ARB, mFSAASamples > 0 ? 1 : 0,
|
||||
AGL_SAMPLES_ARB, mFSAASamples,
|
||||
AGL_DOUBLEBUFFER,
|
||||
AGL_CLOSEST_POLICY,
|
||||
AGL_ACCELERATED,
|
||||
AGL_RED_SIZE, 8,
|
||||
AGL_GREEN_SIZE, 8,
|
||||
AGL_BLUE_SIZE, 8,
|
||||
AGL_ALPHA_SIZE, 8,
|
||||
AGL_DEPTH_SIZE, 24,
|
||||
AGL_STENCIL_SIZE, 8,
|
||||
AGL_NONE
|
||||
AGL_FULLSCREEN,
|
||||
AGL_NO_RECOVERY,
|
||||
AGL_SAMPLE_BUFFERS_ARB, mFSAASamples > 0 ? 1 : 0,
|
||||
AGL_SAMPLES_ARB, mFSAASamples,
|
||||
AGL_DOUBLEBUFFER,
|
||||
AGL_CLOSEST_POLICY,
|
||||
AGL_ACCELERATED,
|
||||
AGL_RED_SIZE, 8,
|
||||
AGL_GREEN_SIZE, 8,
|
||||
AGL_BLUE_SIZE, 8,
|
||||
AGL_ALPHA_SIZE, 8,
|
||||
AGL_DEPTH_SIZE, 24,
|
||||
AGL_STENCIL_SIZE, 8,
|
||||
AGL_NONE
|
||||
};
|
||||
|
||||
LL_DEBUGS("Window") << "createContext: creating fullscreen pixelformat" << LL_ENDL;
|
||||
|
|
@ -567,21 +567,28 @@ BOOL LLWindowMacOSX::createContext(int x, int y, int width, int height, int bits
|
|||
}
|
||||
else
|
||||
{
|
||||
// NOTE from Leslie:
|
||||
//
|
||||
// AGL_NO_RECOVERY, when combined with AGL_ACCELERATED prevents software rendering
|
||||
// fallback which means we won't hvae shaders that compile and link but then don't
|
||||
// work. The drawback is that our shader compilation will be a bit more finicky though.
|
||||
|
||||
GLint windowedAttrib[] =
|
||||
{
|
||||
AGL_RGBA,
|
||||
AGL_DOUBLEBUFFER,
|
||||
AGL_CLOSEST_POLICY,
|
||||
AGL_ACCELERATED,
|
||||
AGL_SAMPLE_BUFFERS_ARB, mFSAASamples > 0 ? 1 : 0,
|
||||
AGL_SAMPLES_ARB, mFSAASamples,
|
||||
AGL_RED_SIZE, 8,
|
||||
AGL_GREEN_SIZE, 8,
|
||||
AGL_BLUE_SIZE, 8,
|
||||
AGL_ALPHA_SIZE, 8,
|
||||
AGL_DEPTH_SIZE, 24,
|
||||
AGL_STENCIL_SIZE, 8,
|
||||
AGL_NONE
|
||||
AGL_NO_RECOVERY,
|
||||
AGL_DOUBLEBUFFER,
|
||||
AGL_CLOSEST_POLICY,
|
||||
AGL_ACCELERATED,
|
||||
AGL_SAMPLE_BUFFERS_ARB, mFSAASamples > 0 ? 1 : 0,
|
||||
AGL_SAMPLES_ARB, mFSAASamples,
|
||||
AGL_RED_SIZE, 8,
|
||||
AGL_GREEN_SIZE, 8,
|
||||
AGL_BLUE_SIZE, 8,
|
||||
AGL_ALPHA_SIZE, 8,
|
||||
AGL_DEPTH_SIZE, 24,
|
||||
AGL_STENCIL_SIZE, 8,
|
||||
AGL_NONE
|
||||
};
|
||||
|
||||
LL_DEBUGS("Window") << "createContext: creating windowed pixelformat" << LL_ENDL;
|
||||
|
|
|
|||
|
|
@ -4,15 +4,15 @@
|
|||
<RenderAvatarCloth value="FALSE"/>
|
||||
<!--Default for now-->
|
||||
<RenderAvatarLODFactor value="1.0"/>
|
||||
<!--Default for now-->
|
||||
<RenderAvatarPhysicsLODFactor value="0.9"/>
|
||||
<!--Default for now-->
|
||||
<RenderAvatarPhysicsLODFactor value="0.9"/>
|
||||
<!--NO SHADERS-->
|
||||
<RenderAvatarVP value="TRUE"/>
|
||||
<!--Short Range-->
|
||||
<RenderFarClip value="128"/>
|
||||
<!--Default for now-->
|
||||
<RenderFlexTimeFactor value="1"/>
|
||||
<!--256... but they don't use this-->
|
||||
<!--256... but they do not use this-->
|
||||
<RenderGlowResolutionPow value="9"/>
|
||||
<!--Low number-->
|
||||
<RenderMaxPartCount value="4096"/>
|
||||
|
|
@ -34,11 +34,10 @@
|
|||
<VertexShaderEnable value="TRUE"/>
|
||||
<!--NO SHADERS-->
|
||||
<WindLightUseAtmosShaders value="TRUE"/>
|
||||
<!--Deferred Shading-->
|
||||
<RenderDeferred value="FALSE"/>
|
||||
<!--SSAO Disabled-->
|
||||
<RenderDeferredSSAO value="FALSE"/>
|
||||
<!--Sun Shadows-->
|
||||
<RenderShadowDetail value="0"/>
|
||||
|
||||
<!--Deferred Shading-->
|
||||
<RenderDeferred value="FALSE"/>
|
||||
<!--SSAO Disabled-->
|
||||
<RenderDeferredSSAO value="FALSE"/>
|
||||
<!--Sun Shadows-->
|
||||
<RenderShadowDetail value="0"/>
|
||||
</settings>
|
||||
|
|
|
|||
|
|
@ -4,17 +4,17 @@
|
|||
<RenderAvatarCloth value="FALSE"/>
|
||||
<!--Default for now-->
|
||||
<RenderAvatarLODFactor value="0.5"/>
|
||||
<!--Default for now-->
|
||||
<RenderAvatarPhysicsLODFactor value="0.0"/>
|
||||
<!--Default for now-->
|
||||
<RenderAvatarMaxVisible value="3"/>
|
||||
<!--Default for now-->
|
||||
<RenderAvatarPhysicsLODFactor value="0.0"/>
|
||||
<!--Default for now-->
|
||||
<RenderAvatarMaxVisible value="3"/>
|
||||
<!--NO SHADERS-->
|
||||
<RenderAvatarVP value="FALSE"/>
|
||||
<!--Short Range-->
|
||||
<RenderFarClip value="64"/>
|
||||
<!--Default for now-->
|
||||
<RenderFlexTimeFactor value="0.5"/>
|
||||
<!--256... but they don't use this-->
|
||||
<!--256... but they do not use this-->
|
||||
<RenderGlowResolutionPow value="8"/>
|
||||
<!--Low number-->
|
||||
<RenderMaxPartCount value="1024"/>
|
||||
|
|
@ -36,11 +36,10 @@
|
|||
<VertexShaderEnable value="FALSE"/>
|
||||
<!--NO SHADERS-->
|
||||
<WindLightUseAtmosShaders value="FALSE"/>
|
||||
<!--No Deferred Shading-->
|
||||
<RenderDeferred value="FALSE"/>
|
||||
<!--SSAO Disabled-->
|
||||
<RenderDeferredSSAO value="FALSE"/>
|
||||
<!--No Shadows-->
|
||||
<RenderShadowDetail value="0"/>
|
||||
|
||||
<!--No Deferred Shading-->
|
||||
<RenderDeferred value="FALSE"/>
|
||||
<!--SSAO Disabled-->
|
||||
<RenderDeferredSSAO value="FALSE"/>
|
||||
<!--No Shadows-->
|
||||
<RenderShadowDetail value="0"/>
|
||||
</settings>
|
||||
|
|
|
|||
|
|
@ -4,15 +4,15 @@
|
|||
<RenderAvatarCloth value="FALSE"/>
|
||||
<!--Default for now-->
|
||||
<RenderAvatarLODFactor value="0.5"/>
|
||||
<!--Default for now-->
|
||||
<RenderAvatarPhysicsLODFactor value="0.75"/>
|
||||
<!--Default for now-->
|
||||
<RenderAvatarPhysicsLODFactor value="0.75"/>
|
||||
<!--NO SHADERS-->
|
||||
<RenderAvatarVP value="TRUE"/>
|
||||
<!--Short Range-->
|
||||
<RenderFarClip value="96"/>
|
||||
<!--Default for now-->
|
||||
<RenderFlexTimeFactor value="1"/>
|
||||
<!--256... but they don't use this-->
|
||||
<!--256... but they do not use this-->
|
||||
<RenderGlowResolutionPow value="8"/>
|
||||
<!--Low number-->
|
||||
<RenderMaxPartCount value="2048"/>
|
||||
|
|
@ -34,11 +34,10 @@
|
|||
<VertexShaderEnable value="TRUE"/>
|
||||
<!--NO SHADERS-->
|
||||
<WindLightUseAtmosShaders value="FALSE"/>
|
||||
<!--No Deferred Shading-->
|
||||
<RenderDeferred value="FALSE"/>
|
||||
<!--SSAO Disabled-->
|
||||
<RenderDeferredSSAO value="FALSE"/>
|
||||
<!--No Shadows-->
|
||||
<RenderShadowDetail value="0"/>
|
||||
|
||||
<!--No Deferred Shading-->
|
||||
<RenderDeferred value="FALSE"/>
|
||||
<!--SSAO Disabled-->
|
||||
<RenderDeferredSSAO value="FALSE"/>
|
||||
<!--No Shadows-->
|
||||
<RenderShadowDetail value="0"/>
|
||||
</settings>
|
||||
|
|
|
|||
|
|
@ -1,70 +0,0 @@
|
|||
/**
|
||||
* @file avatarAlphaF.glsl
|
||||
*
|
||||
* $LicenseInfo:firstyear=2007&license=viewerlgpl$
|
||||
* $/LicenseInfo$
|
||||
*/
|
||||
|
||||
#version 120
|
||||
|
||||
uniform sampler2D diffuseMap;
|
||||
uniform sampler2DShadow shadowMap0;
|
||||
uniform sampler2DShadow shadowMap1;
|
||||
uniform sampler2DShadow shadowMap2;
|
||||
uniform sampler2DShadow shadowMap3;
|
||||
uniform sampler2D noiseMap;
|
||||
|
||||
uniform mat4 shadow_matrix[6];
|
||||
uniform vec4 shadow_clip;
|
||||
|
||||
vec3 atmosLighting(vec3 light);
|
||||
vec3 scaleSoftClip(vec3 light);
|
||||
|
||||
varying vec3 vary_ambient;
|
||||
varying vec3 vary_directional;
|
||||
varying vec4 vary_position;
|
||||
varying vec3 vary_normal;
|
||||
|
||||
void main()
|
||||
{
|
||||
float shadow = 1.0;
|
||||
vec4 pos = vary_position;
|
||||
vec3 norm = normalize(vary_normal);
|
||||
|
||||
vec3 nz = texture2D(noiseMap, gl_FragCoord.xy/128.0).xyz;
|
||||
|
||||
if (pos.z > -shadow_clip.w)
|
||||
{
|
||||
|
||||
if (pos.z < -shadow_clip.z)
|
||||
{
|
||||
vec4 lpos = shadow_matrix[3]*pos;
|
||||
shadow = shadow2DProj(shadowMap3, lpos).x;
|
||||
}
|
||||
else if (pos.z < -shadow_clip.y)
|
||||
{
|
||||
vec4 lpos = shadow_matrix[2]*pos;
|
||||
shadow = shadow2DProj(shadowMap2, lpos).x;
|
||||
}
|
||||
else if (pos.z < -shadow_clip.x)
|
||||
{
|
||||
vec4 lpos = shadow_matrix[1]*pos;
|
||||
shadow = shadow2DProj(shadowMap1, lpos).x;
|
||||
}
|
||||
else
|
||||
{
|
||||
vec4 lpos = shadow_matrix[0]*pos;
|
||||
shadow = shadow2DProj(shadowMap0, lpos).x;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
vec4 col = vec4(vary_ambient + vary_directional*shadow, gl_Color.a);
|
||||
vec4 color = texture2D(diffuseMap, gl_TexCoord[0].xy) * col;
|
||||
|
||||
color.rgb = atmosLighting(color.rgb);
|
||||
|
||||
color.rgb = scaleSoftClip(color.rgb);
|
||||
|
||||
gl_FragColor = color;
|
||||
}
|
||||
|
|
@ -22,11 +22,36 @@ vec3 scaleUpLight(vec3 light);
|
|||
varying vec3 vary_position;
|
||||
varying vec3 vary_ambient;
|
||||
varying vec3 vary_directional;
|
||||
varying vec3 vary_normal;
|
||||
varying vec3 vary_fragcoord;
|
||||
varying vec3 vary_pointlight_col;
|
||||
|
||||
uniform float near_clip;
|
||||
|
||||
float calcPointLightOrSpotLight(vec3 v, vec3 n, vec4 lp, vec3 ln, float la, float fa, float is_pointlight)
|
||||
{
|
||||
//get light vector
|
||||
vec3 lv = lp.xyz-v;
|
||||
|
||||
//get distance
|
||||
float d = length(lv);
|
||||
|
||||
//normalize light vector
|
||||
lv *= 1.0/d;
|
||||
|
||||
//distance attenuation
|
||||
float dist2 = d*d/(la*la);
|
||||
float da = clamp(1.0-(dist2-1.0*(1.0-fa))/fa, 0.0, 1.0);
|
||||
|
||||
// spotlight coefficient.
|
||||
float spot = max(dot(-ln, lv), is_pointlight);
|
||||
da *= spot*spot; // GL_SPOT_EXPONENT=2
|
||||
|
||||
//angular attenuation
|
||||
da *= calcDirectionalLight(n, lv);
|
||||
|
||||
return da;
|
||||
}
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_TexCoord[0] = gl_MultiTexCoord0;
|
||||
|
|
@ -49,7 +74,6 @@ void main()
|
|||
gl_Position = frag_pos;
|
||||
|
||||
vary_position = pos.xyz;
|
||||
vary_normal = norm;
|
||||
|
||||
calcAtmospherics(pos.xyz);
|
||||
|
||||
|
|
@ -57,18 +81,20 @@ void main()
|
|||
|
||||
vec4 col = vec4(0.0, 0.0, 0.0, gl_Color.a);
|
||||
|
||||
// Collect normal lights (need to be divided by two, as we later multiply by 2)
|
||||
col.rgb += gl_LightSource[2].diffuse.rgb*calcPointLightOrSpotLight(pos.xyz, norm, gl_LightSource[2].position, gl_LightSource[2].spotDirection.xyz, gl_LightSource[2].linearAttenuation, gl_LightSource[2].specular.a);
|
||||
col.rgb += gl_LightSource[3].diffuse.rgb*calcPointLightOrSpotLight(pos.xyz, norm, gl_LightSource[3].position, gl_LightSource[3].spotDirection.xyz, gl_LightSource[3].linearAttenuation, gl_LightSource[3].specular.a);
|
||||
col.rgb += gl_LightSource[4].diffuse.rgb*calcPointLightOrSpotLight(pos.xyz, norm, gl_LightSource[4].position, gl_LightSource[4].spotDirection.xyz, gl_LightSource[4].linearAttenuation, gl_LightSource[4].specular.a);
|
||||
col.rgb += gl_LightSource[5].diffuse.rgb*calcPointLightOrSpotLight(pos.xyz, norm, gl_LightSource[5].position, gl_LightSource[5].spotDirection.xyz, gl_LightSource[5].linearAttenuation, gl_LightSource[5].specular.a);
|
||||
col.rgb += gl_LightSource[6].diffuse.rgb*calcPointLightOrSpotLight(pos.xyz, norm, gl_LightSource[6].position, gl_LightSource[6].spotDirection.xyz, gl_LightSource[6].linearAttenuation, gl_LightSource[6].specular.a);
|
||||
col.rgb += gl_LightSource[7].diffuse.rgb*calcPointLightOrSpotLight(pos.xyz, norm, gl_LightSource[7].position, gl_LightSource[7].spotDirection.xyz, gl_LightSource[7].linearAttenuation, gl_LightSource[7].specular.a);
|
||||
col.rgb += gl_LightSource[1].diffuse.rgb*calcDirectionalLight(norm, gl_LightSource[1].position.xyz);
|
||||
col.rgb = scaleDownLight(col.rgb);
|
||||
// Collect normal lights
|
||||
col.rgb += gl_LightSource[2].diffuse.rgb*calcPointLightOrSpotLight(pos.xyz, norm, gl_LightSource[2].position, gl_LightSource[2].spotDirection.xyz, gl_LightSource[2].linearAttenuation, gl_LightSource[2].quadraticAttenuation, gl_LightSource[2].specular.a);
|
||||
col.rgb += gl_LightSource[3].diffuse.rgb*calcPointLightOrSpotLight(pos.xyz, norm, gl_LightSource[3].position, gl_LightSource[3].spotDirection.xyz, gl_LightSource[3].linearAttenuation, gl_LightSource[3].quadraticAttenuation ,gl_LightSource[3].specular.a);
|
||||
col.rgb += gl_LightSource[4].diffuse.rgb*calcPointLightOrSpotLight(pos.xyz, norm, gl_LightSource[4].position, gl_LightSource[4].spotDirection.xyz, gl_LightSource[4].linearAttenuation, gl_LightSource[4].quadraticAttenuation, gl_LightSource[4].specular.a);
|
||||
col.rgb += gl_LightSource[5].diffuse.rgb*calcPointLightOrSpotLight(pos.xyz, norm, gl_LightSource[5].position, gl_LightSource[5].spotDirection.xyz, gl_LightSource[5].linearAttenuation, gl_LightSource[5].quadraticAttenuation, gl_LightSource[5].specular.a);
|
||||
col.rgb += gl_LightSource[6].diffuse.rgb*calcPointLightOrSpotLight(pos.xyz, norm, gl_LightSource[6].position, gl_LightSource[6].spotDirection.xyz, gl_LightSource[6].linearAttenuation, gl_LightSource[6].quadraticAttenuation, gl_LightSource[6].specular.a);
|
||||
col.rgb += gl_LightSource[7].diffuse.rgb*calcPointLightOrSpotLight(pos.xyz, norm, gl_LightSource[7].position, gl_LightSource[7].spotDirection.xyz, gl_LightSource[7].linearAttenuation, gl_LightSource[7].quadraticAttenuation, gl_LightSource[7].specular.a);
|
||||
|
||||
vary_pointlight_col = col.rgb*gl_Color.rgb;
|
||||
|
||||
col.rgb = vec3(0,0,0);
|
||||
|
||||
// Add windlight lights
|
||||
col.rgb += atmosAmbient(vec3(0.));
|
||||
col.rgb = atmosAmbient(vec3(0.));
|
||||
|
||||
vary_ambient = col.rgb*gl_Color.rgb;
|
||||
vary_directional = gl_Color.rgb*atmosAffectDirectionalLight(max(calcDirectionalLight(norm, gl_LightSource[0].position.xyz), (1.0-gl_Color.a)*(1.0-gl_Color.a)));
|
||||
|
|
|
|||
|
|
@ -0,0 +1,20 @@
|
|||
/**
|
||||
* @file multiPointLightV.glsl
|
||||
*
|
||||
* $LicenseInfo:firstyear=2007&license=viewerlgpl$
|
||||
* $/LicenseInfo$
|
||||
*/
|
||||
|
||||
#version 120
|
||||
|
||||
varying vec4 vary_fragcoord;
|
||||
|
||||
void main()
|
||||
{
|
||||
//transform vertex
|
||||
vec4 pos = gl_ModelViewProjectionMatrix * gl_Vertex;
|
||||
vary_fragcoord = pos;
|
||||
|
||||
gl_Position = pos;
|
||||
gl_FrontColor = gl_Color;
|
||||
}
|
||||
|
|
@ -1,100 +0,0 @@
|
|||
/**
|
||||
* @file avatarAlphaF.glsl
|
||||
*
|
||||
* $LicenseInfo:firstyear=2007&license=viewerlgpl$
|
||||
* $/LicenseInfo$
|
||||
*/
|
||||
|
||||
#version 120
|
||||
|
||||
#extension GL_ARB_texture_rectangle : enable
|
||||
|
||||
uniform sampler2D diffuseMap;
|
||||
uniform sampler2DRectShadow shadowMap0;
|
||||
uniform sampler2DRectShadow shadowMap1;
|
||||
uniform sampler2DRectShadow shadowMap2;
|
||||
uniform sampler2DRectShadow shadowMap3;
|
||||
uniform sampler2D noiseMap;
|
||||
|
||||
uniform mat4 shadow_matrix[6];
|
||||
uniform vec4 shadow_clip;
|
||||
uniform vec2 screen_res;
|
||||
uniform vec2 shadow_res;
|
||||
|
||||
vec3 atmosLighting(vec3 light);
|
||||
vec3 scaleSoftClip(vec3 light);
|
||||
|
||||
varying vec3 vary_ambient;
|
||||
varying vec3 vary_directional;
|
||||
varying vec3 vary_position;
|
||||
varying vec3 vary_normal;
|
||||
|
||||
uniform float shadow_bias;
|
||||
|
||||
float pcfShadow(sampler2DRectShadow shadowMap, vec4 stc, float scl)
|
||||
{
|
||||
stc.xyz /= stc.w;
|
||||
stc.z += shadow_bias;
|
||||
|
||||
float cs = shadow2DRect(shadowMap, stc.xyz).x;
|
||||
float shadow = cs;
|
||||
|
||||
shadow += max(shadow2DRect(shadowMap, stc.xyz+vec3(scl, scl, 0.0)).x, cs);
|
||||
shadow += max(shadow2DRect(shadowMap, stc.xyz+vec3(scl, -scl, 0.0)).x, cs);
|
||||
shadow += max(shadow2DRect(shadowMap, stc.xyz+vec3(-scl, scl, 0.0)).x, cs);
|
||||
shadow += max(shadow2DRect(shadowMap, stc.xyz+vec3(-scl, -scl, 0.0)).x, cs);
|
||||
|
||||
return shadow/5.0;
|
||||
}
|
||||
|
||||
void main()
|
||||
{
|
||||
float shadow = 1.0;
|
||||
vec4 pos = vec4(vary_position, 1.0);
|
||||
vec3 norm = normalize(vary_normal);
|
||||
|
||||
//vec3 nz = texture2D(noiseMap, gl_FragCoord.xy/128.0).xyz;
|
||||
|
||||
vec4 spos = pos;
|
||||
|
||||
if (spos.z > -shadow_clip.w)
|
||||
{
|
||||
vec4 lpos;
|
||||
|
||||
if (spos.z < -shadow_clip.z)
|
||||
{
|
||||
lpos = shadow_matrix[3]*spos;
|
||||
lpos.xy *= shadow_res;
|
||||
shadow = pcfShadow(shadowMap3, lpos, 1.5);
|
||||
shadow += max((pos.z+shadow_clip.z)/(shadow_clip.z-shadow_clip.w)*2.0-1.0, 0.0);
|
||||
}
|
||||
else if (spos.z < -shadow_clip.y)
|
||||
{
|
||||
lpos = shadow_matrix[2]*spos;
|
||||
lpos.xy *= shadow_res;
|
||||
shadow = pcfShadow(shadowMap2, lpos, 1.5);
|
||||
}
|
||||
else if (spos.z < -shadow_clip.x)
|
||||
{
|
||||
lpos = shadow_matrix[1]*spos;
|
||||
lpos.xy *= shadow_res;
|
||||
shadow = pcfShadow(shadowMap1, lpos, 1.5);
|
||||
}
|
||||
else
|
||||
{
|
||||
lpos = shadow_matrix[0]*spos;
|
||||
lpos.xy *= shadow_res;
|
||||
shadow = pcfShadow(shadowMap0, lpos, 1.5);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
vec4 col = vec4(vary_ambient + vary_directional*shadow, gl_Color.a);
|
||||
vec4 color = texture2D(diffuseMap, gl_TexCoord[0].xy) * col;
|
||||
|
||||
color.rgb = atmosLighting(color.rgb);
|
||||
|
||||
color.rgb = scaleSoftClip(color.rgb);
|
||||
|
||||
gl_FragColor = color;
|
||||
}
|
||||
|
|
@ -22,13 +22,38 @@ vec3 scaleUpLight(vec3 light);
|
|||
varying vec3 vary_position;
|
||||
varying vec3 vary_ambient;
|
||||
varying vec3 vary_directional;
|
||||
varying vec3 vary_normal;
|
||||
varying vec3 vary_fragcoord;
|
||||
varying vec3 vary_pointlight_col;
|
||||
|
||||
uniform float near_clip;
|
||||
uniform float shadow_offset;
|
||||
uniform float shadow_bias;
|
||||
|
||||
float calcPointLightOrSpotLight(vec3 v, vec3 n, vec4 lp, vec3 ln, float la, float fa, float is_pointlight)
|
||||
{
|
||||
//get light vector
|
||||
vec3 lv = lp.xyz-v;
|
||||
|
||||
//get distance
|
||||
float d = length(lv);
|
||||
|
||||
//normalize light vector
|
||||
lv *= 1.0/d;
|
||||
|
||||
//distance attenuation
|
||||
float dist2 = d*d/(la*la);
|
||||
float da = clamp(1.0-(dist2-1.0*(1.0-fa))/fa, 0.0, 1.0);
|
||||
|
||||
// spotlight coefficient.
|
||||
float spot = max(dot(-ln, lv), is_pointlight);
|
||||
da *= spot*spot; // GL_SPOT_EXPONENT=2
|
||||
|
||||
//angular attenuation
|
||||
da *= calcDirectionalLight(n, lv);
|
||||
|
||||
return da;
|
||||
}
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_TexCoord[0] = gl_MultiTexCoord0;
|
||||
|
|
@ -51,7 +76,6 @@ void main()
|
|||
|
||||
float dp_directional_light = max(0.0, dot(norm, gl_LightSource[0].position.xyz));
|
||||
vary_position = pos.xyz + gl_LightSource[0].position.xyz * (1.0-dp_directional_light)*shadow_offset;
|
||||
vary_normal = norm;
|
||||
|
||||
calcAtmospherics(pos.xyz);
|
||||
|
||||
|
|
@ -59,18 +83,20 @@ void main()
|
|||
|
||||
vec4 col = vec4(0.0, 0.0, 0.0, gl_Color.a);
|
||||
|
||||
// Collect normal lights (need to be divided by two, as we later multiply by 2)
|
||||
col.rgb += gl_LightSource[2].diffuse.rgb*calcPointLightOrSpotLight(pos.xyz, norm, gl_LightSource[2].position, gl_LightSource[2].spotDirection.xyz, gl_LightSource[2].linearAttenuation, gl_LightSource[2].specular.a);
|
||||
col.rgb += gl_LightSource[3].diffuse.rgb*calcPointLightOrSpotLight(pos.xyz, norm, gl_LightSource[3].position, gl_LightSource[3].spotDirection.xyz, gl_LightSource[3].linearAttenuation, gl_LightSource[3].specular.a);
|
||||
col.rgb += gl_LightSource[4].diffuse.rgb*calcPointLightOrSpotLight(pos.xyz, norm, gl_LightSource[4].position, gl_LightSource[4].spotDirection.xyz, gl_LightSource[4].linearAttenuation, gl_LightSource[4].specular.a);
|
||||
col.rgb += gl_LightSource[5].diffuse.rgb*calcPointLightOrSpotLight(pos.xyz, norm, gl_LightSource[5].position, gl_LightSource[5].spotDirection.xyz, gl_LightSource[5].linearAttenuation, gl_LightSource[5].specular.a);
|
||||
col.rgb += gl_LightSource[6].diffuse.rgb*calcPointLightOrSpotLight(pos.xyz, norm, gl_LightSource[6].position, gl_LightSource[6].spotDirection.xyz, gl_LightSource[6].linearAttenuation, gl_LightSource[6].specular.a);
|
||||
col.rgb += gl_LightSource[7].diffuse.rgb*calcPointLightOrSpotLight(pos.xyz, norm, gl_LightSource[7].position, gl_LightSource[7].spotDirection.xyz, gl_LightSource[7].linearAttenuation, gl_LightSource[7].specular.a);
|
||||
col.rgb += gl_LightSource[1].diffuse.rgb*calcDirectionalLight(norm, gl_LightSource[1].position.xyz);
|
||||
col.rgb = scaleDownLight(col.rgb);
|
||||
// Collect normal lights
|
||||
col.rgb += gl_LightSource[2].diffuse.rgb*calcPointLightOrSpotLight(pos.xyz, norm, gl_LightSource[2].position, gl_LightSource[2].spotDirection.xyz, gl_LightSource[2].linearAttenuation, gl_LightSource[2].quadraticAttenuation, gl_LightSource[2].specular.a);
|
||||
col.rgb += gl_LightSource[3].diffuse.rgb*calcPointLightOrSpotLight(pos.xyz, norm, gl_LightSource[3].position, gl_LightSource[3].spotDirection.xyz, gl_LightSource[3].linearAttenuation, gl_LightSource[3].quadraticAttenuation ,gl_LightSource[3].specular.a);
|
||||
col.rgb += gl_LightSource[4].diffuse.rgb*calcPointLightOrSpotLight(pos.xyz, norm, gl_LightSource[4].position, gl_LightSource[4].spotDirection.xyz, gl_LightSource[4].linearAttenuation, gl_LightSource[4].quadraticAttenuation, gl_LightSource[4].specular.a);
|
||||
col.rgb += gl_LightSource[5].diffuse.rgb*calcPointLightOrSpotLight(pos.xyz, norm, gl_LightSource[5].position, gl_LightSource[5].spotDirection.xyz, gl_LightSource[5].linearAttenuation, gl_LightSource[5].quadraticAttenuation, gl_LightSource[5].specular.a);
|
||||
col.rgb += gl_LightSource[6].diffuse.rgb*calcPointLightOrSpotLight(pos.xyz, norm, gl_LightSource[6].position, gl_LightSource[6].spotDirection.xyz, gl_LightSource[6].linearAttenuation, gl_LightSource[6].quadraticAttenuation, gl_LightSource[6].specular.a);
|
||||
col.rgb += gl_LightSource[7].diffuse.rgb*calcPointLightOrSpotLight(pos.xyz, norm, gl_LightSource[7].position, gl_LightSource[7].spotDirection.xyz, gl_LightSource[7].linearAttenuation, gl_LightSource[7].quadraticAttenuation, gl_LightSource[7].specular.a);
|
||||
|
||||
vary_pointlight_col = col.rgb*gl_Color.rgb;
|
||||
|
||||
col.rgb = vec3(0,0,0);
|
||||
|
||||
// Add windlight lights
|
||||
col.rgb += atmosAmbient(vec3(0.));
|
||||
col.rgb = atmosAmbient(vec3(0.));
|
||||
|
||||
vary_ambient = col.rgb*gl_Color.rgb;
|
||||
vary_directional = gl_Color.rgb*atmosAffectDirectionalLight(max(calcDirectionalLight(norm, gl_LightSource[0].position.xyz), (1.0-gl_Color.a)*(1.0-gl_Color.a)));
|
||||
|
|
|
|||
|
|
@ -4,15 +4,15 @@
|
|||
<RenderAvatarCloth value="TRUE"/>
|
||||
<!--Default for now-->
|
||||
<RenderAvatarLODFactor value="1.0"/>
|
||||
<!--Default for now-->
|
||||
<RenderAvatarPhysicsLODFactor value="1.0"/>
|
||||
<!--Default for now-->
|
||||
<RenderAvatarPhysicsLODFactor value="1.0"/>
|
||||
<!--NO SHADERS-->
|
||||
<RenderAvatarVP value="TRUE"/>
|
||||
<!--Short Range-->
|
||||
<RenderFarClip value="256"/>
|
||||
<!--Default for now-->
|
||||
<RenderFlexTimeFactor value="1"/>
|
||||
<!--256... but they don't use this-->
|
||||
<!--256... but they do not use this-->
|
||||
<RenderGlowResolutionPow value="9"/>
|
||||
<!--Low number-->
|
||||
<RenderMaxPartCount value="4096"/>
|
||||
|
|
@ -34,11 +34,10 @@
|
|||
<VertexShaderEnable value="TRUE"/>
|
||||
<!--NO SHADERS-->
|
||||
<WindLightUseAtmosShaders value="TRUE"/>
|
||||
<!--Deferred Shading-->
|
||||
<RenderDeferred value="TRUE"/>
|
||||
<!--SSAO Enabled-->
|
||||
<RenderDeferredSSAO value="TRUE"/>
|
||||
<!--Full Shadows-->
|
||||
<RenderShadowDetail value="2"/>
|
||||
|
||||
<!--Deferred Shading-->
|
||||
<RenderDeferred value="TRUE"/>
|
||||
<!--SSAO Enabled-->
|
||||
<RenderDeferredSSAO value="TRUE"/>
|
||||
<!--Full Shadows-->
|
||||
<RenderShadowDetail value="2"/>
|
||||
</settings>
|
||||
|
|
|
|||
|
|
@ -24,11 +24,11 @@ version 22
|
|||
//
|
||||
list all
|
||||
RenderAnisotropic 1 0
|
||||
RenderAvatarCloth 0 0
|
||||
RenderAvatarCloth 1 1
|
||||
RenderAvatarLODFactor 1 1.0
|
||||
RenderAvatarPhysicsLODFactor 1 1.0
|
||||
RenderAvatarMaxVisible 1 12
|
||||
RenderAvatarVP 1 0
|
||||
RenderAvatarVP 1 1
|
||||
RenderCubeMap 1 1
|
||||
RenderDelayVBUpdate 1 0
|
||||
RenderFarClip 1 256
|
||||
|
|
@ -41,7 +41,7 @@ RenderLocalLights 1 1
|
|||
RenderMaxPartCount 1 8192
|
||||
RenderNightBrightness 1 1.0
|
||||
RenderObjectBump 1 1
|
||||
RenderReflectionDetail 1 3
|
||||
RenderReflectionDetail 1 4
|
||||
RenderTerrainDetail 1 1
|
||||
RenderTerrainLODFactor 1 2.0
|
||||
RenderTransparentWater 1 1
|
||||
|
|
@ -49,23 +49,21 @@ RenderTreeLODFactor 1 1.0
|
|||
RenderUseImpostors 1 1
|
||||
RenderVBOEnable 1 1
|
||||
RenderVolumeLODFactor 1 2.0
|
||||
RenderWaterReflections 1 1
|
||||
UseStartScreen 1 1
|
||||
UseOcclusion 1 1
|
||||
VertexShaderEnable 1 1
|
||||
WindLightUseAtmosShaders 1 1
|
||||
WLSkyDetail 1 128
|
||||
RenderUseCleverUI 1 1
|
||||
Disregard128DefaultDrawDistance 1 1
|
||||
Disregard96DefaultDrawDistance 1 1
|
||||
RenderTextureMemoryMultiple 1 0.5
|
||||
Disregard128DefaultDrawDistance 1 1
|
||||
Disregard96DefaultDrawDistance 1 1
|
||||
RenderShaderLightingMaxLevel 1 3
|
||||
SkyUseClassicClouds 1 1
|
||||
WatchdogDisabled 1 1
|
||||
RenderDeferred 1 1
|
||||
RenderDeferredSSAO 1 1
|
||||
RenderShadowDetail 1 2
|
||||
|
||||
WatchdogDisabled 1 1
|
||||
RenderUseStreamVBO 1 1
|
||||
|
||||
//
|
||||
// Low Graphics Settings
|
||||
|
|
@ -90,15 +88,13 @@ RenderTransparentWater 1 0
|
|||
RenderTreeLODFactor 1 0
|
||||
RenderUseImpostors 1 1
|
||||
RenderVolumeLODFactor 1 0.5
|
||||
RenderWaterReflections 1 0
|
||||
VertexShaderEnable 1 0
|
||||
WindLightUseAtmosShaders 1 0
|
||||
WLSkyDetail 1 48
|
||||
SkyUseClassicClouds 1 0
|
||||
RenderDeferred 1 0
|
||||
RenderDeferredSSAO 1 0
|
||||
RenderShadowDetail 1 2
|
||||
|
||||
RenderShadowDetail 1 0
|
||||
|
||||
//
|
||||
// Mid Graphics Settings
|
||||
|
|
@ -122,14 +118,12 @@ RenderTransparentWater 1 1
|
|||
RenderTreeLODFactor 1 0.5
|
||||
RenderUseImpostors 1 1
|
||||
RenderVolumeLODFactor 1 1.125
|
||||
RenderWaterReflections 1 0
|
||||
VertexShaderEnable 1 1
|
||||
WindLightUseAtmosShaders 1 0
|
||||
WLSkyDetail 1 48
|
||||
RenderDeferred 1 0
|
||||
RenderDeferredSSAO 1 0
|
||||
RenderShadowDetail 1 2
|
||||
|
||||
RenderShadowDetail 1 0
|
||||
|
||||
//
|
||||
// High Graphics Settings (purty)
|
||||
|
|
@ -153,7 +147,6 @@ RenderTransparentWater 1 1
|
|||
RenderTreeLODFactor 1 0.5
|
||||
RenderUseImpostors 1 1
|
||||
RenderVolumeLODFactor 1 1.125
|
||||
RenderWaterReflections 1 0
|
||||
VertexShaderEnable 1 1
|
||||
WindLightUseAtmosShaders 1 1
|
||||
WLSkyDetail 1 48
|
||||
|
|
@ -161,7 +154,6 @@ RenderDeferred 1 0
|
|||
RenderDeferredSSAO 1 0
|
||||
RenderShadowDetail 1 2
|
||||
|
||||
|
||||
//
|
||||
// Ultra graphics (REALLY PURTY!)
|
||||
//
|
||||
|
|
@ -177,14 +169,13 @@ RenderGlowResolutionPow 1 9
|
|||
RenderLocalLights 1 1
|
||||
RenderMaxPartCount 1 8192
|
||||
RenderObjectBump 1 1
|
||||
RenderReflectionDetail 1 3
|
||||
RenderReflectionDetail 1 4
|
||||
RenderTerrainDetail 1 1
|
||||
RenderTerrainLODFactor 1 2.0
|
||||
RenderTransparentWater 1 1
|
||||
RenderTreeLODFactor 1 1.0
|
||||
RenderUseImpostors 1 1
|
||||
RenderVolumeLODFactor 1 2.0
|
||||
RenderWaterReflections 1 1
|
||||
VertexShaderEnable 1 1
|
||||
WindLightUseAtmosShaders 1 1
|
||||
WLSkyDetail 1 128
|
||||
|
|
@ -192,7 +183,6 @@ RenderDeferred 1 0
|
|||
RenderDeferredSSAO 1 0
|
||||
RenderShadowDetail 1 2
|
||||
|
||||
|
||||
//
|
||||
// Class Unknown Hardware (unknown)
|
||||
//
|
||||
|
|
@ -229,9 +219,12 @@ RenderVBOEnable 1 1
|
|||
list NoPixelShaders
|
||||
RenderAvatarVP 0 0
|
||||
RenderAvatarCloth 0 0
|
||||
RenderWaterReflections 0 0
|
||||
RenderReflectionDetail 0 0
|
||||
VertexShaderEnable 0 0
|
||||
WindLightUseAtmosShaders 0 0
|
||||
RenderDeferred 0 0
|
||||
RenderDeferredSSAO 0 0
|
||||
RenderShadowDetail 0 0
|
||||
|
||||
//
|
||||
// No Vertex Shaders available
|
||||
|
|
@ -239,10 +232,14 @@ WindLightUseAtmosShaders 0 0
|
|||
list NoVertexShaders
|
||||
RenderAvatarVP 0 0
|
||||
RenderAvatarCloth 0 0
|
||||
RenderWaterReflections 0 0
|
||||
RenderReflectionDetail 0 0
|
||||
VertexShaderEnable 0 0
|
||||
WindLightUseAtmosShaders 0 0
|
||||
RenderDeferred 0 0
|
||||
RenderDeferredSSAO 0 0
|
||||
RenderShadowDetail 0 0
|
||||
|
||||
//
|
||||
// "Default" setups for safe, low, medium, high
|
||||
//
|
||||
list safe
|
||||
|
|
@ -255,8 +252,11 @@ RenderMaxPartCount 1 1024
|
|||
RenderTerrainDetail 1 0
|
||||
RenderUseImpostors 0 0
|
||||
RenderVBOEnable 1 0
|
||||
RenderWaterReflections 0 0
|
||||
RenderReflectionDetail 0 0
|
||||
WindLightUseAtmosShaders 0 0
|
||||
RenderDeferred 0 0
|
||||
RenderDeferredSSAO 0 0
|
||||
RenderShadowDetail 0 0
|
||||
|
||||
//
|
||||
// CPU based feature masks
|
||||
|
|
|
|||
|
|
@ -152,7 +152,7 @@ WindLightUseAtmosShaders 1 1
|
|||
WLSkyDetail 1 48
|
||||
RenderDeferred 1 0
|
||||
RenderDeferredSSAO 1 0
|
||||
RenderShadowDetail 1 0
|
||||
RenderShadowDetail 1 2
|
||||
|
||||
//
|
||||
// Ultra graphics (REALLY PURTY!)
|
||||
|
|
@ -181,7 +181,7 @@ WindLightUseAtmosShaders 1 1
|
|||
WLSkyDetail 1 128
|
||||
RenderDeferred 1 0
|
||||
RenderDeferredSSAO 1 0
|
||||
RenderShadowDetail 1 0
|
||||
RenderShadowDetail 1 2
|
||||
|
||||
//
|
||||
// Class Unknown Hardware (unknown)
|
||||
|
|
|
|||
|
|
@ -987,9 +987,15 @@ void LLFloaterPreference::refreshEnabledState()
|
|||
LLCheckBoxCtrl* ctrl_avatar_vp = getChild<LLCheckBoxCtrl>("AvatarVertexProgram");
|
||||
// Avatar Render Mode
|
||||
LLCheckBoxCtrl* ctrl_avatar_cloth = getChild<LLCheckBoxCtrl>("AvatarCloth");
|
||||
|
||||
bool avatar_vp_enabled = LLFeatureManager::getInstance()->isFeatureAvailable("RenderAvatarVP");
|
||||
if (LLViewerShaderMgr::sInitialized)
|
||||
{
|
||||
S32 max_avatar_shader = LLViewerShaderMgr::instance()->mMaxAvatarShaderLevel;
|
||||
avatar_vp_enabled = (max_avatar_shader > 0) ? TRUE : FALSE;
|
||||
}
|
||||
|
||||
S32 max_avatar_shader = LLViewerShaderMgr::instance()->mMaxAvatarShaderLevel;
|
||||
ctrl_avatar_vp->setEnabled((max_avatar_shader > 0) ? TRUE : FALSE);
|
||||
ctrl_avatar_vp->setEnabled(avatar_vp_enabled);
|
||||
|
||||
if (gSavedSettings.getBOOL("VertexShaderEnable") == FALSE ||
|
||||
gSavedSettings.getBOOL("RenderAvatarVP") == FALSE)
|
||||
|
|
@ -1006,7 +1012,7 @@ void LLFloaterPreference::refreshEnabledState()
|
|||
LLCheckBoxCtrl* ctrl_shader_enable = getChild<LLCheckBoxCtrl>("BasicShaders");
|
||||
// radio set for terrain detail mode
|
||||
LLRadioGroup* mRadioTerrainDetail = getChild<LLRadioGroup>("TerrainDetailRadio"); // can be linked with control var
|
||||
|
||||
|
||||
ctrl_shader_enable->setEnabled(LLFeatureManager::getInstance()->isFeatureAvailable("VertexShaderEnable"));
|
||||
|
||||
BOOL shaders = ctrl_shader_enable->get();
|
||||
|
|
|
|||
|
|
@ -1051,7 +1051,7 @@ BOOL LLViewerShaderMgr::loadShadersDeferred()
|
|||
{
|
||||
gDeferredMultiLightProgram.mName = "Deferred MultiLight Shader";
|
||||
gDeferredMultiLightProgram.mShaderFiles.clear();
|
||||
gDeferredMultiLightProgram.mShaderFiles.push_back(make_pair("deferred/pointLightV.glsl", GL_VERTEX_SHADER_ARB));
|
||||
gDeferredMultiLightProgram.mShaderFiles.push_back(make_pair("deferred/multiPointLightV.glsl", GL_VERTEX_SHADER_ARB));
|
||||
gDeferredMultiLightProgram.mShaderFiles.push_back(make_pair("deferred/multiPointLightF.glsl", GL_FRAGMENT_SHADER_ARB));
|
||||
gDeferredMultiLightProgram.mShaderLevel = mVertexShaderLevel[SHADER_DEFERRED];
|
||||
success = gDeferredMultiLightProgram.createShader(NULL, NULL);
|
||||
|
|
|
|||
Loading…
Reference in New Issue