Files
UnrealEngineUWP/Engine/Shaders/Private/ScreenSpaceReflectionTileCommons.ush
tiantian xie 90ae4f9bec Add tile support to default SSR without clear.
1. Use `r.SSR.TiledComposite 1` to enable tiled SSR (Default off).
2. Use `r.SSR.TiledComposite.Visualize 1` to visualize the current tiled SSR when SSR is enabled.
3. Add MinSpecular(0.01f) and MaxRoughness(0.3f) to cull tiles.

#rb sebastien.hillaire, jeremy.moore

[CL 29293956 by tiantian xie in ue5-main branch]
2023-10-31 18:02:03 -04:00

24 lines
843 B
Plaintext

// Copyright Epic Games, Inc. All Rights Reserved.
/*================================================================================================
ScreenSpaceReflectionTileCommons.ush:
=================================================================================================*/
#pragma once
#ifndef SSR_TILE_SIZE_XY
#define SSR_TILE_SIZE_XY (8U)
#endif
//#if SSR_TILE_SIZE_XY != 8U
// #error SSR_TILE_SIZE_XY is currently designed to be 8U.
//#endif
bool IsSSRTileUsed(uint2 PixelPos, uint2 InSSRTiledViewRes, StructuredBuffer<uint> InSSRTileMaskBuffer)
{
uint2 SSRTileIndex = PixelPos / SSR_TILE_SIZE_XY;
uint MaskLinearIndex = InSSRTiledViewRes.x * SSRTileIndex.y + SSRTileIndex.x;
uint Mask = 1u << (MaskLinearIndex % 32u);
bool bTileUsed = (InSSRTileMaskBuffer[MaskLinearIndex / 32u] & Mask) != 0;
return bTileUsed;
}