Panagiotis Christopoulos Charitos пре 7 година
родитељ
комит
1ebb8a4bbd

+ 3 - 55
programs/LightShading.ankiprog

@@ -46,9 +46,8 @@ void main()
 #define LIGHT_SET 0
 #define LIGHT_SS_BINDING 0
 #define LIGHT_UBO_BINDING 0
-#define LIGHT_TEX_BINDING 4
+#define LIGHT_TEX_BINDING 5
 #define LIGHT_LIGHTS
-#define LIGHT_INDIRECT
 #define LIGHT_COMMON_UNIS
 #include "shaders/ClusterLightCommon.glsl"
 
@@ -56,6 +55,7 @@ layout(ANKI_TEX_BINDING(0, 0)) uniform sampler2D u_msRt0;
 layout(ANKI_TEX_BINDING(0, 1)) uniform sampler2D u_msRt1;
 layout(ANKI_TEX_BINDING(0, 2)) uniform sampler2D u_msRt2;
 layout(ANKI_TEX_BINDING(0, 3)) uniform sampler2D u_msDepthRt;
+layout(ANKI_TEX_BINDING(0, 4)) uniform sampler2D u_indirectRt;
 
 layout(location = 0) in vec2 in_uv;
 layout(location = 1) in vec2 in_clusterIJ;
@@ -74,44 +74,6 @@ const float SUBSURFACE_MIN = 0.05;
 	float att = computeAttenuationFactor(light.posRadius.w, frag2Light); \
 	float lambert = nol;
 
-void readIndirect(uint idxOffset, vec3 pos, vec3 r, vec3 n, float lod, out vec3 specIndirect, out vec3 diffIndirect)
-{
-	specIndirect = vec3(0.0);
-	diffIndirect = vec3(0.0);
-
-	// Check proxy
-	uint count = u_lightIndices[idxOffset++];
-	while(count-- != 0)
-	{
-		ReflectionProbe probe = u_reflectionProbes[u_lightIndices[idxOffset++]];
-
-		float R2 = probe.positionRadiusSq.w;
-		vec3 center = probe.positionRadiusSq.xyz;
-
-		// Get distance from the center of the probe
-		vec3 f = pos - center;
-
-		// Cubemap UV in view space
-		vec3 uv = computeCubemapVecAccurate(r, R2, f);
-
-		// Read!
-		float cubemapIndex = probe.cubemapIndexPad3.x;
-		vec3 c = textureLod(u_reflectionsTex, vec4(uv, cubemapIndex), lod).rgb;
-
-		// Combine (lerp) with previous color
-		float d = dot(f, f);
-		float factor = d / R2;
-		factor = min(factor, 1.0);
-		specIndirect = mix(c, specIndirect, factor);
-		// Same as: specIndirect = c * (1.0 - factor) + specIndirect * factor
-
-		// Do the same for diffuse
-		uv = computeCubemapVecAccurate(n, R2, f);
-		vec3 id = textureLod(u_irradianceTex, vec4(uv, cubemapIndex), 0.0).rgb;
-		diffIndirect = mix(id, diffIndirect, factor);
-	}
-}
-
 void main()
 {
 	float depth = textureLod(u_msDepthRt, in_uv, 0.0).r;
@@ -204,21 +166,7 @@ void main()
 	}
 
 	// Indirect
-	{
-		vec3 eye = -viewDir;
-		vec3 reflVec = reflect(eye, normal);
-
-		float reflLod = float(IR_MIPMAP_COUNT - 1u) * a2;
-
-		vec3 specIndirect, diffIndirect;
-		readIndirect(idxOffset, worldPos, reflVec, normal, reflLod, specIndirect, diffIndirect);
-
-		float ndotv = dot(normal, viewDir);
-		vec2 envBRDF = texture(u_integrationLut, vec2(a2, ndotv)).xy;
-		vec3 specIndirectTerm = specCol * envBRDF.x + envBRDF.y;
-
-		outC += specIndirect * specIndirectTerm + diffIndirect * diffCol;
-	}
+	outC += textureLod(u_indirectRt, in_uv, 0.0).rgb;
 
 	out_color = outC;
 #if 0

+ 53 - 33
programs/Reflections.ankiprog

@@ -31,7 +31,7 @@ http://www.anki3d.org/LICENSE
 #define LIGHT_SET 0
 #define LIGHT_SS_BINDING 0
 #define LIGHT_UBO_BINDING 0
-#define LIGHT_TEX_BINDING 5
+#define LIGHT_TEX_BINDING 6
 #define LIGHT_INDIRECT
 #define LIGHT_COMMON_UNIS
 #include "shaders/ClusterLightCommon.glsl"
@@ -40,14 +40,14 @@ const ivec2 HIZ_SIZE = ivec2(FB_SIZE) >> 1;
 
 layout(local_size_x = WORKGROUP_SIZE.x, local_size_y = WORKGROUP_SIZE.y, local_size_z = 1) in;
 
-layout(ANKI_TEX_BINDING(0, 0)) uniform sampler2D u_gbufferRt1;
-layout(ANKI_TEX_BINDING(0, 1)) uniform sampler2D u_gbufferRt2;
-layout(ANKI_TEX_BINDING(0, 2)) uniform sampler2D u_hizRt;
-layout(ANKI_TEX_BINDING(0, 3)) uniform sampler2D u_lightBufferRt;
-layout(ANKI_TEX_BINDING(0, 4)) uniform sampler2D u_depthRt;
+layout(ANKI_TEX_BINDING(0, 0)) uniform sampler2D u_gbufferRt0;
+layout(ANKI_TEX_BINDING(0, 1)) uniform sampler2D u_gbufferRt1;
+layout(ANKI_TEX_BINDING(0, 2)) uniform sampler2D u_gbufferRt2;
+layout(ANKI_TEX_BINDING(0, 3)) uniform sampler2D u_depthRt;
+layout(ANKI_TEX_BINDING(0, 4)) uniform sampler2D u_hizRt;
+layout(ANKI_TEX_BINDING(0, 5)) uniform sampler2D u_lightBufferRt;
 
-layout(ANKI_IMAGE_BINDING(0, 0)) writeonly uniform image2D out_refl;
-layout(ANKI_IMAGE_BINDING(0, 1)) writeonly uniform image2D out_indirect;
+layout(ANKI_IMAGE_BINDING(0, 0)) writeonly uniform image2D out_reflAndIndirect;
 
 #define u_normalMat mat3(u_viewMat)
 
@@ -154,7 +154,7 @@ vec4 doSslr(vec3 r, vec3 n, vec3 viewPos, vec2 uv, float depth, float roughness)
 }
 
 // Note: All calculations in world space
-void doProbeReflections(
+void readReflectionsAndIrradianceFromProbes(
 	uint idxOffset, vec3 worldPos, vec3 normal, float roughness, out vec3 specIndirect, out vec3 diffIndirect)
 {
 	specIndirect = vec3(0.0);
@@ -197,6 +197,17 @@ void doProbeReflections(
 	}
 }
 
+vec3 computeSpecIndirectFactor(vec3 worldPos, vec3 normal, float roughness, vec3 specColor)
+{
+	vec3 viewDir = normalize(u_cameraPos - worldPos);
+	float ndotv = dot(normal, viewDir);
+
+	vec2 envBRDF = texture(u_integrationLut, vec2(roughness, ndotv)).xy;
+	vec3 specIndirectTerm = specColor * envBRDF.x + envBRDF.y;
+
+	return specIndirectTerm;
+}
+
 void main()
 {
 	uvec2 realInvocationId = gl_GlobalInvocationID.xy;
@@ -217,22 +228,29 @@ void main()
 	}
 
 	vec2 uv = (vec2(realInvocationId) + 0.5) / vec2(FB_SIZE);
+	vec2 ndc = UV_TO_NDC(uv);
 
-	// Get normal
-	vec3 worldNormal;
-	readNormalFromGBuffer(u_gbufferRt2, uv, worldNormal);
-
-	// Get roughness
-	float roughness;
-	vec3 specular;
-	readRoughnessSpecularFromGBuffer(u_gbufferRt1, uv, roughness, specular);
+	// Read gbuffer
+	GbufferInfo gbuffer;
+	readGBuffer(u_gbufferRt0, u_gbufferRt1, u_gbufferRt2, uv, 0.0, gbuffer);
 
 	// Get depth
 	float depth = textureLod(u_depthRt, uv, 0.0).r;
 
+	// Get world position
+	vec4 worldPos4 = u_invViewProjMat * vec4(ndc, depth, 1.0);
+	vec3 worldPos = worldPos4.xyz / worldPos4.w;
+
+	// Compute how much reflections we need
+	float a2 = computeRoughnesSquared(gbuffer.roughness);
+	vec3 specIndirectTerm = computeSpecIndirectFactor(worldPos, gbuffer.normal, a2, gbuffer.specular);
+	bool runSslr = 
+		max(max(specIndirectTerm.x, specIndirectTerm.y), specIndirectTerm.z) > 0.05;
+
 	// Try SSR
 	float sslrFactor = 0.0;
 	vec3 sslrCol = vec3(0.0);
+	if(runSslr)
 	{
 		// Get view pos
 		vec4 viewPos4 = u_invProjMat * vec4(UV_TO_NDC(uv), depth, 1.0);
@@ -240,24 +258,19 @@ void main()
 
 		// Do SSLR
 		vec3 viewDir = normalize(viewPos);
-		vec3 viewNormal = u_normalMat * worldNormal;
+		vec3 viewNormal = u_normalMat * gbuffer.normal;
 		vec3 reflVec = reflect(viewDir, viewNormal);
 
-		vec4 sslr = doSslr(reflVec, viewNormal, viewPos, uv, depth, roughness);
+		vec4 sslr = doSslr(reflVec, viewNormal, viewPos, uv, depth, gbuffer.roughness);
 		sslrFactor = sslr.w;
 		sslrCol = sslr.xyz;
+		sslrCol = clamp(sslrCol, 0.0, FLT_MAX); // XXX
 	}
 
 	// Read probes
-	vec3 probeCol;
-	vec3 indirectCol;
+	vec3 probeCol = vec3(0.0);
+	vec3 indirectCol = vec3(0.0);
 	{
-		vec2 ndc = UV_TO_NDC(uv);
-
-		// Get world position
-		vec4 worldPos4 = u_invViewProjMat * vec4(ndc, depth, 1.0);
-		vec3 worldPos = worldPos4.xyz / worldPos4.w;
-
 		// Get first light index
 		uint clusterIdx = computeClusterIndex(u_clustererMagic, uv, worldPos, CLUSTER_COUNT_X, CLUSTER_COUNT_Y);
 		uint idxOffset = u_clusters[clusterIdx];
@@ -275,16 +288,23 @@ void main()
 		idxOffset += count;
 
 		// Do the probe read
-		doProbeReflections(idxOffset, worldPos, worldNormal, roughness, probeCol, indirectCol);
+		readReflectionsAndIrradianceFromProbes(
+			idxOffset, worldPos, gbuffer.normal, gbuffer.roughness, probeCol, indirectCol);
 	}
 
+	vec3 outColor = indirectCol * gbuffer.diffuse;
+
 	// Combine the SSR and probe reflections and write the result
-	vec3 finalRefl = mix(probeCol, sslrCol, sslrFactor);
-	finalRefl = clamp(finalRefl, 0.0, FLT_MAX); // XXX
-	imageStore(out_refl, ivec2(realInvocationId), vec4(finalRefl, 0.0));
+	{
+		vec3 finalRefl = mix(probeCol, sslrCol, sslrFactor);
+		finalRefl = specIndirectTerm * finalRefl;
 
-	// Write indirect diffuse
-	imageStore(out_indirect, ivec2(realInvocationId), vec4(indirectCol, 0.0));
+		outColor += finalRefl;
+	}
+	
+	// Done!
+	imageStore(out_reflAndIndirect, ivec2(realInvocationId), vec4(outColor, 0.0));
+	imageStore(out_reflAndIndirect, ivec2(realInvocationId.x + 1, realInvocationId.y), vec4(outColor, 0.0));
 }
 			]]></source>
 		</shader>

+ 2 - 2
src/anki/gr/Common.h

@@ -43,8 +43,8 @@ const U MAX_MIPMAPS = 16;
 const U MAX_TEXTURE_LAYERS = 32;
 const U MAX_SPECIALIZED_CONSTS = 64;
 
-const U MAX_TEXTURE_BINDINGS = 8;
-const U MAX_UNIFORM_BUFFER_BINDINGS = 5;
+const U MAX_TEXTURE_BINDINGS = 16;
+const U MAX_UNIFORM_BUFFER_BINDINGS = 4;
 const U MAX_STORAGE_BUFFER_BINDINGS = 4;
 const U MAX_IMAGE_BINDINGS = 4;
 const U MAX_TEXTURE_BUFFER_BINDINGS = 4;

+ 2 - 2
src/anki/gr/RenderGraph.cpp

@@ -1218,7 +1218,7 @@ Error RenderGraph::dumpDependencyDotFile(
 			StringAuto barrierLabel(ctx.m_alloc);
 			if(barrier.m_isTexture)
 			{
-				barrierLabel.sprintf("<b>%s</b> (mip,dp,f,l)=(%u,%u,%u,%u)<br/>%s <b>-&gt;</b> %s",
+				barrierLabel.sprintf("<b>%s</b> (mip,dp,f,l)=(%u,%u,%u,%u)<br/>%s <b>to</b> %s",
 					&descr.m_renderTargets[barrier.m_texture.m_idx].m_name[0],
 					barrier.m_texture.m_surface.m_level,
 					barrier.m_texture.m_surface.m_depth,
@@ -1231,7 +1231,7 @@ Error RenderGraph::dumpDependencyDotFile(
 			}
 			else
 			{
-				barrierLabel.sprintf("<b>%s</b><br/>%s <b>-&gt;</b> %s",
+				barrierLabel.sprintf("<b>%s</b><br/>%s <b>to</b> %s",
 					&descr.m_buffers[barrier.m_buffer.m_idx].m_name[0],
 					bufferUsageToStr(alloc, barrier.m_buffer.m_usageBefore).cstr(),
 					bufferUsageToStr(alloc, barrier.m_buffer.m_usageAfter).cstr());

+ 5 - 11
src/anki/renderer/LightShading.cpp

@@ -148,20 +148,14 @@ void LightShading::run(const RenderingContext& ctx, RenderPassWorkContext& rgrap
 		TextureSubresourceInfo(DepthStencilAspectBit::DEPTH),
 		m_r->getNearestSampler());
 
-	rgraphCtx.bindColorTextureAndSampler(0, 4, m_r->getShadowMapping().getShadowmapRt(), m_r->getLinearSampler());
-	rgraphCtx.bindColorTextureAndSampler(0, 5, m_r->getIndirect().getReflectionRt(), m_r->getTrilinearRepeatSampler());
-	rgraphCtx.bindColorTextureAndSampler(0, 6, m_r->getIndirect().getIrradianceRt(), m_r->getLinearSampler());
-	cmdb->bindTextureAndSampler(0,
-		7,
-		m_r->getIndirect().getIntegrationLut(),
-		m_r->getIndirect().getIntegrationLutSampler(),
-		TextureUsageBit::SAMPLED_FRAGMENT);
+	rgraphCtx.bindColorTextureAndSampler(0, 4, m_r->getReflections().getRt(), m_r->getNearestSampler());
+
+	rgraphCtx.bindColorTextureAndSampler(0, 5, m_r->getShadowMapping().getShadowmapRt(), m_r->getLinearSampler());
 
 	// Bind uniforms
 	bindUniforms(cmdb, 0, 0, rsrc.m_commonUniformsToken);
 	bindUniforms(cmdb, 0, 1, rsrc.m_pointLightsToken);
 	bindUniforms(cmdb, 0, 2, rsrc.m_spotLightsToken);
-	bindUniforms(cmdb, 0, 3, rsrc.m_probesToken);
 
 	// Bind storage
 	bindStorage(cmdb, 0, 0, rsrc.m_clustersToken);
@@ -228,9 +222,9 @@ void LightShading::populateRenderGraph(RenderingContext& ctx)
 		TextureUsageBit::SAMPLED_FRAGMENT,
 		TextureSubresourceInfo(DepthStencilAspectBit::DEPTH)});
 	pass.newConsumer({m_r->getShadowMapping().getShadowmapRt(), TextureUsageBit::SAMPLED_FRAGMENT});
-	pass.newConsumer({m_r->getIndirect().getReflectionRt(), TextureUsageBit::SAMPLED_FRAGMENT});
-	pass.newConsumer({m_r->getIndirect().getIrradianceRt(), TextureUsageBit::SAMPLED_FRAGMENT});
+	pass.newConsumer({m_r->getReflections().getRt(), TextureUsageBit::SAMPLED_FRAGMENT});
 
+	// For forward shading
 	pass.newConsumer({m_r->getDepthDownscale().getHiZRt(), TextureUsageBit::SAMPLED_FRAGMENT, HIZ_HALF_DEPTH});
 	pass.newConsumer({m_r->getForwardShading().getRt(), TextureUsageBit::SAMPLED_FRAGMENT});
 

+ 25 - 24
src/anki/renderer/Reflections.cpp

@@ -42,11 +42,10 @@ Error Reflections::initInternal(const ConfigSet& cfg)
 		LIGHT_SHADING_COLOR_ATTACHMENT_PIXEL_FORMAT,
 		TextureUsageBit::SAMPLED_FRAGMENT | TextureUsageBit::IMAGE_COMPUTE_WRITE
 			| TextureUsageBit::FRAMEBUFFER_ATTACHMENT_WRITE,
-		"Refl_");
+		"IndirectRes");
 	texinit.m_initialUsage = TextureUsageBit::SAMPLED_FRAGMENT;
 
-	m_reflTex = m_r->createAndClearRenderTarget(texinit);
-	m_irradianceTex = m_r->createAndClearRenderTarget(texinit);
+	m_indirectTex = m_r->createAndClearRenderTarget(texinit);
 
 	// Create shader
 	ANKI_CHECK(getResourceManager().loadResource("programs/Reflections.ankiprog", m_prog));
@@ -78,31 +77,28 @@ Error Reflections::initInternal(const ConfigSet& cfg)
 
 void Reflections::populateRenderGraph(RenderingContext& ctx)
 {
-	return; // TODO
-
 	RenderGraphDescription& rgraph = ctx.m_renderGraphDescr;
 	m_runCtx.m_ctx = &ctx;
 
 	// Create RTs
-	m_runCtx.m_reflRt = rgraph.importRenderTarget("Refl", m_reflTex, TextureUsageBit::SAMPLED_FRAGMENT);
-	m_runCtx.m_irradianceRt = rgraph.importRenderTarget("ReflIrr", m_irradianceTex, TextureUsageBit::SAMPLED_FRAGMENT);
+	m_runCtx.m_indirectRt = rgraph.importRenderTarget("IndirectRes", m_indirectTex, TextureUsageBit::SAMPLED_FRAGMENT);
 
 	// Create pass
-	ComputeRenderPassDescription& rpass = rgraph.newComputeRenderPass("Refl");
+	ComputeRenderPassDescription& rpass = rgraph.newComputeRenderPass("IndirectRes");
 	rpass.setWork(runCallback, this, 0);
 
-	rpass.newConsumer({m_runCtx.m_reflRt, TextureUsageBit::IMAGE_COMPUTE_WRITE});
-	rpass.newConsumer({m_runCtx.m_irradianceRt, TextureUsageBit::IMAGE_COMPUTE_WRITE});
+	rpass.newConsumer({m_runCtx.m_indirectRt, TextureUsageBit::IMAGE_COMPUTE_WRITE});
+	rpass.newConsumer({m_r->getGBuffer().getColorRt(0), TextureUsageBit::SAMPLED_COMPUTE});
 	rpass.newConsumer({m_r->getGBuffer().getColorRt(1), TextureUsageBit::SAMPLED_COMPUTE});
 	rpass.newConsumer({m_r->getGBuffer().getColorRt(2), TextureUsageBit::SAMPLED_COMPUTE});
 	rpass.newConsumer({m_r->getGBuffer().getDepthRt(), TextureUsageBit::SAMPLED_COMPUTE});
 	rpass.newConsumer({m_r->getDepthDownscale().getHiZRt(), TextureUsageBit::SAMPLED_COMPUTE});
 	rpass.newConsumer({m_r->getDownscaleBlur().getRt(), TextureUsageBit::SAMPLED_COMPUTE});
+
 	rpass.newConsumer({m_r->getIndirect().getReflectionRt(), TextureUsageBit::SAMPLED_COMPUTE});
 	rpass.newConsumer({m_r->getIndirect().getIrradianceRt(), TextureUsageBit::SAMPLED_COMPUTE});
 
-	rpass.newProducer({m_runCtx.m_reflRt, TextureUsageBit::IMAGE_COMPUTE_WRITE});
-	rpass.newProducer({m_runCtx.m_irradianceRt, TextureUsageBit::IMAGE_COMPUTE_WRITE});
+	rpass.newProducer({m_runCtx.m_indirectRt, TextureUsageBit::IMAGE_COMPUTE_WRITE});
 }
 
 void Reflections::run(RenderPassWorkContext& rgraphCtx)
@@ -110,25 +106,30 @@ void Reflections::run(RenderPassWorkContext& rgraphCtx)
 	CommandBufferPtr& cmdb = rgraphCtx.m_commandBuffer;
 	cmdb->bindShaderProgram(m_grProg[m_r->getFrameCount() & 1]);
 
-	rgraphCtx.bindColorTextureAndSampler(0, 0, m_r->getGBuffer().getColorRt(1), m_r->getNearestSampler());
-	rgraphCtx.bindColorTextureAndSampler(0, 1, m_r->getGBuffer().getColorRt(2), m_r->getNearestSampler());
-	rgraphCtx.bindColorTextureAndSampler(0, 2, m_r->getDepthDownscale().getHiZRt(), m_r->getNearestNearestSampler());
-	rgraphCtx.bindColorTextureAndSampler(0, 3, m_r->getDownscaleBlur().getRt(), m_r->getTrilinearRepeatSampler());
+	// Bind textures
+	rgraphCtx.bindColorTextureAndSampler(0, 0, m_r->getGBuffer().getColorRt(0), m_r->getNearestSampler());
+	rgraphCtx.bindColorTextureAndSampler(0, 1, m_r->getGBuffer().getColorRt(1), m_r->getNearestSampler());
+	rgraphCtx.bindColorTextureAndSampler(0, 2, m_r->getGBuffer().getColorRt(2), m_r->getNearestSampler());
 	rgraphCtx.bindTextureAndSampler(0,
-		4,
+		3,
 		m_r->getGBuffer().getDepthRt(),
 		TextureSubresourceInfo(DepthStencilAspectBit::DEPTH),
 		m_r->getNearestSampler());
+	rgraphCtx.bindColorTextureAndSampler(0, 4, m_r->getDepthDownscale().getHiZRt(), m_r->getNearestNearestSampler());
+	rgraphCtx.bindColorTextureAndSampler(0, 5, m_r->getDownscaleBlur().getRt(), m_r->getTrilinearRepeatSampler());
 
-	rgraphCtx.bindImage(0, 0, m_runCtx.m_reflRt, TextureSubresourceInfo());
-	rgraphCtx.bindImage(0, 1, m_runCtx.m_irradianceRt, TextureSubresourceInfo());
+	rgraphCtx.bindColorTextureAndSampler(0, 6, m_r->getIndirect().getReflectionRt(), m_r->getTrilinearRepeatSampler());
+	rgraphCtx.bindColorTextureAndSampler(0, 7, m_r->getIndirect().getIrradianceRt(), m_r->getTrilinearRepeatSampler());
+	cmdb->bindTextureAndSampler(0,
+		8,
+		m_r->getIndirect().getIntegrationLut(),
+		m_r->getIndirect().getIntegrationLutSampler(),
+		TextureUsageBit::SAMPLED_COMPUTE);
 
-	// Bind light shading stuff
-	rgraphCtx.bindColorTextureAndSampler(0, 5, m_r->getIndirect().getReflectionRt(), m_r->getTrilinearRepeatSampler());
-	rgraphCtx.bindColorTextureAndSampler(0, 6, m_r->getIndirect().getIrradianceRt(), m_r->getTrilinearRepeatSampler());
-	cmdb->bindTextureAndSampler(
-		0, 7, m_r->getDummyTextureView(), m_r->getNearestSampler(), TextureUsageBit::SAMPLED_COMPUTE);
+	// Bind image
+	rgraphCtx.bindImage(0, 0, m_runCtx.m_indirectRt, TextureSubresourceInfo());
 
+	// Bind uniforms
 	const LightShadingResources& rsrc = m_r->getLightShading().getResources();
 	bindUniforms(cmdb, 0, 0, rsrc.m_commonUniformsToken);
 	bindUniforms(cmdb, 0, 1, rsrc.m_probesToken);

+ 5 - 12
src/anki/renderer/Reflections.h

@@ -13,7 +13,7 @@ namespace anki
 /// @addtogroup renderer
 /// @{
 
-/// Reflections pass.
+/// Reflections pass. It does SSR and probe reflections and it conbines them with the irradiance as well.
 class Reflections : public RendererObject
 {
 anki_internal:
@@ -29,30 +29,23 @@ anki_internal:
 	/// Populate the rendergraph.
 	void populateRenderGraph(RenderingContext& ctx);
 
-	RenderTargetHandle getReflectionRt() const
+	RenderTargetHandle getRt() const
 	{
-		return m_runCtx.m_reflRt;
-	}
-
-	RenderTargetHandle getIrradianceRt() const
-	{
-		return m_runCtx.m_irradianceRt;
+		return m_runCtx.m_indirectRt;
 	}
 
 private:
 	ShaderProgramResourcePtr m_prog;
 	Array<ShaderProgramPtr, 2> m_grProg;
 
-	TexturePtr m_reflTex;
-	TexturePtr m_irradianceTex;
+	TexturePtr m_indirectTex;
 
 	Array<U8, 2> m_workgroupSize = {{16, 16}};
 
 	class
 	{
 	public:
-		RenderTargetHandle m_reflRt;
-		RenderTargetHandle m_irradianceRt;
+		RenderTargetHandle m_indirectRt;
 		RenderingContext* m_ctx ANKI_DBG_NULLIFY;
 	} m_runCtx;
 

+ 1 - 1
src/anki/renderer/Renderer.cpp

@@ -270,10 +270,10 @@ Error Renderer::populateRenderGraph(RenderingContext& ctx)
 	m_indirect->populateRenderGraph(ctx);
 	m_gbuffer->populateRenderGraph(ctx);
 	m_depth->populateRenderGraph(ctx);
-	m_refl->populateRenderGraph(ctx);
 	m_vol->populateRenderGraph(ctx);
 	m_ssao->populateRenderGraph(ctx);
 	m_gbufferPost->populateRenderGraph(ctx);
+	m_refl->populateRenderGraph(ctx);
 	m_lensFlare->populateRenderGraph(ctx);
 	m_forwardShading->populateRenderGraph(ctx);
 	m_lightShading->populateRenderGraph(ctx);