Panagiotis Christopoulos Charitos 14 年 前
コミット
e0fa1d4ddb
4 ファイル変更19 行追加26 行削除
  1. 1 2
      build/release/Makefile
  2. 3 12
      shaders/Final.glsl
  3. 13 11
      shaders/PpsSsao-2.glsl
  4. 2 1
      src/Renderer/MainRenderer.cpp

ファイルの差分が大きいため隠しています
+ 1 - 2
build/release/Makefile


+ 3 - 12
shaders/Final.glsl

@@ -14,17 +14,8 @@ void main()
 {
 {
 	//if( gl_FragCoord.x > 0.5 ) discard;
 	//if( gl_FragCoord.x > 0.5 ) discard;
 
 
-	fFragColor = texture2D(rasterImage, vTexCoords).rgb;
+	//fFragColor = texture2D(rasterImage, vTexCoords).rgb;
+	
+	fFragColor = vec3(texture2D(rasterImage, vTexCoords).r);
 	
 	
-	//fragColor = vec3(1.0, 0.0, 1.0);
-
-
-	//gl_FragColor.rgb = vec3(texture2D(rasterImage, vTexCoords).r);
-	/*vec4 c = texture2D( rasterImage, texCoords );
-	if( c.r == 0.0 && c.g == 0.0 && c.b==0.0 && c.a != 0.0 )*/
-		//gl_FragColor.rgb = vec3( texture2D( rasterImage, texCoords ).a );
-	//gl_FragColor.rgb = MedianFilter( rasterImage, texCoords );
-	//gl_FragColor.rgb = vec3( gl_FragCoord.xy/tex_size_, 0.0 );
-	//gl_FragColor.rgb = vec3( gl_FragCoord.xy*vec2( 1.0/R_W, 1.0/R_H ), 0.0 );
-	//gl_FragColor.rgb = texture2D( rasterImage, gl_FragCoord.xy/textureSize(rasterImage,0) ).rgb;
 }
 }

+ 13 - 11
shaders/PpsSsao-2.glsl

@@ -25,9 +25,8 @@ void main()
 
 
 /// @name Uniforms
 /// @name Uniforms
 /// @{
 /// @{
-uniform vec2 camerarange;  // = vec2( znear, zfar )
 uniform vec2 planes; ///< for the calculation of frag pos in view space	
 uniform vec2 planes; ///< for the calculation of frag pos in view space	
-uniform sampler2D msDepthFai;
+uniform sampler2D msDepthFai; ///< for the calculation of frag pos in view space	
 uniform sampler2D noiseMap;
 uniform sampler2D noiseMap;
 uniform sampler2D msNormalFai;
 uniform sampler2D msNormalFai;
 
 
@@ -49,10 +48,11 @@ in vec3 vPosition; ///< for the calculation of frag pos in view space
 layout(location = 0) out float fColor;
 layout(location = 0) out float fColor;
 /// @}
 /// @}
 
 
-
-vec3 getPosition(in sampler2D depthMap, in vec2 uv)
+/// Get frag position in view space
+/// globals: msDepthFai, planes, vPosition
+vec3 getPosition(in vec2 uv)
 {
 {
-	float depth = texture2D(depthMap, uv).r;
+	float depth = texture2D(msDepthFai, uv).r;
 
 
 	vec3 fragPosVspace;
 	vec3 fragPosVspace;
 	vec3 vposn = normalize(vPosition);
 	vec3 vposn = normalize(vPosition);
@@ -62,13 +62,15 @@ vec3 getPosition(in sampler2D depthMap, in vec2 uv)
 }
 }
 
 
 
 
-vec3 getNormal(in sampler2D normalMap, in vec2 uv)
+/// globals: msNormalFai
+vec3 getNormal(in vec2 uv)
 {
 {
-	return unpackNormal(texture2D(normalMap, uv).rg);
+	return unpackNormal(texture2D(msNormalFai, uv).rg);
 }
 }
 
 
 
 
-vec2 getRandom(in sampler2D noiseMap, in vec2 uv)
+/// globals: noiseMap, screenSize, noiseMapSize
+vec2 getRandom(in vec2 uv)
 {
 {
 	return normalize(texture2D(noiseMap, screenSize * uv / noiseMapSize).xy * 2.0f - 1.0f);
 	return normalize(texture2D(noiseMap, screenSize * uv / noiseMapSize).xy * 2.0f - 1.0f);
 }
 }
@@ -89,9 +91,9 @@ void main(void)
 	
 	
 	const vec3 kernel[4] = vec3[](vec2(1, 0), vec2(-1, 0), vec2(0, 1), vec2(0, -1));
 	const vec3 kernel[4] = vec3[](vec2(1, 0), vec2(-1, 0), vec2(0, 1), vec2(0, -1));
 
 
-	vec3 p = getPosition(msDepthFai, vTexCoords);
-	vec3 n = getNormal(msNormalFai, vTexCoords);
-	vec2 rand = getRandom(noiseMap, vTexCoords);
+	vec3 p = getPosition(vTexCoords);
+	vec3 n = getNormal(vTexCoords);
+	vec2 rand = getRandom(vTexCoords);
 
 
 	float ao = 0.0f;
 	float ao = 0.0f;
 	float rad = g_sample_rad / p.z;
 	float rad = g_sample_rad / p.z;

+ 2 - 1
src/Renderer/MainRenderer.cpp

@@ -101,7 +101,8 @@ void MainRenderer::render(Camera& cam_)
 	glDisable(GL_BLEND);
 	glDisable(GL_BLEND);
 	sProg->bind();
 	sProg->bind();
 	//sProg->findUniVar("rasterImage")->setTexture(ms.getNormalFai(), 0);
 	//sProg->findUniVar("rasterImage")->setTexture(ms.getNormalFai(), 0);
-	sProg->findUniVar("rasterImage")->set(pps.getPostPassFai(), 0);
+	sProg->findUniVar("rasterImage")->set(pps.getSsao().getFai(), 0);
+	//sProg->findUniVar("rasterImage")->set(pps.getPostPassFai(), 0);
 	drawQuad();
 	drawQuad();
 }
 }
 
 

この差分においてかなりの量のファイルが変更されているため、一部のファイルを表示していません