diff --git a/Resources/Shaders/BasicBlock.vs b/Resources/Shaders/BasicBlock.vs index 598b7a13..a922c754 100644 --- a/Resources/Shaders/BasicBlock.vs +++ b/Resources/Shaders/BasicBlock.vs @@ -58,22 +58,13 @@ void main() { color.xyz *= color.xyz; // linearize // ambient occlusion - ambientOcclusionCoord = (ambientOcclusionCoordAttribute + .5) / 256.; + ambientOcclusionCoord = (ambientOcclusionCoordAttribute + .5) * (1. / 256.); vec4 viewPos = viewMatrix * vertexPos; - /*float distance = length(viewPos.xyz) / fogDistance; - distance = clamp(distance, 0., 1.); - fogDensity = vec3(distance); - fogDensity = pow(fogDensity, vec3(1., .9, .7)); - fogDensity *= fogDensity;*/ float distance = dot(viewPos.xyz, viewPos.xyz); fogDensity = FogDensity(distance).xyz; - - /* - detailCoord = (vec2(dot(tan1, vertexPos.xyz), dot(tan2, vertexPos.xyz))) / 2.; - */ - vec3 normal = normalAttribute; //cross(tan2, tan1); + vec3 normal = normalAttribute; vec3 shadowVertexPos = vertexPos.xyz; if(abs(normal.x) > .1) // avoid self shadowing shadowVertexPos += normal * 0.01; diff --git a/Resources/Shaders/BasicBlockDynamicLit.vs b/Resources/Shaders/BasicBlockDynamicLit.vs index d755d1cf..56673697 100644 --- a/Resources/Shaders/BasicBlockDynamicLit.vs +++ b/Resources/Shaders/BasicBlockDynamicLit.vs @@ -54,19 +54,10 @@ void main() { color.xyz *= color.xyz; // linearize vec4 viewPos = viewMatrix * vertexPos; - /*float distance = length(viewPos.xyz) / fogDistance; - distance = clamp(distance, 0., 1.); - fogDensity = vec3(distance); - fogDensity = pow(fogDensity, vec3(1., .9, .7)); - fogDensity *= fogDensity;*/ float distance = dot(viewPos.xyz, viewPos.xyz); fogDensity = FogDensity(distance).xyz; - /* - detailCoord = (vec2(dot(tan1, vertexPos.xyz), dot(tan2, vertexPos.xyz))) / 2.; - */ - - vec3 normal = normalAttribute; //cross(tan2, tan1); + vec3 normal = normalAttribute; vec3 shadowVertexPos = vertexPos.xyz; PrepareForDynamicLightNoBump(shadowVertexPos, normal); diff --git a/Resources/Shaders/BasicBlockPhys.vs b/Resources/Shaders/BasicBlockPhys.vs index bdd149b9..4d489957 100644 --- a/Resources/Shaders/BasicBlockPhys.vs +++ b/Resources/Shaders/BasicBlockPhys.vs @@ -65,24 +65,13 @@ void main() { // ambient occlusion - ambientOcclusionCoord = (ambientOcclusionCoordAttribute + .5) / 256.; + ambientOcclusionCoord = (ambientOcclusionCoordAttribute + .5) * (1. / 256.); vec4 viewPos = viewMatrix * vertexPos; - /* - float distance = length(viewPos.xyz) / fogDistance; - distance = clamp(distance, 0., 1.); - fogDensity = vec3(distance); - fogDensity = pow(fogDensity, vec3(1., .9, .7)); - fogDensity *= fogDensity; - */ float distance = dot(viewPos.xyz, viewPos.xyz); fogDensity = FogDensity(distance).xyz; - - /* - detailCoord = (vec2(dot(tan1, vertexPos.xyz), dot(tan2, vertexPos.xyz))) / 2.; - */ - vec3 normal = normalAttribute; //cross(tan2, tan1); + vec3 normal = normalAttribute; vec3 shadowVertexPos = vertexPos.xyz; if(abs(normal.x) > .1) // avoid self shadowing shadowVertexPos += normal * 0.01; diff --git a/Resources/Shaders/LongSprite.vs b/Resources/Shaders/LongSprite.vs index 80c3651e..5354116e 100644 --- a/Resources/Shaders/LongSprite.vs +++ b/Resources/Shaders/LongSprite.vs @@ -49,11 +49,6 @@ void main() { // FIXME: cannot gamma correct because sprite may be // alpha-blended. vec4 viewPos = viewMatrix * vec4(pos,1.); - /*float distance = length(viewPos.xyz) / fogDistance; - distance = clamp(distance, 0., 1.); - fogDensity = vec4(distance); - fogDensity = pow(fogDensity, vec4(1., .9, .7, 1.)); - fogDensity *= fogDensity;*/ float distance = dot(viewPos.xyz, viewPos.xyz); fogDensity = FogDensity(distance); } diff --git a/Resources/Shaders/OptimizedVoxelModel.vs b/Resources/Shaders/OptimizedVoxelModel.vs index 5c76dbcf..67f84bc6 100644 --- a/Resources/Shaders/OptimizedVoxelModel.vs +++ b/Resources/Shaders/OptimizedVoxelModel.vs @@ -65,7 +65,6 @@ void main() { sunlight = max(sunlight, 0.); flatShading = sunlight; - vec4 viewPos = viewModelMatrix * vertexPos; float distance = dot(viewPos.xyz, viewPos.xyz); fogDensity = FogDensity(distance).xyz; diff --git a/Resources/Shaders/SoftLitSprite.vs b/Resources/Shaders/SoftLitSprite.vs index 226725fa..b3ad1409 100644 --- a/Resources/Shaders/SoftLitSprite.vs +++ b/Resources/Shaders/SoftLitSprite.vs @@ -103,16 +103,9 @@ void main() { // FIXME: cannot gamma correct because sprite may be // alpha-blended. vec4 viewPos = viewMatrix * vec4(pos,1.); - /*float distance = length(viewPos.xyz) / fogDistance; - distance = clamp(distance, 0., 1.); - fogDensity = vec4(distance); - fogDensity = pow(fogDensity, vec4(1., .9, .7, 1.)); - fogDensity *= fogDensity; */ float distance = dot(viewPos.xyz, viewPos.xyz); fogDensity = FogDensity(distance); - - // precompute some value in vertex shader to // reduce instruction count in frag. shader depthRange.z = 1. / (depthRange.y - depthRange.w); diff --git a/Resources/Shaders/SoftSprite.vs b/Resources/Shaders/SoftSprite.vs index 5b8ea891..3ea1df7a 100644 --- a/Resources/Shaders/SoftSprite.vs +++ b/Resources/Shaders/SoftSprite.vs @@ -86,12 +86,6 @@ void main() { // fog. // FIXME: cannot gamma correct because sprite may be // alpha-blended. - /*vec4 viewPos = viewMatrix * vec4(pos,1.); - float distance = length(viewPos.xyz) / fogDistance; - distance = clamp(distance, 0., 1.); - fogDensity = vec4(distance); - fogDensity = pow(fogDensity, vec4(1., .9, .7, 1.)); - fogDensity *= fogDensity;*/ float distance = dot(viewPos.xyz, viewPos.xyz); fogDensity = FogDensity(distance);