Panagiotis Christopoulos Charitos před 10 roky
rodič
revize
47ed56752a

+ 1 - 0
include/anki/renderer/Bloom.h

@@ -65,6 +65,7 @@ public:
 private:
 	U32 m_width, m_height;
 	F32 m_threshold = 10.0; ///< How bright it is
+	F32 m_scale = 1.0;
 	U32 m_blurringIterationsCount = 2; ///< The blurring iterations
 	F32 m_blurringDist = 1.0; ///< Distance in blurring
 	

+ 3 - 2
shaders/PpsBloom.frag.glsl

@@ -12,7 +12,7 @@ layout(binding = 0) uniform lowp sampler2D u_tex; ///< Its the IS RT
 
 layout(std140, binding = 0) uniform _blk
 {
-	vec4 u_thresholdPad3;
+	vec4 u_thresholdScalePad2;
 };
 
 layout(std140, binding = 0) readonly buffer _blk1
@@ -47,5 +47,6 @@ void main()
 	out_color += readTexture(MIPMAP - 2);
 	
 	out_color /= 3.0;
-	out_color = tonemap(out_color, u_averageLuminancePad3.x, u_thresholdPad3.x);
+	out_color = tonemap(out_color, u_averageLuminancePad3.x, 
+		u_thresholdScalePad2.x) * u_thresholdScalePad2.y;
 }

+ 1 - 0
src/core/Config.cpp

@@ -38,6 +38,7 @@ Config::Config()
 	newOption("pps.bloom.samples", 5);
 	newOption("pps.bloom.blurringIterationsCount", 1);
 	newOption("pps.bloom.threshold", 1.0);
+	newOption("pps.bloom.scale", 2.0);
 
 	newOption("pps.ssao.enabled", true);
 	newOption("pps.ssao.renderingQuality", 0.3);

+ 2 - 1
src/renderer/Bloom.cpp

@@ -51,6 +51,7 @@ Error Bloom::initInternal(const ConfigSet& initializer)
 	alignRoundDown(16, m_height);
 
 	m_threshold = initializer.get("pps.bloom.threshold");
+	m_scale = initializer.get("pps.bloom.scale");
 	m_blurringDist = initializer.get("pps.bloom.blurringDist");
 	m_blurringIterationsCount = 
 		initializer.get("pps.bloom.blurringIterationsCount");
@@ -184,7 +185,7 @@ Error Bloom::run(CommandBufferHandle& cmdb)
 //==============================================================================
 void Bloom::updateDefaultBlock(CommandBufferHandle& cmdb)
 {
-	Vec4 uniform(m_threshold, 0.0, 0.0, 0.0);
+	Vec4 uniform(m_threshold, m_scale, 0.0, 0.0);
 	m_commonBuff.write(cmdb, &uniform, sizeof(uniform), 0, 0, sizeof(uniform));
 }
 

+ 2 - 1
testapp/Main.cpp

@@ -493,7 +493,8 @@ Error initSubsystems(int argc, char* argv[])
 	config.set("pps.bloom.renderingQuality", 0.5);
 	config.set("pps.bloom.blurringDist", 1.0);
 	config.set("pps.bloom.blurringIterationsCount", 3);
-	config.set("pps.bloom.threshold", 1.0);
+	config.set("pps.bloom.threshold", 2.0);
+	config.set("pps.bloom.scale", 2.0);
 	config.set("pps.bloom.samples", 17);
 	config.set("pps.sslr.enabled", false);
 	config.set("pps.sslr.renderingQuality", 0.5);