Add **Sample Global SDF** node to particles

This commit is contained in:
Wojciech Figat
2022-03-25 11:41:17 +01:00
parent f8670a497e
commit 4a18185e81
5 changed files with 18 additions and 3 deletions

View File

@@ -216,7 +216,7 @@ void GlobalSignDistanceFieldPass::Dispose()
bool GlobalSignDistanceFieldPass::Get(const RenderBuffers* buffers, BindingData& result)
{
auto* sdfData = buffers ? buffers->FindCustomBuffer<GlobalSignDistanceFieldCustomBuffer>(TEXT("GlobalSignDistanceField")) : nullptr;
if (sdfData && sdfData->LastFrameUsed == Engine::FrameCount)
if (sdfData && sdfData->LastFrameUsed + 1 >= Engine::FrameCount) // Allow to use SDF from the previous frame (eg. particles in Editor using the Editor viewport in Game viewport - Game render task runs first)
{
result = sdfData->Result;
return false;