Browse Source

Some refactoring

Panagiotis Christopoulos Charitos 3 years ago
parent
commit
03e64868f2

+ 0 - 1
AnKi/Importer/GltfImporter.cpp

@@ -1087,7 +1087,6 @@ Error GltfImporter::writeCamera(const cgltf_node& node,
 	ANKI_CHECK(m_sceneFile.writeTextf("frustumc:setPerspective(%f, %f, getMainRenderer():getAspectRatio() * %f, %f)\n",
 	ANKI_CHECK(m_sceneFile.writeTextf("frustumc:setPerspective(%f, %f, getMainRenderer():getAspectRatio() * %f, %f)\n",
 									  cam.znear, cam.zfar, cam.yfov, cam.yfov));
 									  cam.znear, cam.zfar, cam.yfov, cam.yfov));
 	ANKI_CHECK(m_sceneFile.writeText("frustumc:setShadowCascadesDistancePower(1.5)\n"));
 	ANKI_CHECK(m_sceneFile.writeText("frustumc:setShadowCascadesDistancePower(1.5)\n"));
-	ANKI_CHECK(m_sceneFile.writeTextf("frustumc:setEffectiveShadowDistance(%f)\n", min(cam.zfar, 100.0f)));
 
 
 	return Error::kNone;
 	return Error::kNone;
 }
 }

+ 3 - 6
AnKi/Renderer/ConfigVars.defs.h

@@ -59,14 +59,11 @@ ANKI_CONFIG_VAR_F32(RIndirectDiffuseVrsDistanceThreshold, 0.01f, 0.00001f, 10.0f
 					"The meters that control the VRS SRI generation")
 					"The meters that control the VRS SRI generation")
 
 
 // Shadows
 // Shadows
-ANKI_CONFIG_VAR_U32(RShadowMappingTileResolution, ((ANKI_PLATFORM_MOBILE) ? 128 : 512), 16, 2048,
+ANKI_CONFIG_VAR_U32(RShadowMappingTileResolution, ((ANKI_PLATFORM_MOBILE) ? 64 : 256), 16, 2048,
 					"Shadowmapping tile resolution")
 					"Shadowmapping tile resolution")
-ANKI_CONFIG_VAR_U32(RShadowMappingTileCountPerRowOrColumn, 16, 1, 256,
+ANKI_CONFIG_VAR_U32(RShadowMappingTileCountPerRowOrColumn, 32, 1, 256,
 					"Shadowmapping atlas will have this number squared number of tiles")
 					"Shadowmapping atlas will have this number squared number of tiles")
-ANKI_CONFIG_VAR_U32(RShadowMappingScratchTileCountX, 4 * (kMaxShadowCascades + 2), 1, 256,
-					"Number of tiles of the scratch buffer in X")
-ANKI_CONFIG_VAR_U32(RShadowMappingScratchTileCountY, 4, 1, 256, "Number of tiles of the scratch buffer in Y")
-ANKI_CONFIG_VAR_BOOL(RShadowMappingPcf, (ANKI_PLATFORM_MOBILE) ? false : true, "Enable or not PCF")
+ANKI_CONFIG_VAR_U32(RShadowMappingPcf, ((ANKI_PLATFORM_MOBILE) ? 0 : 1), 0, 1, "Shadow PCF (0: off, 1: on)")
 
 
 // Probe reflections
 // Probe reflections
 ANKI_CONFIG_VAR_U32(RProbeReflectionResolution, 128, 4, 2048, "Reflection probe face resolution")
 ANKI_CONFIG_VAR_U32(RProbeReflectionResolution, 128, 4, 2048, "Reflection probe face resolution")

+ 26 - 27
AnKi/Renderer/ShadowMapping.cpp

@@ -69,7 +69,7 @@ Error ShadowMapping::initInternal()
 	}
 	}
 
 
 	// Tiles
 	// Tiles
-	m_tileAlloc.init(&getMemoryPool(), m_tileCountBothAxis, m_tileCountBothAxis, kTileAllocLodCount, true);
+	m_tileAlloc.init(&getMemoryPool(), m_tileCountBothAxis, m_tileCountBothAxis, kTileAllocHierarchyCount, true);
 
 
 	m_fbDescr.m_depthStencilAttachment.m_aspect = DepthStencilAspectBit::kDepth;
 	m_fbDescr.m_depthStencilAttachment.m_aspect = DepthStencilAspectBit::kDepth;
 	m_fbDescr.m_depthStencilAttachment.m_loadOperation = AttachmentLoadOperation::kLoad;
 	m_fbDescr.m_depthStencilAttachment.m_loadOperation = AttachmentLoadOperation::kLoad;
@@ -149,25 +149,24 @@ Mat4 ShadowMapping::createSpotLightTextureMatrix(const UVec4& viewport) const
 				0.0f, 0.0f, 0.0f, 1.0f);
 				0.0f, 0.0f, 0.0f, 1.0f);
 }
 }
 
 
-void ShadowMapping::chooseLods(const Vec4& cameraOrigin, const PointLightQueueElement& light, U32& tileBufferLod,
-							   U32& renderQueueElementsLod) const
+void ShadowMapping::chooseDetail(const Vec4& cameraOrigin, const PointLightQueueElement& light,
+								 U32& tileAllocatorHierarchy, U32& renderQueueElementsLod) const
 {
 {
 	const F32 distFromTheCamera = (cameraOrigin - light.m_worldPosition.xyz0()).getLength() - light.m_radius;
 	const F32 distFromTheCamera = (cameraOrigin - light.m_worldPosition.xyz0()).getLength() - light.m_radius;
 	if(distFromTheCamera < getConfig().getLod0MaxDistance())
 	if(distFromTheCamera < getConfig().getLod0MaxDistance())
 	{
 	{
-		ANKI_ASSERT(kPointLightMaxTileLod == 1);
-		tileBufferLod = 1;
+		tileAllocatorHierarchy = kPointLightMaxTileAllocHierarchy;
 		renderQueueElementsLod = 0;
 		renderQueueElementsLod = 0;
 	}
 	}
 	else
 	else
 	{
 	{
-		tileBufferLod = 0;
+		tileAllocatorHierarchy = max(kPointLightMaxTileAllocHierarchy, 1u) - 1;
 		renderQueueElementsLod = kMaxLodCount - 1;
 		renderQueueElementsLod = kMaxLodCount - 1;
 	}
 	}
 }
 }
 
 
-void ShadowMapping::chooseLods(const Vec4& cameraOrigin, const SpotLightQueueElement& light, U32& tileBufferLod,
-							   U32& renderQueueElementsLod) const
+void ShadowMapping::chooseDetail(const Vec4& cameraOrigin, const SpotLightQueueElement& light,
+								 U32& tileAllocatorHierarchy, U32& renderQueueElementsLod) const
 {
 {
 	// Get some data
 	// Get some data
 	const Vec4 coneOrigin = light.m_worldTransform.getTranslationPart().xyz0();
 	const Vec4 coneOrigin = light.m_worldTransform.getTranslationPart().xyz0();
@@ -182,23 +181,23 @@ void ShadowMapping::chooseLods(const Vec4& cameraOrigin, const SpotLightQueueEle
 
 
 	if(distFromTheCamera < getConfig().getLod0MaxDistance())
 	if(distFromTheCamera < getConfig().getLod0MaxDistance())
 	{
 	{
-		tileBufferLod = 2;
+		tileAllocatorHierarchy = kSpotLightMaxTileAllocHierarchy;
 		renderQueueElementsLod = 0;
 		renderQueueElementsLod = 0;
 	}
 	}
 	else if(distFromTheCamera < getConfig().getLod1MaxDistance())
 	else if(distFromTheCamera < getConfig().getLod1MaxDistance())
 	{
 	{
-		tileBufferLod = 1;
+		tileAllocatorHierarchy = max(kSpotLightMaxTileAllocHierarchy, 1u) - 1;
 		renderQueueElementsLod = kMaxLodCount - 1;
 		renderQueueElementsLod = kMaxLodCount - 1;
 	}
 	}
 	else
 	else
 	{
 	{
-		tileBufferLod = 0;
+		tileAllocatorHierarchy = max(kSpotLightMaxTileAllocHierarchy, 2u) - 2;
 		renderQueueElementsLod = kMaxLodCount - 1;
 		renderQueueElementsLod = kMaxLodCount - 1;
 	}
 	}
 }
 }
 
 
 Bool ShadowMapping::allocateAtlasTiles(U64 lightUuid, U32 faceCount, const U64* faceTimestamps, const U32* faceIndices,
 Bool ShadowMapping::allocateAtlasTiles(U64 lightUuid, U32 faceCount, const U64* faceTimestamps, const U32* faceIndices,
-									   const U32* drawcallsCount, const U32* lods, UVec4* atlasTileViewports,
+									   const U32* drawcallsCount, const U32* hierarchies, UVec4* atlasTileViewports,
 									   TileAllocatorResult* subResults)
 									   TileAllocatorResult* subResults)
 {
 {
 	ANKI_ASSERT(lightUuid > 0);
 	ANKI_ASSERT(lightUuid > 0);
@@ -206,13 +205,13 @@ Bool ShadowMapping::allocateAtlasTiles(U64 lightUuid, U32 faceCount, const U64*
 	ANKI_ASSERT(faceTimestamps);
 	ANKI_ASSERT(faceTimestamps);
 	ANKI_ASSERT(faceIndices);
 	ANKI_ASSERT(faceIndices);
 	ANKI_ASSERT(drawcallsCount);
 	ANKI_ASSERT(drawcallsCount);
-	ANKI_ASSERT(lods);
+	ANKI_ASSERT(hierarchies);
 
 
 	for(U i = 0; i < faceCount; ++i)
 	for(U i = 0; i < faceCount; ++i)
 	{
 	{
 		Array<U32, 4> tileViewport;
 		Array<U32, 4> tileViewport;
 		subResults[i] = m_tileAlloc.allocate(m_r->getGlobalTimestamp(), faceTimestamps[i], lightUuid, faceIndices[i],
 		subResults[i] = m_tileAlloc.allocate(m_r->getGlobalTimestamp(), faceTimestamps[i], lightUuid, faceIndices[i],
-											 drawcallsCount[i], lods[i], tileViewport);
+											 drawcallsCount[i], hierarchies[i], tileViewport);
 
 
 		if(subResults[i] == TileAllocatorResult::kAllocationFailed)
 		if(subResults[i] == TileAllocatorResult::kAllocationFailed)
 		{
 		{
@@ -267,8 +266,8 @@ void ShadowMapping::processLights(RenderingContext& ctx, U32& threadCountForPass
 	UVec4 emptyTileViewport;
 	UVec4 emptyTileViewport;
 	{
 	{
 		Array<U32, 4> tileViewport;
 		Array<U32, 4> tileViewport;
-		[[maybe_unused]] const TileAllocatorResult res =
-			m_tileAlloc.allocate(m_r->getGlobalTimestamp(), 1, kMaxU64, 0, 1, kPointLightMaxTileLod, tileViewport);
+		[[maybe_unused]] const TileAllocatorResult res = m_tileAlloc.allocate(
+			m_r->getGlobalTimestamp(), 1, kMaxU64, 0, 1, kPointLightMaxTileAllocHierarchy, tileViewport);
 
 
 		emptyTileViewport = UVec4(tileViewport);
 		emptyTileViewport = UVec4(tileViewport);
 
 
@@ -296,7 +295,7 @@ void ShadowMapping::processLights(RenderingContext& ctx, U32& threadCountForPass
 		Array<U32, kMaxShadowCascades> drawcallCounts;
 		Array<U32, kMaxShadowCascades> drawcallCounts;
 		Array<UVec4, kMaxShadowCascades> atlasViewports;
 		Array<UVec4, kMaxShadowCascades> atlasViewports;
 		Array<TileAllocatorResult, kMaxShadowCascades> subResults;
 		Array<TileAllocatorResult, kMaxShadowCascades> subResults;
-		Array<U32, kMaxShadowCascades> lods;
+		Array<U32, kMaxShadowCascades> hierarchies;
 		Array<U32, kMaxShadowCascades> renderQueueElementsLods;
 		Array<U32, kMaxShadowCascades> renderQueueElementsLods;
 
 
 		U32 activeCascades = 0;
 		U32 activeCascades = 0;
@@ -313,7 +312,7 @@ void ShadowMapping::processLights(RenderingContext& ctx, U32& threadCountForPass
 				drawcallCounts[activeCascades] = 1; // Doesn't matter
 				drawcallCounts[activeCascades] = 1; // Doesn't matter
 
 
 				// Change the quality per cascade
 				// Change the quality per cascade
-				lods[activeCascades] = (cascade <= 1) ? (kMaxLodCount - 1) : (lods[0] - 1);
+				hierarchies[activeCascades] = (cascade <= 1) ? (kTileAllocHierarchyCount - 1) : (hierarchies[0] - 1);
 				renderQueueElementsLods[activeCascades] = (cascade == 0) ? 0 : (kMaxLodCount - 1);
 				renderQueueElementsLods[activeCascades] = (cascade == 0) ? 0 : (kMaxLodCount - 1);
 
 
 				++activeCascades;
 				++activeCascades;
@@ -323,7 +322,7 @@ void ShadowMapping::processLights(RenderingContext& ctx, U32& threadCountForPass
 		const Bool allocationFailed =
 		const Bool allocationFailed =
 			activeCascades == 0
 			activeCascades == 0
 			|| !allocateAtlasTiles(light.m_uuid, activeCascades, &timestamps[0], &cascadeIndices[0], &drawcallCounts[0],
 			|| !allocateAtlasTiles(light.m_uuid, activeCascades, &timestamps[0], &cascadeIndices[0], &drawcallCounts[0],
-								   &lods[0], &atlasViewports[0], &subResults[0]);
+								   &hierarchies[0], &atlasViewports[0], &subResults[0]);
 
 
 		if(!allocationFailed)
 		if(!allocationFailed)
 		{
 		{
@@ -376,11 +375,11 @@ void ShadowMapping::processLights(RenderingContext& ctx, U32& threadCountForPass
 		Array<U32, 6> drawcallCounts;
 		Array<U32, 6> drawcallCounts;
 		Array<UVec4, 6> atlasViewports;
 		Array<UVec4, 6> atlasViewports;
 		Array<TileAllocatorResult, 6> subResults;
 		Array<TileAllocatorResult, 6> subResults;
-		Array<U32, 6> lods;
+		Array<U32, 6> hierarchies;
 		U32 numOfFacesThatHaveDrawcalls = 0;
 		U32 numOfFacesThatHaveDrawcalls = 0;
 
 
-		U32 lod, renderQueueElementsLod;
-		chooseLods(cameraOrigin, light, lod, renderQueueElementsLod);
+		U32 hierarchy, renderQueueElementsLod;
+		chooseDetail(cameraOrigin, light, hierarchy, renderQueueElementsLod);
 
 
 		for(U32 face = 0; face < 6; ++face)
 		for(U32 face = 0; face < 6; ++face)
 		{
 		{
@@ -395,7 +394,7 @@ void ShadowMapping::processLights(RenderingContext& ctx, U32& threadCountForPass
 
 
 				drawcallCounts[numOfFacesThatHaveDrawcalls] = light.m_shadowRenderQueues[face]->m_renderables.getSize();
 				drawcallCounts[numOfFacesThatHaveDrawcalls] = light.m_shadowRenderQueues[face]->m_renderables.getSize();
 
 
-				lods[numOfFacesThatHaveDrawcalls] = lod;
+				hierarchies[numOfFacesThatHaveDrawcalls] = hierarchy;
 
 
 				++numOfFacesThatHaveDrawcalls;
 				++numOfFacesThatHaveDrawcalls;
 			}
 			}
@@ -404,7 +403,7 @@ void ShadowMapping::processLights(RenderingContext& ctx, U32& threadCountForPass
 		const Bool allocationFailed =
 		const Bool allocationFailed =
 			numOfFacesThatHaveDrawcalls == 0
 			numOfFacesThatHaveDrawcalls == 0
 			|| !allocateAtlasTiles(light.m_uuid, numOfFacesThatHaveDrawcalls, &timestamps[0], &faceIndices[0],
 			|| !allocateAtlasTiles(light.m_uuid, numOfFacesThatHaveDrawcalls, &timestamps[0], &faceIndices[0],
-								   &drawcallCounts[0], &lods[0], &atlasViewports[0], &subResults[0]);
+								   &drawcallCounts[0], &hierarchies[0], &atlasViewports[0], &subResults[0]);
 
 
 		if(!allocationFailed)
 		if(!allocationFailed)
 		{
 		{
@@ -483,13 +482,13 @@ void ShadowMapping::processLights(RenderingContext& ctx, U32& threadCountForPass
 		UVec4 scratchViewport;
 		UVec4 scratchViewport;
 		const U32 localDrawcallCount = light.m_shadowRenderQueue->m_renderables.getSize();
 		const U32 localDrawcallCount = light.m_shadowRenderQueue->m_renderables.getSize();
 
 
-		U32 lod, renderQueueElementsLod;
-		chooseLods(cameraOrigin, light, lod, renderQueueElementsLod);
+		U32 hierarchy, renderQueueElementsLod;
+		chooseDetail(cameraOrigin, light, hierarchy, renderQueueElementsLod);
 
 
 		const Bool allocationFailed =
 		const Bool allocationFailed =
 			localDrawcallCount == 0
 			localDrawcallCount == 0
 			|| !allocateAtlasTiles(light.m_uuid, 1, &light.m_shadowRenderQueue->m_shadowRenderablesLastUpdateTimestamp,
 			|| !allocateAtlasTiles(light.m_uuid, 1, &light.m_shadowRenderQueue->m_shadowRenderablesLastUpdateTimestamp,
-								   &faceIdx, &localDrawcallCount, &lod, &atlasViewport, &subResult);
+								   &faceIdx, &localDrawcallCount, &hierarchy, &atlasViewport, &subResult);
 
 
 		if(!allocationFailed)
 		if(!allocationFailed)
 		{
 		{

+ 10 - 10
AnKi/Renderer/ShadowMapping.h

@@ -40,10 +40,10 @@ private:
 	class LightToRenderTempInfo;
 	class LightToRenderTempInfo;
 	class ThreadWorkItem;
 	class ThreadWorkItem;
 
 
-	static constexpr U32 kPointLightMaxTileLod = 1;
-
 	TileAllocator m_tileAlloc;
 	TileAllocator m_tileAlloc;
-	static constexpr U32 kTileAllocLodCount = 3;
+	static constexpr U32 kTileAllocHierarchyCount = 4;
+	static constexpr U32 kPointLightMaxTileAllocHierarchy = 1;
+	static constexpr U32 kSpotLightMaxTileAllocHierarchy = 1;
 
 
 	TexturePtr m_atlasTex; ///<  Size (m_tileResolution*m_tileCountBothAxis)^2
 	TexturePtr m_atlasTex; ///<  Size (m_tileResolution*m_tileCountBothAxis)^2
 	Bool m_rtImportedOnce = false;
 	Bool m_rtImportedOnce = false;
@@ -69,17 +69,17 @@ private:
 	void processLights(RenderingContext& ctx, U32& threadCountForScratchPass);
 	void processLights(RenderingContext& ctx, U32& threadCountForScratchPass);
 
 
 	Bool allocateAtlasTiles(U64 lightUuid, U32 faceCount, const U64* faceTimestamps, const U32* faceIndices,
 	Bool allocateAtlasTiles(U64 lightUuid, U32 faceCount, const U64* faceTimestamps, const U32* faceIndices,
-							const U32* drawcallsCount, const U32* lods, UVec4* atlasTileViewports,
+							const U32* drawcallsCount, const U32* hierarchies, UVec4* atlasTileViewports,
 							TileAllocatorResult* subResults);
 							TileAllocatorResult* subResults);
 
 
 	Mat4 createSpotLightTextureMatrix(const UVec4& viewport) const;
 	Mat4 createSpotLightTextureMatrix(const UVec4& viewport) const;
 
 
-	/// Find the lod of the light
-	void chooseLods(const Vec4& cameraOrigin, const PointLightQueueElement& light, U32& tileBufferLod,
-					U32& renderQueueElementsLod) const;
-	/// Find the lod of the light
-	void chooseLods(const Vec4& cameraOrigin, const SpotLightQueueElement& light, U32& tileBufferLod,
-					U32& renderQueueElementsLod) const;
+	/// Find the detail of the light
+	void chooseDetail(const Vec4& cameraOrigin, const PointLightQueueElement& light, U32& tileAllocatorHierarchy,
+					  U32& renderQueueElementsLod) const;
+	/// Find the detail of the light
+	void chooseDetail(const Vec4& cameraOrigin, const SpotLightQueueElement& light, U32& tileAllocatorHierarchy,
+					  U32& renderQueueElementsLod) const;
 
 
 	void newWorkItems(const UVec4& atlasViewport, RenderQueue* lightRenderQueue, U32 renderQueueElementsLod,
 	void newWorkItems(const UVec4& atlasViewport, RenderQueue* lightRenderQueue, U32 renderQueueElementsLod,
 					  DynamicArrayRaii<LightToRenderTempInfo>& workItems, U32& drawcallCount) const;
 					  DynamicArrayRaii<LightToRenderTempInfo>& workItems, U32& drawcallCount) const;

+ 56 - 49
AnKi/Renderer/TileAllocator.cpp

@@ -10,14 +10,14 @@ namespace anki {
 class TileAllocator::Tile
 class TileAllocator::Tile
 {
 {
 public:
 public:
-	Timestamp m_lightTimestamp = 0; ///< The last timestamp the light got updated
-	Timestamp m_lastUsedTimestamp = 0; ///< The last timestamp this tile was used
+	Timestamp m_lightTimestamp = 0; ///< The last timestamp the light got updated.
+	Timestamp m_lastUsedTimestamp = 0; ///< The last timestamp this tile was used.
 	U64 m_lightUuid = 0;
 	U64 m_lightUuid = 0;
 	U32 m_lightDrawcallCount = 0;
 	U32 m_lightDrawcallCount = 0;
 	Array<U32, 4> m_viewport = {};
 	Array<U32, 4> m_viewport = {};
 	Array<U32, 4> m_subTiles = {kMaxU32, kMaxU32, kMaxU32, kMaxU32};
 	Array<U32, 4> m_subTiles = {kMaxU32, kMaxU32, kMaxU32, kMaxU32};
-	U32 m_superTile = kMaxU32;
-	U8 m_lightLod = 0;
+	U32 m_superTile = kMaxU32; ///< The parent.
+	U8 m_lightHierarchy = 0;
 	U8 m_lightFace = 0;
 	U8 m_lightFace = 0;
 };
 };
 
 
@@ -37,68 +37,71 @@ TileAllocator::~TileAllocator()
 {
 {
 	m_lightInfoToTileIdx.destroy(*m_pool);
 	m_lightInfoToTileIdx.destroy(*m_pool);
 	m_allTiles.destroy(*m_pool);
 	m_allTiles.destroy(*m_pool);
-	m_lodFirstTileIndex.destroy(*m_pool);
+	m_firstTileIdxOfHierarchy.destroy(*m_pool);
 }
 }
 
 
-void TileAllocator::init(HeapMemoryPool* pool, U32 tileCountX, U32 tileCountY, U32 lodCount, Bool enableCaching)
+void TileAllocator::init(HeapMemoryPool* pool, U32 tileCountX, U32 tileCountY, U32 hierarchyCount, Bool enableCaching)
 {
 {
 	// Preconditions
 	// Preconditions
 	ANKI_ASSERT(tileCountX > 0);
 	ANKI_ASSERT(tileCountX > 0);
 	ANKI_ASSERT(tileCountY > 0);
 	ANKI_ASSERT(tileCountY > 0);
-	ANKI_ASSERT(lodCount > 0);
+	ANKI_ASSERT(hierarchyCount > 0);
 
 
 	// Store some stuff
 	// Store some stuff
 	m_tileCountX = U16(tileCountX);
 	m_tileCountX = U16(tileCountX);
 	m_tileCountY = U16(tileCountY);
 	m_tileCountY = U16(tileCountY);
-	m_lodCount = U8(lodCount);
+	m_hierarchyCount = U8(hierarchyCount);
 	m_pool = pool;
 	m_pool = pool;
 	m_cachingEnabled = enableCaching;
 	m_cachingEnabled = enableCaching;
-	m_lodFirstTileIndex.create(*m_pool, lodCount + 1);
+	m_firstTileIdxOfHierarchy.create(*m_pool, hierarchyCount + 1);
 
 
 	// Create the tile array & index ranges
 	// Create the tile array & index ranges
 	U32 tileCount = 0;
 	U32 tileCount = 0;
-	for(U32 lod = 0; lod < lodCount; ++lod)
+	for(U32 hierarchy = 0; hierarchy < hierarchyCount; ++hierarchy)
 	{
 	{
-		const U32 lodTileCountX = tileCountX >> lod;
-		const U32 lodTileCountY = tileCountY >> lod;
-		ANKI_ASSERT((lodTileCountX << lod) == tileCountX && "Every LOD should be power of 2 of its parent LOD");
-		ANKI_ASSERT((lodTileCountY << lod) == tileCountY && "Every LOD should be power of 2 of its parent LOD");
+		const U32 hierarchyTileCountX = tileCountX >> hierarchy;
+		const U32 hierarchyTileCountY = tileCountY >> hierarchy;
+		ANKI_ASSERT((hierarchyTileCountX << hierarchy) == tileCountX
+					&& "Every hierarchy should be power of 2 of its parent hierarchy");
+		ANKI_ASSERT((hierarchyTileCountY << hierarchy) == tileCountY
+					&& "Every hierarchy should be power of 2 of its parent hierarchy");
 
 
-		m_lodFirstTileIndex[lod] = tileCount;
+		m_firstTileIdxOfHierarchy[hierarchy] = tileCount;
 
 
-		tileCount += lodTileCountX * lodTileCountY;
+		tileCount += hierarchyTileCountX * hierarchyTileCountY;
 	}
 	}
 	ANKI_ASSERT(tileCount >= tileCountX * tileCountY);
 	ANKI_ASSERT(tileCount >= tileCountX * tileCountY);
 	m_allTiles.create(*m_pool, tileCount);
 	m_allTiles.create(*m_pool, tileCount);
-	m_lodFirstTileIndex[lodCount] = tileCount - 1;
+	m_firstTileIdxOfHierarchy[hierarchyCount] = tileCount - 1;
 
 
 	// Init the tiles
 	// Init the tiles
 	U32 tileIdx = 0;
 	U32 tileIdx = 0;
-	for(U32 lod = 0; lod < lodCount; ++lod)
+	for(U32 hierarchy = 0; hierarchy < hierarchyCount; ++hierarchy)
 	{
 	{
-		const U32 lodTileCountX = tileCountX >> lod;
-		const U32 lodTileCountY = tileCountY >> lod;
+		const U32 hierarchyTileCountX = tileCountX >> hierarchy;
+		const U32 hierarchyTileCountY = tileCountY >> hierarchy;
 
 
-		for(U32 y = 0; y < lodTileCountY; ++y)
+		for(U32 y = 0; y < hierarchyTileCountY; ++y)
 		{
 		{
-			for(U32 x = 0; x < lodTileCountX; ++x)
+			for(U32 x = 0; x < hierarchyTileCountX; ++x)
 			{
 			{
-				ANKI_ASSERT(tileIdx >= m_lodFirstTileIndex[lod] && tileIdx <= m_lodFirstTileIndex[lod + 1]);
+				ANKI_ASSERT(tileIdx >= m_firstTileIdxOfHierarchy[hierarchy]
+							&& tileIdx <= m_firstTileIdxOfHierarchy[hierarchy + 1]);
 				Tile& tile = m_allTiles[tileIdx];
 				Tile& tile = m_allTiles[tileIdx];
 
 
-				tile.m_viewport[0] = x << lod;
-				tile.m_viewport[1] = y << lod;
-				tile.m_viewport[2] = 1 << lod;
-				tile.m_viewport[3] = 1 << lod;
+				tile.m_viewport[0] = x << hierarchy;
+				tile.m_viewport[1] = y << hierarchy;
+				tile.m_viewport[2] = 1 << hierarchy;
+				tile.m_viewport[3] = 1 << hierarchy;
 
 
-				if(lod > 0)
+				if(hierarchy > 0)
 				{
 				{
 					// Has sub tiles
 					// Has sub tiles
 					for(U32 j = 0; j < 2; ++j)
 					for(U32 j = 0; j < 2; ++j)
 					{
 					{
 						for(U32 i = 0; i < 2; ++i)
 						for(U32 i = 0; i < 2; ++i)
 						{
 						{
-							const U32 subTileIdx = translateTileIdx((x << 1) + i, (y << 1) + j, lod - 1);
+							const U32 subTileIdx = translateTileIdx((x << 1) + i, (y << 1) + j, hierarchy - 1);
 							m_allTiles[subTileIdx].m_superTile = tileIdx;
 							m_allTiles[subTileIdx].m_superTile = tileIdx;
 
 
 							tile.m_subTiles[j * 2 + i] = subTileIdx;
 							tile.m_subTiles[j * 2 + i] = subTileIdx;
@@ -129,7 +132,7 @@ void TileAllocator::updateSubTiles(const Tile& updateFrom)
 		m_allTiles[idx].m_lastUsedTimestamp = updateFrom.m_lastUsedTimestamp;
 		m_allTiles[idx].m_lastUsedTimestamp = updateFrom.m_lastUsedTimestamp;
 		m_allTiles[idx].m_lightUuid = updateFrom.m_lightUuid;
 		m_allTiles[idx].m_lightUuid = updateFrom.m_lightUuid;
 		m_allTiles[idx].m_lightDrawcallCount = updateFrom.m_lightDrawcallCount;
 		m_allTiles[idx].m_lightDrawcallCount = updateFrom.m_lightDrawcallCount;
-		m_allTiles[idx].m_lightLod = updateFrom.m_lightLod;
+		m_allTiles[idx].m_lightHierarchy = updateFrom.m_lightHierarchy;
 		m_allTiles[idx].m_lightFace = updateFrom.m_lightFace;
 		m_allTiles[idx].m_lightFace = updateFrom.m_lightFace;
 
 
 		updateSubTiles(m_allTiles[idx]);
 		updateSubTiles(m_allTiles[idx]);
@@ -146,13 +149,13 @@ void TileAllocator::updateSuperTiles(const Tile& updateFrom)
 	}
 	}
 }
 }
 
 
-Bool TileAllocator::searchTileRecursively(U32 crntTileIdx, U32 crntTileLod, U32 allocationLod, Timestamp crntTimestamp,
-										  U32& emptyTileIdx, U32& toKickTileIdx,
+Bool TileAllocator::searchTileRecursively(U32 crntTileIdx, U32 crntTileHierarchy, U32 allocationHierarchy,
+										  Timestamp crntTimestamp, U32& emptyTileIdx, U32& toKickTileIdx,
 										  Timestamp& tileToKickMinTimestamp) const
 										  Timestamp& tileToKickMinTimestamp) const
 {
 {
 	const Tile& tile = m_allTiles[crntTileIdx];
 	const Tile& tile = m_allTiles[crntTileIdx];
 
 
-	if(crntTileLod == allocationLod)
+	if(crntTileHierarchy == allocationHierarchy)
 	{
 	{
 		// We may have a candidate
 		// We may have a candidate
 
 
@@ -168,12 +171,12 @@ Bool TileAllocator::searchTileRecursively(U32 crntTileIdx, U32 crntTileLod, U32
 	{
 	{
 		// Move down the hierarchy
 		// Move down the hierarchy
 
 
-		ANKI_ASSERT(allocationLod < crntTileLod);
+		ANKI_ASSERT(allocationHierarchy < crntTileHierarchy);
 
 
 		for(const U32 idx : tile.m_subTiles)
 		for(const U32 idx : tile.m_subTiles)
 		{
 		{
-			const Bool done = searchTileRecursively(idx, crntTileLod >> 1, allocationLod, crntTimestamp, emptyTileIdx,
-													toKickTileIdx, tileToKickMinTimestamp);
+			const Bool done = searchTileRecursively(idx, crntTileHierarchy - 1, allocationHierarchy, crntTimestamp,
+													emptyTileIdx, toKickTileIdx, tileToKickMinTimestamp);
 
 
 			if(done)
 			if(done)
 			{
 			{
@@ -218,7 +221,8 @@ Bool TileAllocator::evaluateCandidate(U32 tileIdx, Timestamp crntTimestamp, U32&
 }
 }
 
 
 TileAllocatorResult TileAllocator::allocate(Timestamp crntTimestamp, Timestamp lightTimestamp, U64 lightUuid,
 TileAllocatorResult TileAllocator::allocate(Timestamp crntTimestamp, Timestamp lightTimestamp, U64 lightUuid,
-											U32 lightFace, U32 drawcallCount, U32 lod, Array<U32, 4>& tileViewport)
+											U32 lightFace, U32 drawcallCount, U32 hierarchy,
+											Array<U32, 4>& tileViewport)
 {
 {
 	// Preconditions
 	// Preconditions
 	ANKI_ASSERT(crntTimestamp > 0);
 	ANKI_ASSERT(crntTimestamp > 0);
@@ -226,7 +230,7 @@ TileAllocatorResult TileAllocator::allocate(Timestamp crntTimestamp, Timestamp l
 	ANKI_ASSERT(lightTimestamp <= crntTimestamp);
 	ANKI_ASSERT(lightTimestamp <= crntTimestamp);
 	ANKI_ASSERT(lightUuid != 0);
 	ANKI_ASSERT(lightUuid != 0);
 	ANKI_ASSERT(lightFace < 6);
 	ANKI_ASSERT(lightFace < 6);
-	ANKI_ASSERT(lod < m_lodCount);
+	ANKI_ASSERT(hierarchy < m_hierarchyCount);
 
 
 	// 1) Search if it's already cached
 	// 1) Search if it's already cached
 	HashMapKey key;
 	HashMapKey key;
@@ -239,19 +243,20 @@ TileAllocatorResult TileAllocator::allocate(Timestamp crntTimestamp, Timestamp l
 		{
 		{
 			Tile& tile = m_allTiles[*it];
 			Tile& tile = m_allTiles[*it];
 
 
-			if(tile.m_lightUuid != lightUuid || tile.m_lightLod != lod || tile.m_lightFace != lightFace)
+			if(tile.m_lightUuid != lightUuid || tile.m_lightHierarchy != hierarchy || tile.m_lightFace != lightFace)
 			{
 			{
 				// Cache entry is wrong, remove it
 				// Cache entry is wrong, remove it
 				m_lightInfoToTileIdx.erase(*m_pool, it);
 				m_lightInfoToTileIdx.erase(*m_pool, it);
 			}
 			}
 			else
 			else
 			{
 			{
-				// Same light & lod & face, found the cache entry.
+				// Same light & hierarchy & face, found the cache entry.
 
 
 				ANKI_ASSERT(tile.m_lastUsedTimestamp != crntTimestamp
 				ANKI_ASSERT(tile.m_lastUsedTimestamp != crntTimestamp
 							&& "Trying to allocate the same thing twice in this timestamp?");
 							&& "Trying to allocate the same thing twice in this timestamp?");
 
 
-				ANKI_ASSERT(tile.m_lightUuid == lightUuid && tile.m_lightLod == lod && tile.m_lightFace == lightFace);
+				ANKI_ASSERT(tile.m_lightUuid == lightUuid && tile.m_lightHierarchy == hierarchy
+							&& tile.m_lightFace == lightFace);
 
 
 				tileViewport = {tile.m_viewport[0], tile.m_viewport[1], tile.m_viewport[2], tile.m_viewport[3]};
 				tileViewport = {tile.m_viewport[0], tile.m_viewport[1], tile.m_viewport[2], tile.m_viewport[3]};
 
 
@@ -274,12 +279,13 @@ TileAllocatorResult TileAllocator::allocate(Timestamp crntTimestamp, Timestamp l
 	U32 emptyTileIdx = kMaxU32;
 	U32 emptyTileIdx = kMaxU32;
 	U32 toKickTileIdx = kMaxU32;
 	U32 toKickTileIdx = kMaxU32;
 	Timestamp tileToKickMinTimestamp = kMaxTimestamp;
 	Timestamp tileToKickMinTimestamp = kMaxTimestamp;
-	const U32 maxLod = m_lodCount - 1;
-	if(lod == maxLod)
+	const U32 maxHierarchy = m_hierarchyCount - 1;
+	if(hierarchy == maxHierarchy)
 	{
 	{
-		// This search is simple, iterate the tiles of the max LOD
+		// This search is simple, iterate the tiles of the max hierarchy
 
 
-		for(U32 tileIdx = m_lodFirstTileIndex[maxLod]; tileIdx <= m_lodFirstTileIndex[maxLod + 1]; ++tileIdx)
+		for(U32 tileIdx = m_firstTileIdxOfHierarchy[maxHierarchy];
+			tileIdx <= m_firstTileIdxOfHierarchy[maxHierarchy + 1]; ++tileIdx)
 		{
 		{
 			const Bool done =
 			const Bool done =
 				evaluateCandidate(tileIdx, crntTimestamp, emptyTileIdx, toKickTileIdx, tileToKickMinTimestamp);
 				evaluateCandidate(tileIdx, crntTimestamp, emptyTileIdx, toKickTileIdx, tileToKickMinTimestamp);
@@ -294,10 +300,11 @@ TileAllocatorResult TileAllocator::allocate(Timestamp crntTimestamp, Timestamp l
 	{
 	{
 		// Need to do a recursive search
 		// Need to do a recursive search
 
 
-		for(U32 tileIdx = m_lodFirstTileIndex[maxLod]; tileIdx <= m_lodFirstTileIndex[maxLod + 1]; ++tileIdx)
+		for(U32 tileIdx = m_firstTileIdxOfHierarchy[maxHierarchy];
+			tileIdx <= m_firstTileIdxOfHierarchy[maxHierarchy + 1]; ++tileIdx)
 		{
 		{
-			const Bool done = searchTileRecursively(tileIdx, maxLod, lod, crntTimestamp, emptyTileIdx, toKickTileIdx,
-													tileToKickMinTimestamp);
+			const Bool done = searchTileRecursively(tileIdx, maxHierarchy, hierarchy, crntTimestamp, emptyTileIdx,
+													toKickTileIdx, tileToKickMinTimestamp);
 
 
 			if(done)
 			if(done)
 			{
 			{
@@ -329,7 +336,7 @@ TileAllocatorResult TileAllocator::allocate(Timestamp crntTimestamp, Timestamp l
 	allocatedTile.m_lastUsedTimestamp = crntTimestamp;
 	allocatedTile.m_lastUsedTimestamp = crntTimestamp;
 	allocatedTile.m_lightUuid = lightUuid;
 	allocatedTile.m_lightUuid = lightUuid;
 	allocatedTile.m_lightDrawcallCount = drawcallCount;
 	allocatedTile.m_lightDrawcallCount = drawcallCount;
-	allocatedTile.m_lightLod = U8(lod);
+	allocatedTile.m_lightHierarchy = U8(hierarchy);
 	allocatedTile.m_lightFace = U8(lightFace);
 	allocatedTile.m_lightFace = U8(lightFace);
 
 
 	updateTileHierarchy(allocatedTile);
 	updateTileHierarchy(allocatedTile);

+ 12 - 10
AnKi/Renderer/TileAllocator.h

@@ -33,11 +33,13 @@ public:
 	TileAllocator& operator=(const TileAllocator&) = delete; // Non-copyable
 	TileAllocator& operator=(const TileAllocator&) = delete; // Non-copyable
 
 
 	/// Initialize the allocator.
 	/// Initialize the allocator.
-	void init(HeapMemoryPool* pool, U32 tileCountX, U32 tileCountY, U32 lodCount, Bool enableCaching);
+	void init(HeapMemoryPool* pool, U32 tileCountX, U32 tileCountY, U32 hierarchyCount, Bool enableCaching);
 
 
 	/// Allocate some tiles.
 	/// Allocate some tiles.
+	/// @param hierarchy If it's 0 it chooses the smallest tile.
 	[[nodiscard]] TileAllocatorResult allocate(Timestamp crntTimestamp, Timestamp lightTimestamp, U64 lightUuid,
 	[[nodiscard]] TileAllocatorResult allocate(Timestamp crntTimestamp, Timestamp lightTimestamp, U64 lightUuid,
-											   U32 lightFace, U32 drawcallCount, U32 lod, Array<U32, 4>& tileViewport);
+											   U32 lightFace, U32 drawcallCount, U32 hierarchy,
+											   Array<U32, 4>& tileViewport);
 
 
 	/// Remove an light from the cache.
 	/// Remove an light from the cache.
 	void invalidateCache(U64 lightUuid, U32 lightFace);
 	void invalidateCache(U64 lightUuid, U32 lightFace);
@@ -50,19 +52,19 @@ private:
 
 
 	HeapMemoryPool* m_pool = nullptr;
 	HeapMemoryPool* m_pool = nullptr;
 	DynamicArray<Tile> m_allTiles;
 	DynamicArray<Tile> m_allTiles;
-	DynamicArray<U32> m_lodFirstTileIndex;
+	DynamicArray<U32> m_firstTileIdxOfHierarchy;
 
 
 	HashMap<HashMapKey, U32> m_lightInfoToTileIdx;
 	HashMap<HashMapKey, U32> m_lightInfoToTileIdx;
 
 
-	U16 m_tileCountX = 0; ///< Tile count for LOD 0
-	U16 m_tileCountY = 0; ///< Tile count for LOD 0
-	U8 m_lodCount = 0;
+	U16 m_tileCountX = 0; ///< Tile count for hierarchy 0
+	U16 m_tileCountY = 0; ///< Tile count for hierarchy 0
+	U8 m_hierarchyCount = 0;
 	Bool m_cachingEnabled = false;
 	Bool m_cachingEnabled = false;
 
 
-	U32 translateTileIdx(U32 x, U32 y, U32 lod) const
+	U32 translateTileIdx(U32 x, U32 y, U32 hierarchy) const
 	{
 	{
-		const U32 lodWidth = m_tileCountX >> lod;
-		const U32 idx = y * lodWidth + x + m_lodFirstTileIndex[lod];
+		const U32 hierarchyWidth = m_tileCountX >> hierarchy;
+		const U32 idx = y * hierarchyWidth + x + m_firstTileIdxOfHierarchy[hierarchy];
 		ANKI_ASSERT(idx < m_allTiles.getSize());
 		ANKI_ASSERT(idx < m_allTiles.getSize());
 		return idx;
 		return idx;
 	}
 	}
@@ -79,7 +81,7 @@ private:
 	}
 	}
 
 
 	/// Search for a tile recursively.
 	/// Search for a tile recursively.
-	Bool searchTileRecursively(U32 crntTileIdx, U32 crntTileLod, U32 allocationLod, Timestamp crntTimestamp,
+	Bool searchTileRecursively(U32 crntTileIdx, U32 crntTileHierarchy, U32 allocationHierarchy, Timestamp crntTimestamp,
 							   U32& emptyTileIdx, U32& toKickTileIdx, Timestamp& tileToKickMinTimestamp) const;
 							   U32& emptyTileIdx, U32& toKickTileIdx, Timestamp& tileToKickMinTimestamp) const;
 
 
 	Bool evaluateCandidate(U32 tileIdx, Timestamp crntTimestamp, U32& emptyTileIdx, U32& toKickTileIdx,
 	Bool evaluateCandidate(U32 tileIdx, Timestamp crntTimestamp, U32& emptyTileIdx, U32& toKickTileIdx,

+ 1 - 0
AnKi/Scene/CameraNode.cpp

@@ -65,6 +65,7 @@ void CameraNode::initCommon(FrustumType frustumType)
 	frc->setLodDistance(0, getConfig().getLod0MaxDistance());
 	frc->setLodDistance(0, getConfig().getLod0MaxDistance());
 	frc->setLodDistance(1, getConfig().getLod1MaxDistance());
 	frc->setLodDistance(1, getConfig().getLod1MaxDistance());
 	frc->setShadowCascadeCount(getConfig().getSceneShadowCascadeCount());
 	frc->setShadowCascadeCount(getConfig().getSceneShadowCascadeCount());
+	frc->setEffectiveShadowDistance(getConfig().getSceneShadowEffectiveDistance());
 
 
 	// Extended frustum for RT
 	// Extended frustum for RT
 	if(getSceneGraph().getGrManager().getDeviceCapabilities().m_rayTracingEnabled
 	if(getSceneGraph().getGrManager().getDeviceCapabilities().m_rayTracingEnabled

+ 1 - 2
AnKi/Scene/Components/FrustumComponent.h

@@ -321,8 +321,7 @@ public:
 	F32 getEffectiveShadowDistance() const
 	F32 getEffectiveShadowDistance() const
 	{
 	{
 		const F32 distance = (m_effectiveShadowDistance <= 0.0f) ? m_common.m_far : m_effectiveShadowDistance;
 		const F32 distance = (m_effectiveShadowDistance <= 0.0f) ? m_common.m_far : m_effectiveShadowDistance;
-		ANKI_ASSERT(distance > m_common.m_near && distance <= m_common.m_far);
-		return distance;
+		return clamp(m_common.m_near, m_common.m_far, distance);
 	}
 	}
 
 
 	/// See computeShadowCascadeDistance()
 	/// See computeShadowCascadeDistance()

+ 3 - 1
AnKi/Scene/ConfigVars.defs.h

@@ -7,8 +7,10 @@ ANKI_CONFIG_VAR_GROUP(SCENE)
 
 
 ANKI_CONFIG_VAR_F32(Lod0MaxDistance, 20.0f, 1.0f, kMaxF32, "Distance that will be used to calculate the LOD 0")
 ANKI_CONFIG_VAR_F32(Lod0MaxDistance, 20.0f, 1.0f, kMaxF32, "Distance that will be used to calculate the LOD 0")
 ANKI_CONFIG_VAR_F32(Lod1MaxDistance, 40.0f, 2.0f, kMaxF32, "Distance that will be used to calculate the LOD 1")
 ANKI_CONFIG_VAR_F32(Lod1MaxDistance, 40.0f, 2.0f, kMaxF32, "Distance that will be used to calculate the LOD 1")
-ANKI_CONFIG_VAR_U8(SceneShadowCascadeCount, (ANKI_OS_ANDROID) ? 2 : kMaxShadowCascades, 1, kMaxShadowCascades,
+ANKI_CONFIG_VAR_U8(SceneShadowCascadeCount, (ANKI_PLATFORM_MOBILE) ? 2 : kMaxShadowCascades, 1, kMaxShadowCascades,
 				   "Max number of shadow cascades for directional lights")
 				   "Max number of shadow cascades for directional lights")
+ANKI_CONFIG_VAR_F32(SceneShadowEffectiveDistance, (ANKI_PLATFORM_MOBILE) ? 80.0f : 200.0f, 10.0f, 2000.0f,
+					"The distance where shadows are calculated")
 
 
 ANKI_CONFIG_VAR_U32(SceneOctreeMaxDepth, 5, 2, 10, "The max depth of the octree")
 ANKI_CONFIG_VAR_U32(SceneOctreeMaxDepth, 5, 2, 10, "The max depth of the octree")
 ANKI_CONFIG_VAR_F32(SceneEarlyZDistance, (ANKI_PLATFORM_MOBILE) ? 0.0f : 10.0f, 0.0f, kMaxF32,
 ANKI_CONFIG_VAR_F32(SceneEarlyZDistance, (ANKI_PLATFORM_MOBILE) ? 0.0f : 10.0f, 0.0f, kMaxF32,

+ 8 - 13
AnKi/Shaders/ShadowmapsResolve.glsl

@@ -85,18 +85,8 @@ void main()
 				dirLight.m_cascadeCount, cascadeBlendFactor);
 				dirLight.m_cascadeCount, cascadeBlendFactor);
 
 
 #if PCF
 #if PCF
-			F32 shadowFactorCascadeA;
-			if(cascadeIndices.x == 0u)
-			{
-				const ANKI_RP F32 rand = noise.x;
-				shadowFactorCascadeA = computeShadowFactorDirLightPcf(
-					dirLight, cascadeIndices.x, worldPos, u_shadowAtlasTex, u_linearAnyClampShadowSampler, rand);
-			}
-			else
-			{
-				shadowFactorCascadeA = computeShadowFactorDirLight(dirLight, cascadeIndices.x, worldPos,
-																   u_shadowAtlasTex, u_linearAnyClampShadowSampler);
-			}
+			const F32 shadowFactorCascadeA = computeShadowFactorDirLightPcf(
+				dirLight, cascadeIndices.x, worldPos, u_shadowAtlasTex, u_linearAnyClampShadowSampler, randFactor);
 #else
 #else
 			const F32 shadowFactorCascadeA = computeShadowFactorDirLight(
 			const F32 shadowFactorCascadeA = computeShadowFactorDirLight(
 				dirLight, cascadeIndices.x, worldPos, u_shadowAtlasTex, u_linearAnyClampShadowSampler);
 				dirLight, cascadeIndices.x, worldPos, u_shadowAtlasTex, u_linearAnyClampShadowSampler);
@@ -109,10 +99,15 @@ void main()
 			}
 			}
 			else
 			else
 			{
 			{
+#if PCF
+				// Blend cascades
+				const F32 shadowFactorCascadeB = computeShadowFactorDirLightPcf(
+					dirLight, cascadeIndices.y, worldPos, u_shadowAtlasTex, u_linearAnyClampShadowSampler, randFactor);
+#else
 				// Blend cascades
 				// Blend cascades
 				const F32 shadowFactorCascadeB = computeShadowFactorDirLight(
 				const F32 shadowFactorCascadeB = computeShadowFactorDirLight(
 					dirLight, cascadeIndices.y, worldPos, u_shadowAtlasTex, u_linearAnyClampShadowSampler);
 					dirLight, cascadeIndices.y, worldPos, u_shadowAtlasTex, u_linearAnyClampShadowSampler);
-
+#endif
 				shadowFactor = mix(shadowFactorCascadeA, shadowFactorCascadeB, cascadeBlendFactor);
 				shadowFactor = mix(shadowFactorCascadeA, shadowFactorCascadeB, cascadeBlendFactor);
 			}
 			}