Browse Source

Downsizing the MS FAIs

Panagiotis Christopoulos Charitos 14 years ago
parent
commit
b56bb2916d
5 changed files with 11 additions and 33 deletions
  1. 4 1
      shaders/IsLpGeneric.glsl
  2. 5 2
      shaders/MsMpGeneric.glsl
  3. 0 26
      shaders/hw_skinning.glsl
  4. 0 2
      src/Renderer/Is.cpp
  5. 2 2
      src/Renderer/Ms.cpp

+ 4 - 1
shaders/IsLpGeneric.glsl

@@ -43,6 +43,9 @@ out vec3 fColor;
 /// @}
 /// @}
 
 
 
 
+const float MAX_SHININESS = 128.0;
+
+
 //======================================================================================================================
 //======================================================================================================================
 // getFragPosVSpace                                                                                                    =
 // getFragPosVSpace                                                                                                    =
 //======================================================================================================================
 //======================================================================================================================
@@ -152,7 +155,7 @@ vec3 doPhong(in vec3 fragPosVspace, out float fragLightDist)
 	// Specular
 	// Specular
 	vec4 specularMix = texture2D(msSpecularFai, vTexCoords); // the MS specular FAI has the color and the shininess
 	vec4 specularMix = texture2D(msSpecularFai, vTexCoords); // the MS specular FAI has the color and the shininess
 	vec3 specular = specularMix.xyz;
 	vec3 specular = specularMix.xyz;
-	float shininess = specularMix.w;
+	float shininess = specularMix.w * MAX_SHININESS;
 
 
 	vec3 _eyeVec_ = normalize(-fragPosVspace);
 	vec3 _eyeVec_ = normalize(-fragPosVspace);
 	vec3 h = normalize(lightDir + _eyeVec_);
 	vec3 h = normalize(lightDir + _eyeVec_);

+ 5 - 2
shaders/MsMpGeneric.glsl

@@ -137,6 +137,8 @@ layout(location = 0) out vec2 fMsNormalFai;
 layout(location = 1) out vec3 fMsDiffuseFai;
 layout(location = 1) out vec3 fMsDiffuseFai;
 layout(location = 2) out vec4 fMsSpecularFai;
 layout(location = 2) out vec4 fMsSpecularFai;
 
 
+const float MAX_SHININESS = 128.0;
+
 
 
 //======================================================================================================================
 //======================================================================================================================
 // Normal funcs                                                                                                        =
 // Normal funcs                                                                                                        =
@@ -300,9 +302,10 @@ void main()
 	// Specular Calculations
 	// Specular Calculations
 	//
 	//
 	#if defined(SPECULAR_MAPPING)
 	#if defined(SPECULAR_MAPPING)
-		vec4 _specularCol_ = vec4(texture2D(specularMap, _superTexCoords_).rgb * specularCol, shininess);
+		vec4 _specularCol_ = vec4(texture2D(specularMap, _superTexCoords_).rgb * specularCol,
+		                                    shininess / MAX_SHININESS);
 	#else // no specular map
 	#else // no specular map
-		vec4 _specularCol_ = vec4(specularCol, shininess);
+		vec4 _specularCol_ = vec4(specularCol, shininess / MAX_SHININESS);
 	#endif
 	#endif
 
 
 
 

+ 0 - 26
shaders/hw_skinning.glsl

@@ -1,26 +0,0 @@
-
-// hardware skinning data
-attribute float vertWeightBonesNum;
-attribute vec4  vertWeightBoneIds;
-attribute vec4  vertWeightWeights;
-
-const int MAX_BONES_PER_MESH = 60;
-
-uniform mat3 skinningRotations[ MAX_BONES_PER_MESH ];
-uniform vec3 skinningTranslations[ MAX_BONES_PER_MESH ];
-
-
-void HWSkinning( out mat3 _rot, out vec3 _tsl )
-{
-	_rot = mat3( 0.0 );
-	_tsl = vec3( 0.0 );
-
-	for( int i=0; i<int(vertWeightBonesNum); i++ )
-	{
-		int bone_id = int( vertWeightBoneIds[i] );
-		float weight = vertWeightWeights[i];
-
-		_rot += skinningRotations[bone_id] * weight;
-		_tsl += skinningTranslations[bone_id] * weight;
-	}
-}

+ 0 - 2
src/Renderer/Is.cpp

@@ -256,8 +256,6 @@ void Is::spotLightPass(const SpotLight& light)
 //======================================================================================================================
 //======================================================================================================================
 void Is::run()
 void Is::run()
 {
 {
-	const Camera& cam = r.getCamera();
-
 	// FBO
 	// FBO
 	fbo.bind();
 	fbo.bind();
 
 

+ 2 - 2
src/Renderer/Ms.cpp

@@ -32,8 +32,8 @@ void Ms::init(const RendererInitializer& initializer)
 		// create the FAIs
 		// create the FAIs
 
 
 		Renderer::createFai(r.getWidth(), r.getHeight(), GL_RG16F, GL_RG, GL_FLOAT, normalFai);
 		Renderer::createFai(r.getWidth(), r.getHeight(), GL_RG16F, GL_RG, GL_FLOAT, normalFai);
-		Renderer::createFai(r.getWidth(), r.getHeight(), GL_RGB16F, GL_RGB, GL_FLOAT, diffuseFai);
-		Renderer::createFai(r.getWidth(), r.getHeight(), GL_RGBA16F, GL_RGBA, GL_FLOAT, specularFai);
+		Renderer::createFai(r.getWidth(), r.getHeight(), GL_RGB8, GL_RGB, GL_FLOAT, diffuseFai);
+		Renderer::createFai(r.getWidth(), r.getHeight(), GL_RGBA8, GL_RGBA, GL_FLOAT, specularFai);
 		Renderer::createFai(r.getWidth(), r.getHeight(), GL_DEPTH24_STENCIL8, GL_DEPTH_STENCIL,
 		Renderer::createFai(r.getWidth(), r.getHeight(), GL_DEPTH24_STENCIL8, GL_DEPTH_STENCIL,
 		                    GL_UNSIGNED_INT_24_8, depthFai);
 		                    GL_UNSIGNED_INT_24_8, depthFai);