Browse Source

Cleaning up the shaders

Panagiotis Christopoulos Charitos 12 years ago
parent
commit
008db16d87

+ 0 - 45
shaders/BsBpSphere.glsl

@@ -1,45 +0,0 @@
-#pragma anki vertShaderBegins
-
-attribute vec3 position;
-attribute vec3 normal;
-//attribute vec2 texCoords;
-
-uniform mat4 modelViewProjectionMat;
-uniform mat3 normalMat;
-
-//varying vec2 texCoords_v2f;
-varying vec3 normalV2f;
-
-void main()
-{
-	//texCoords_v2f = texCoords;
-	normalV2f = normalMat * normal;
-	gl_Position = modelViewProjectionMat * vec4(position, 1.0);
-}
-
-#pragma anki fragShaderBegins
-
-uniform sampler2D ppsPrePassFai;
-uniform sampler2D noiseMap;
-//varying vec2 texCoords_v2f;
-varying vec3 normalV2f;
-uniform vec2 rendererSize;  
-
-void main()
-{
-	/*vec3 _noise = DecodeNormal(texture2D(noiseMap, gl_FragCoord.xy*vec2(1.0/R_W, 1.0/R_H)).rg).rgb;
-	_noise = _noise * 2 - 1;
-	_noise *= 7.0;*/
-
-	//vec4 _texel = texture2D(isFai, gl_FragCoord.xy*vec2(1.0/R_W, 1.0/R_H));
-
-	vec3 z = vec3(0.0, 0.0, 1.0);
-
-	float factor = normalV2f.z*3.0;
-	factor = pow(factor, 6);
-	vec3 col = texture2D(ppsPrePassFai, (gl_FragCoord.xy+(factor*20))*vec2(1.0/rendererSize.x, 1.0/rendererSize.y)).rgb * 0.75;
-	col.r *= factor;
-	col.b *= cos(factor*3.14);
-	gl_FragData[0] = vec4(col, factor);
-	//gl_FragData[0] = vec4(vec3(1), factor);
-}

+ 5 - 3
shaders/BsFragmentCommon.glsl → shaders/BsCommonFrag.glsl

@@ -1,15 +1,17 @@
+// Common code for all fragment shaders of BS
+#pragma anki include "shaders/CommonFrag.glsl"
+#pragma anki include "shaders/MsBsCommon.glsl"
+
 #define vTexCoords_DEFINED
 in vec2 vTexCoords;
 #define vInstanceId_DEFINED
-in flat uint vInstanceId;
+flat in uint vInstanceId;
 
 #if defined(PASS_COLOR)
 layout(location = 0) out vec4 fColor;
 #	define fColor_DEFINED
 #endif
 
-#pragma anki include "shaders/MaterialCommonFunctions.glsl"
-
 #if defined(PASS_COLOR)
 #	define texture_DEFINED
 #endif

+ 6 - 4
shaders/BsVertexCommon.glsl → shaders/BsCommonVert.glsl

@@ -1,14 +1,16 @@
+// Common code for all vertex shaders of BS
+
+#pragma anki include "shaders/MsBsCommon.glsl"
+
 layout(location = 0) in vec3 position;
 layout(location = 3) in vec2 texCoords;
 
 /// @name Varyings
 /// @{
 out vec2 vTexCoords;
-out flat uint vInstanceId;
+flat out uint vInstanceId;
 /// @}
 
-#pragma anki include "shaders/MaterialCommonFunctions.glsl"
-
 //==============================================================================
 #define setPositionVec3_DEFINED
 void setPositionVec3(in vec3 pos)
@@ -36,5 +38,5 @@ void particle(in mat4 mvp)
 {
 	vTexCoords = texCoords;
 	gl_Position = mvp * vec4(position, 1);
-	vInstanceId = gl_InstanceID;
+	vInstanceId = uint(gl_InstanceID);
 }

+ 0 - 16
shaders/BsRefract.glsl

@@ -1,16 +0,0 @@
-#pragma anki start vertexShader
-
-#pragma anki include "shaders/SimpleVert.glsl"
-
-#pragma anki start fragmentShader
-
-uniform sampler2D fai;
-
-in vec2 vTexCoords;
-
-layout(location = 0) out vec4 fFragColor;
-
-void main()
-{
-	fFragColor = texture2D(fai, vTexCoords);
-}

+ 3 - 0
shaders/Dbg.glsl

@@ -1,4 +1,7 @@
+// Debug stage shader program
+
 #pragma anki start vertexShader
+#pragma anki include "shaders/Pack.glsl"
 
 layout(location = 0) in vec3 position;
 layout(location = 1) in uint color;

+ 0 - 40
shaders/DpGeneric.glsl

@@ -1,40 +0,0 @@
-/// Control defines:
-/// ALPHA_TESTING
-
-#pragma anki start vertexShader
-
-uniform mat4 modelViewProjectionMat;
-
-in vec3 position;
-
-#if defined(ALPHA_TESTING)
-	in vec2 texCoords;
-	out vec2 vTexCoords;
-#endif
-
-void main()
-{
-#if defined(ALPHA_TESTING)
-	vTexCoords = texCoords;
-#endif
-
-	gl_Position = modelViewProjectionMat * vec4(position, 1.0);
-}
-
-#pragma anki start fragmentShader
-
-#if defined(ALPHA_TESTING)
-	uniform sampler2D diffuseMap;
-	uniform float alphaTestingTolerance = 0.5; ///< Below this value the pixels are getting discarded 
-	in vec2 vTexCoords;
-#endif
-
-void main()
-{
-#if defined(ALPHA_TESTING)
-	if(texture2D(diffuseMap, vTexCoords).a < alphaTestingTolerance)
-	{
-		discard;
-	}
-#endif
-}

+ 0 - 21
shaders/IsAp.glsl

@@ -1,21 +0,0 @@
-/// @file
-/// Illumination stage ambient pass shader program
-
-#pragma anki start vertexShader
-
-#pragma anki include "shaders/SimpleVert.glsl"
-
-#pragma anki start fragmentShader
-
-uniform vec3 ambientCol;
-uniform usampler2D msFai0;
-
-in vec2 vTexCoords;
-
-out vec3 fColor;
-
-void main()
-{
-	vec4 c = unpackUnorm4x8(texture(msFai0, vTexCoords).r);
-	fColor = c.rgb * ambientCol;
-}

+ 31 - 2
shaders/IsLpGeneric.glsl → shaders/IsLp.glsl

@@ -1,10 +1,39 @@
 /// @file
 ///
-/// Illumination stage lighting pass general shader program
+/// Illumination stage lighting pass shader program
 
 #pragma anki start vertexShader
 
-#pragma anki include "shaders/IsLpVertex.glsl"
+#if !TILES_X_COUNT || !TILES_Y_COUNT
+#	error See file
+#endif
+
+layout(location = 0) in vec2 position;
+
+uniform vec4 limitsOfNearPlane;
+
+out vec2 vTexCoords;
+flat out int vInstanceId;
+out vec2 vLimitsOfNearPlaneOpt;
+
+void main()
+{
+	vec2 ij = vec2(
+		float(gl_InstanceID % TILES_X_COUNT), 
+		float(gl_InstanceID / TILES_X_COUNT));
+
+	vInstanceId = int(gl_InstanceID);
+
+	const vec2 SIZES = 
+		vec2(1.0 / float(TILES_X_COUNT), 1.0 / float(TILES_Y_COUNT));
+
+	vTexCoords = (position + ij) * SIZES;
+	vec2 vertPosNdc = vTexCoords * 2.0 - 1.0;
+	gl_Position = vec4(vertPosNdc, 0.0, 1.0);
+
+	vLimitsOfNearPlaneOpt = 
+		(vTexCoords * limitsOfNearPlane.zw) - limitsOfNearPlane.xy;
+}
 
 #pragma anki start fragmentShader
 #pragma anki include "shaders/CommonFrag.glsl"

+ 0 - 30
shaders/IsLpVertex.glsl

@@ -1,30 +0,0 @@
-#if !TILES_X_COUNT || !TILES_Y_COUNT
-#	error See file
-#endif
-
-layout(location = 0) in vec2 position;
-
-uniform vec4 limitsOfNearPlane;
-
-out vec2 vTexCoords;
-flat out int vInstanceId;
-out vec2 vLimitsOfNearPlaneOpt;
-
-void main()
-{
-	vec2 ij = vec2(
-		float(gl_InstanceID % TILES_X_COUNT), 
-		float(gl_InstanceID / TILES_X_COUNT));
-
-	vInstanceId = int(gl_InstanceID);
-
-	const vec2 SIZES = 
-		vec2(1.0 / float(TILES_X_COUNT), 1.0 / float(TILES_Y_COUNT));
-
-	vTexCoords = (position + ij) * SIZES;
-	vec2 vertPosNdc = vTexCoords * 2.0 - 1.0;
-	gl_Position = vec4(vertPosNdc, 0.0, 1.0);
-
-	vLimitsOfNearPlaneOpt = 
-		(vTexCoords * limitsOfNearPlane.zw) - limitsOfNearPlane.xy;
-}

+ 0 - 20
shaders/IsSmo.glsl

@@ -1,20 +0,0 @@
-/// @file
-///
-/// Ilunimation stage stencil masking optimizations shader program
-
-#pragma anki start vertexShader
-
-layout(location = 0) in vec3 position;
-
-uniform mat4 modelViewProjectionMat;
-
-void main()
-{
-	gl_Position = modelViewProjectionMat * vec4(position, 1.0);
-}
-
-#pragma anki start fragmentShader
-
-void main()
-{
-}

+ 0 - 2
shaders/MaterialFragmentCommon.glsl

@@ -1,2 +0,0 @@
-#pragma anki include "shaders/MaterialFragmentVariables.glsl"
-#pragma anki include "shaders/MaterialFragmentFunctions.glsl"

+ 0 - 26
shaders/MaterialFragmentVariables.glsl

@@ -1,26 +0,0 @@
-/// @name Varyings
-/// @{
-#define vTexCoords_DEFINED
-in vec2 vTexCoords;
-
-#if defined(PASS_COLOR)
-in vec3 vNormal;
-#	define vNormal_DEFINED
-in vec3 vTangent;
-#	define vTangent_DEFINED
-in float vTangentW;
-#	define vTangentW_DEFINED
-in vec3 vVertPosViewSpace;
-#	define vVertPosViewSpace_DEFINED
-flat in float vSpecularComponent;
-#	define vSpecularComponent_DEFINED
-#endif
-/// @}
-
-/// @name Fragment out
-/// @{
-#if defined(PASS_COLOR)
-layout(location = 0) out uvec2 fMsFai0;
-#	define fMsFai0_DEFINED
-#endif
-/// @}

+ 0 - 3
shaders/MaterialVertexCommon.glsl

@@ -1,3 +0,0 @@
-#pragma anki include "shaders/MaterialVertexVariables.glsl"
-#pragma anki include "shaders/MaterialCommonFunctions.glsl"
-#pragma anki include "shaders/MaterialVertexFunctions.glsl"

+ 0 - 21
shaders/MaterialVertexVariables.glsl

@@ -1,21 +0,0 @@
-/// @name Attributes
-/// @{
-layout(location = 0) in vec3 position;
-layout(location = 3) in vec2 texCoords;
-#if defined(PASS_COLOR)
-layout(location = 1) in vec3 normal;
-layout(location = 2) in vec4 tangent;
-#endif
-/// @}
-
-/// @name Varyings
-/// @{
-out vec2 vTexCoords;
-#if defined(PASS_COLOR)
-out vec3 vNormal;
-out vec3 vTangent;
-out float vTangentW;
-out vec3 vVertPosViewSpace; ///< For env mapping. AKA view vector
-flat out float vSpecularComponent; ///< Calculate it per fragment
-#endif
-/// @}

+ 0 - 0
shaders/MaterialCommonFunctions.glsl → shaders/MsBsCommon.glsl


+ 37 - 3
shaders/MaterialFragmentFunctions.glsl → shaders/MsCommonFrag.glsl

@@ -1,8 +1,42 @@
-/// @file 
-/// The file contains common functions for fragment operations
+#pragma anki include "shaders/CommonFrag.glsl"
+
+//==============================================================================
+// Variables                                                                   =
+//==============================================================================
+
+/// @name Varyings
+/// @{
+#define vTexCoords_DEFINED
+in vec2 vTexCoords;
+
+#if defined(PASS_COLOR)
+in vec3 vNormal;
+#	define vNormal_DEFINED
+in vec3 vTangent;
+#	define vTangent_DEFINED
+in float vTangentW;
+#	define vTangentW_DEFINED
+in vec3 vVertPosViewSpace;
+#	define vVertPosViewSpace_DEFINED
+flat in float vSpecularComponent;
+#	define vSpecularComponent_DEFINED
+#endif
+/// @}
+
+/// @name Fragment out
+/// @{
+#if defined(PASS_COLOR)
+layout(location = 0) out uvec2 fMsFai0;
+#	define fMsFai0_DEFINED
+#endif
+/// @}
+
+//==============================================================================
+// Functions                                                                   =
+//==============================================================================
 
 #pragma anki include "shaders/Pack.glsl"
-#pragma anki include "shaders/MaterialCommonFunctions.glsl"
+#pragma anki include "shaders/MsBsCommon.glsl"
 
 /// @param[in] normal The fragment's normal in view space
 /// @param[in] tangent The tangent

+ 0 - 0
shaders/MsCommon.tc.glsl → shaders/MsCommonTessc.glsl


+ 23 - 2
shaders/MaterialVertexFunctions.glsl → shaders/MsCommonVert.glsl

@@ -1,6 +1,26 @@
-/// @file
-/// Generic vertex shader for material passes (both color and depth)
+/// @name Attributes
+/// @{
+layout(location = 0) in vec3 position;
+layout(location = 3) in vec2 texCoords;
+#if defined(PASS_COLOR)
+layout(location = 1) in vec3 normal;
+layout(location = 2) in vec4 tangent;
+#endif
+/// @}
+
+/// @name Varyings
+/// @{
+out vec2 vTexCoords;
+#if defined(PASS_COLOR)
+out vec3 vNormal;
+out vec3 vTangent;
+out float vTangentW;
+out vec3 vVertPosViewSpace; ///< For env mapping. AKA view vector
+flat out float vSpecularComponent; ///< Calculate it per fragment
+#endif
+/// @}
 
+#pragma anki include "shaders/MsBsCommon.glsl"
 #pragma anki include "shaders/Pack.glsl"
 
 //==============================================================================
@@ -48,3 +68,4 @@ void prepackSpecular(in vec2 specular)
 	vSpecularComponent = packSpecular(specular);
 }
 #endif
+

+ 4 - 4
shaders/Pack.glsl

@@ -68,15 +68,15 @@ vec4 unpackFloatTo4x8(in float val)
 	return result;
 }
 
-//#if GL_ES
-uint _packUnorm4x8(in vec4 v)
+#if GL_ES
+uint packUnorm4x8(in vec4 v)
 {
 	return floatBitsToUint(pack4x8ToFloat(v));
 }
 
-vec4 _unpackUnorm4x8(in uint u)
+vec4 unpackUnorm4x8(in uint u)
 {
 	return unpackFloatTo4x8(uintBitsToFloat(u));
 }
 
-//#endif
+#endif

+ 0 - 79
shaders/PpsBlurGeneric.glsl

@@ -1,79 +0,0 @@
-/// For information about the blurring you can see the code and the comments
-/// of GaussianBlurGeneric.glsl
-
-#pragma anki start vertexShader
-
-layout(location = 0) in vec2 position;
-
-out vec2 vTexCoords;
-out vec2 vOffsets; ///< For side pixels
-
-/// The img width for hspass or the img height for vpass
-uniform float imgDimension = 0.0;
-
-/// The offset of side pixels
-const vec2 BLURRING_OFFSET = vec2(1.3846153846, 3.2307692308);
-
-
-void main()
-{
-	vTexCoords = position;
-
-	vOffsets = BLURRING_OFFSET / imgDimension;
-
-	gl_Position = vec4(position * 2.0 - 1.0, 0.0, 1.0);
-}
-
-
-#pragma anki start fragmentShader
-
-
-uniform sampler2D img; ///< Input FAI
-uniform sampler2D msNormalFai;
-
-in vec2 vTexCoords;
-in vec2 vOffsets;
-
-layout(location = 0) out vec3 fFragColor;
-
-
-const float FIRST_WEIGHT = 0.2255859375;
-const float WEIGHTS[2] = float[](0.314208984375, 0.06982421875);
-
-
-void main()
-{
-	float blurringDist = texture2D(msNormalFai, vTexCoords).b;
-
-	/*if(blurringDist == 0.0)
-	{
-		fFragColor = texture2D(img, vTexCoords).rgb;
-	}
-	else*/
-	{
-		// the center (0,0) pixel
-		vec3 col = texture2D(img, vTexCoords).rgb * FIRST_WEIGHT;
-
-		// side pixels
-		for(int i = 0; i < 2; i++)
-		{
-#if defined(HPASS)
-			vec2 texCoords = vec2(vTexCoords.x + vOffsets[i] * blurringDist,
-				vTexCoords.y);
-			col += texture2D(img, texCoords).rgb * WEIGHTS[i];
-
-			texCoords.x = vTexCoords.x - blurringDist * vOffsets[i];
-			col += texture2D(img, texCoords).rgb * WEIGHTS[i];
-#elif defined(VPASS)
-			vec2 texCoords = vec2(vTexCoords.x,
-				vTexCoords.y + blurringDist * vOffsets[i]);
-			col += texture2D(img, texCoords).rgb * WEIGHTS[i];
-
-			texCoords.y = vTexCoords.y - blurringDist * vOffsets[i];
-			col += texture2D(img, texCoords).rgb * WEIGHTS[i];
-#endif
-		}
-
-		fFragColor = col;
-	}
-}

+ 0 - 52
shaders/PpsLscatt.glsl

@@ -1,52 +0,0 @@
-#pragma anki vertShaderBegins
-
-#pragma anki include "shaders/SimpleVert.glsl"
-
-#pragma anki fragShaderBegins
-
-const int SAMPLES_NUM = 100;
-
-float exposure = 2.0;
-float decay = 0.8;
-float density = 1.0;
-float weight = 0.3;
-uniform vec2 lightPosScreenSpace = vec2(0.5, 0.5);
-
-uniform sampler2D msDepthFai;
-uniform sampler2D isFai;
-
-varying vec2 vTexCoords;
-
-
-
-void main()
-{
-	vec2 delta_tex_coord = vTexCoords - lightPosScreenSpace;
-	vec2 texCoords2 = vTexCoords;
-	delta_tex_coord *= 1.0 / float(SAMPLES_NUM) * density;
-	float illumination_decay = 1.0;
-
-	gl_FragData[0].rgb = vec3(0.0);
-
-	for( int i=0; i<SAMPLES_NUM; i++ )
-	{
-		texCoords2 -= delta_tex_coord;
-
-		float depth = texture2D( msDepthFai, texCoords2 ).r;
-		if( depth != 1.0 ) // if the fragment is not part of the skybox dont bother continuing
-		{
-			illumination_decay *= decay;
-			continue;
-		}
-
-		vec3 sample = texture2D( isFai, texCoords2 ).rgb;			
-		sample *= illumination_decay * weight;
-		gl_FragData[0].rgb += sample;
-		illumination_decay *= decay;
-	}
-
-	gl_FragData[0].rgb *= exposure;
-	
-	//gl_FragData[0].rgb = texture2D( isFai, texCoords ).rgb;
-	//gl_FragData[0].rgb = vec3(1, 1, 0);
-}

+ 0 - 21
shaders/PpsSideBlur.glsl

@@ -1,21 +0,0 @@
-// The final pass
-
-#pragma anki start vertexShader
-
-#pragma anki include "shaders/SimpleVert.glsl"
-
-#pragma anki start fragmentShader
-
-in vec2 vTexCoords;
-
-uniform sampler2D tex;
-uniform float factor = 1.0;
-
-layout(location = 0) out vec3 fFragColor;
-
-
-void main()
-{
-	float f = texture2D(tex, vTexCoords).r;
-	fFragColor = vec3(0.0, 0.0, f * factor);
-}

+ 0 - 77
shaders/TfHwSkinningGeneric.glsl

@@ -1,77 +0,0 @@
-/// @file
-///
-/// Switches: NORMAL_ENABLED, TANGENT_ENABLED
-#pragma anki start vertexShader
-
-
-//
-// Attributes
-//
-layout(location = 0) in vec3 position;
-
-#if defined(NORMAL_ENABLED)
-	layout(location = 1) in vec3 normal;
-#endif
-
-#if defined(TANGENT_ENABLED)
-	layout(location = 2) in vec4 tangent;
-#endif
-layout(location = 3) in float vertWeightBonesNum;
-layout(location = 4) in vec4 vertWeightBoneIds;
-layout(location = 5) in vec4 vertWeightWeights;
-
-
-//
-// Uniforms
-// 
-const int MAX_BONES_PER_MESH = 60;
-uniform mat3 skinningRotations[MAX_BONES_PER_MESH];
-uniform vec3 skinningTranslations[MAX_BONES_PER_MESH];
-
-
-//
-// Varyings
-//
-out vec3 vPosition;
-
-#if defined(NORMAL_ENABLED)
-	out vec3 vNormal;
-#endif
-
-#if defined(TANGENT_ENABLED)
-	out vec4 vTangent;
-#endif
-
-
-void main()
-{
-	mat3 rot = mat3(0.0);
-	vec3 tsl = vec3(0.0);
-
-	for(int i = 0; i < int(vertWeightBonesNum); i++)
-	{
-		int boneId = int(vertWeightBoneIds[i]);
-		float weight = vertWeightWeights[i];
-
-		rot += skinningRotations[boneId] * weight;
-		tsl += skinningTranslations[boneId] * weight;
-	}
-	
-	vPosition = (rot * position) + tsl;
-	
-	#if defined(NORMAL_ENABLED)
-		vNormal = rot * normal;
-	#endif
-	
-	#if defined(TANGENT_ENABLED)
-		vTangent = vec4(rot * vec3(tangent), tangent.w);
-	#endif
-}
-
-#pragma anki start fragmentShader
-
-void main()
-{
-	// Do nothing
-}
-

+ 0 - 2
shaders/TfHwSkinningPos.glsl

@@ -1,2 +0,0 @@
-#pragma anki transformFeedbackVaryings interleaved vPosition
-#pragma anki include "shaders/TfHwSkinningGeneric.glsl"

+ 0 - 4
shaders/TfHwSkinningPosNormTan.glsl

@@ -1,4 +0,0 @@
-#pragma anki transformFeedbackVaryings interleaved vPosition vNormal vTangent
-#define NORMAL_ENABLED
-#define TANGENT_ENABLED
-#pragma anki include "shaders/TfHwSkinningGeneric.glsl"

+ 0 - 35
shaders/UiText.glsl

@@ -1,35 +0,0 @@
-#pragma anki start vertexShader
-
-layout(location = 0) in vec2 position;
-
-uniform mat3 transformation; ///< Position transformation
-uniform mat3 textureTranformation; ///< Texture transformation
-
-out vec2 vTexCoords;
-
-
-void main(void)
-{
-	vec3 pos3d = vec3(position, 1.0);
-	vTexCoords = (textureTranformation * pos3d).xy;
-	gl_Position = vec4(transformation * pos3d, 1.0);
-}
-
-#pragma anki start fragmentShader
-
-in vec2 vTexCoords;
-
-uniform sampler2D texture;
-uniform vec4 color;
-
-layout(location = 0) out vec4 fColor;
-
-
-void main()
-{
-	float r = texture2D(texture, vTexCoords).r;
-
-	fColor = vec4(r) * color;
-	//fColor = texCol - texCol + vec4(1.0, 0.0, 1.0, 0.1);
-	//fColor = texCol - texCol + vec4(texture2D(texture, vTexCoords).r);
-}

+ 0 - 25
shaders/bs_bp_volfog.glsl

@@ -1,25 +0,0 @@
-#pragma anki vertShaderBegins
-
-void main()
-{
-	gl_Position = ftransform();
-}
-
-#pragma anki fragShaderBegins
-
-#pragma anki include "shaders/linear_depth.glsl"
-
-uniform sampler2D ms_depth_fai;
-
-void main()
-{
-	vec2 tex_size_ = textureSize(ms_depth_fai, 0);
-	vec2 texCoords_____________ = gl_FragCoord.xy/tex_size_;
-	
-	float depth_exp_ = texture2D( ms_depth_fai, texCoords_____________ ).r;
-	if( depth_exp_ == 1 ) discard;
-	
-	float depth_ = LinearizeDepth( depth_exp_, 0.1, 10.0 );
-	gl_FragColor = vec4( depth_ );
-	gl_FragColor = vec4( 0.5 );
-}

+ 0 - 149
shaders/median_filter.glsl

@@ -1,149 +0,0 @@
-/*
-3x3 Median
-Morgan McGuire and Kyle Whitson
-http://graphics.cs.williams.edu
-*/
-
-#define s2(a, b)				temp = a; a = min(a, b); b = max(temp, b);
-#define mn3(a, b, c)			s2(a, b); s2(a, c);
-#define mx3(a, b, c)			s2(b, c); s2(a, c);
-
-#define mnmx3(a, b, c)			mx3(a, b, c); s2(a, b);                                   // 3 exchanges
-#define mnmx4(a, b, c, d)		s2(a, b); s2(c, d); s2(a, c); s2(b, d);                   // 4 exchanges
-#define mnmx5(a, b, c, d, e)	s2(a, b); s2(c, d); mn3(a, c, e); mx3(b, d, e);           // 6 exchanges
-#define mnmx6(a, b, c, d, e, f) s2(a, d); s2(b, e); s2(c, f); mn3(a, b, c); mx3(d, e, f); // 7 exchanges
-
-
-//=====================================================================================================================================
-// MedianFilterRGB                                                                                                                    =
-//=====================================================================================================================================
-vec3 MedianFilterRGB( in sampler2D tex, in vec2 texCoords )
-{
-	vec2 tex_inv_size = 1.0/vec2(textureSize(tex, 0));
-  vec3 v[9];
-
-  // Add the pixels which make up our window to the pixel array.
-	for(int dX = -1; dX <= 1; ++dX) 
-	{
-		for(int dY = -1; dY <= 1; ++dY) 
-		{
-			vec2 offset = vec2(float(dX), float(dY));
-
-			// If a pixel in the window is located at (x+dX, y+dY), put it at index (dX + R)(2R + 1) + (dY + R) of the
-			// pixel array. This will fill the pixel array, with the top left pixel of the window at pixel[0] and the
-			// bottom right pixel of the window at pixel[N-1].
-			v[(dX + 1) * 3 + (dY + 1)] = texture2D(tex, texCoords + offset * tex_inv_size).rgb;
-		}
-	}
-
-  vec3 temp;
-
-  // Starting with a subset of size 6, remove the min and max each time
-  mnmx6(v[0], v[1], v[2], v[3], v[4], v[5]);
-  mnmx5(v[1], v[2], v[3], v[4], v[6]);
-  mnmx4(v[2], v[3], v[4], v[7]);
-  mnmx3(v[3], v[4], v[8]);
-  return v[4];
-}
-
-
-//=====================================================================================================================================
-// MedianFilterA                                                                                                                      =
-//=====================================================================================================================================
-float MedianFilterA( in sampler2D tex, in vec2 texCoords )
-{
-	vec2 tex_inv_size = 1.0/vec2(textureSize(tex, 0));
-  float v[9];
-
-  // Add the pixels which make up our window to the pixel array.
-	for(int dX = -1; dX <= 1; ++dX)
-	{
-		for(int dY = -1; dY <= 1; ++dY)
-		{
-			vec2 offset = vec2(float(dX), float(dY));
-
-			// If a pixel in the window is located at (x+dX, y+dY), put it at index (dX + R)(2R + 1) + (dY + R) of the
-			// pixel array. This will fill the pixel array, with the top left pixel of the window at pixel[0] and the
-			// bottom right pixel of the window at pixel[N-1].
-			v[(dX + 1) * 3 + (dY + 1)] = texture2D(tex, texCoords + offset * tex_inv_size).a;
-		}
-	}
-
-  float temp;
-
-  // Starting with a subset of size 6, remove the min and max each time
-  mnmx6(v[0], v[1], v[2], v[3], v[4], v[5]);
-  mnmx5(v[1], v[2], v[3], v[4], v[6]);
-  mnmx4(v[2], v[3], v[4], v[7]);
-  mnmx3(v[3], v[4], v[8]);
-  return v[4];
-}
-
-
-//=====================================================================================================================================
-// MedianAndBlurA                                                                                                                     =
-//=====================================================================================================================================
-float MedianAndBlurA( in sampler2D tex, in vec2 texCoords )
-{
-	vec2 tex_inv_size = 1.0/vec2(textureSize(tex, 0));
-  float v[9];
-  float sum = 0.0;
-
-  // Add the pixels which make up our window to the pixel array.
-	for(int dX = -1; dX <= 1; ++dX)
-	{
-		for(int dY = -1; dY <= 1; ++dY)
-		{
-			vec2 offset = vec2(float(dX), float(dY));
-
-			// If a pixel in the window is located at (x+dX, y+dY), put it at index (dX + R)(2R + 1) + (dY + R) of the
-			// pixel array. This will fill the pixel array, with the top left pixel of the window at pixel[0] and the
-			// bottom right pixel of the window at pixel[N-1].
-			float f = texture2D(tex, texCoords + offset * tex_inv_size).a;
-			v[(dX + 1) * 3 + (dY + 1)] = f;
-			sum += f;
-		}
-	}
-
-  float temp;
-
-  // Starting with a subset of size 6, remove the min and max each time
-  mnmx6(v[0], v[1], v[2], v[3], v[4], v[5]);
-  mnmx5(v[1], v[2], v[3], v[4], v[6]);
-  mnmx4(v[2], v[3], v[4], v[7]);
-  mnmx3(v[3], v[4], v[8]);
-  return v[4]*0.5 + sum/18.0;
-}
-
-
-//=====================================================================================================================================
-// MedianFilterPCF                                                                                                                    =
-//=====================================================================================================================================
-float MedianFilterPCF( in sampler2DShadow tex, in vec3 texCoords )
-{
-	vec2 tex_inv_size = 1.0/vec2(textureSize(tex, 0));
-  float v[9];
-
-  // Add the pixels which make up our window to the pixel array.
-	for(int dX = -1; dX <= 1; ++dX)
-	{
-		for(int dY = -1; dY <= 1; ++dY)
-		{
-			vec2 offset = vec2(float(dX), float(dY));
-
-			// If a pixel in the window is located at (x+dX, y+dY), put it at index (dX + R)(2R + 1) + (dY + R) of the
-			// pixel array. This will fill the pixel array, with the top left pixel of the window at pixel[0] and the
-			// bottom right pixel of the window at pixel[N-1].
-			v[(dX + 1) * 3 + (dY + 1)] = shadow2D(tex, texCoords + vec3(offset * tex_inv_size, 0.0)).r;
-		}
-	}
-
-  float temp;
-
-  // Starting with a subset of size 6, remove the min and max each time
-  mnmx6(v[0], v[1], v[2], v[3], v[4], v[5]);
-  mnmx5(v[1], v[2], v[3], v[4], v[6]);
-  mnmx4(v[2], v[3], v[4], v[7]);
-  mnmx3(v[3], v[4], v[8]);
-  return v[4];
-}

+ 2 - 2
src/renderer/Deformer.cpp

@@ -15,8 +15,8 @@ void Deformer::init()
 {
 	// Load the shaders
 	//
-	tfHwSkinningAllSProg.load("shaders/TfHwSkinningPosNormTan.glsl");
-	tfHwSkinningPosSProg.load("shaders/TfHwSkinningPos.glsl");
+	/*tfHwSkinningAllSProg.load("shaders/TfHwSkinningPosNormTan.glsl");
+	tfHwSkinningPosSProg.load("shaders/TfHwSkinningPos.glsl");*/
 }
 
 //==============================================================================

+ 1 - 1
src/renderer/Is.cpp

@@ -318,7 +318,7 @@ void Is::initInternal(const RendererInitializer& initializer)
 
 	// point light
 	lightPassProg.load(ShaderProgramResource::createSrcCodeToCache(
-		"shaders/IsLpGeneric.glsl", pps.c_str()).c_str());
+		"shaders/IsLp.glsl", pps.c_str()).c_str());
 
 	//
 	// Create FBOs

+ 2 - 3
tools/material/diff.template.mtl

@@ -9,7 +9,7 @@
 		<shader>
 			<type>vertex</type>
 			<includes>
-				<include>shaders/MaterialVertexCommon.glsl</include>
+				<include>shaders/MsCommonVert.glsl</include>
 			</includes>
 		
 			<inputs>
@@ -39,8 +39,7 @@
 			<type>fragment</type>
 
 			<includes>
-				<include>shaders/MaterialFragmentVariables.glsl</include>
-				<include>shaders/MaterialFragmentFunctions.glsl</include>
+				<include>shaders/MsCommonFrag.glsl</include>
 			</includes>
 			
 			<inputs>

+ 2 - 3
tools/material/diff_norm.template.mtl

@@ -9,7 +9,7 @@
 		<shader>
 			<type>vertex</type>
 			<includes>
-				<include>shaders/MaterialVertexCommon.glsl</include>
+				<include>shaders/MsCommonVert.glsl</include>
 			</includes>
 		
 			<inputs>
@@ -39,8 +39,7 @@
 			<type>fragment</type>
 
 			<includes>
-				<include>shaders/MaterialFragmentVariables.glsl</include>
-				<include>shaders/MaterialFragmentFunctions.glsl</include>
+				<include>shaders/MsCommonFrag.glsl</include>
 			</includes>
 			
 			<inputs>