Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 18 additions & 14 deletions Shaders/Private/LiquidShaderFillCS.usf
Original file line number Diff line number Diff line change
Expand Up @@ -36,25 +36,29 @@ void MainCS(uint3 ThreadId : SV_DispatchThreadID)

if(CheckHittedNormal(RefTexture[ThreadId.xy].xyz) && !CheckIfHitNormal(uint2(ThreadIdX + 1, ThreadId.y)))
{
uint2 PixelTemp[2048];
for (int i = 1; i < RTargetSize - ThreadIdX; i++)
bool bClear = true;

for (int i = 1; i <= RTargetSize - ThreadIdX - 1; i++)
{
uint2 PixelPosition = uint2(ThreadIdX + i, ThreadId.y);
const uint2 PixelPosition = uint2(ThreadIdX + i, ThreadId.y);

PixelTemp[i - 1] = PixelPosition;
if( i == RTargetSize - ThreadIdX - 1)
if (CheckIfHitNormal(PixelPosition))
{
for(int j = 0; j <= i - 1; j++)
{
OutputTexture[PixelTemp[j]] = float4(0,0,0,0);
}
bClear = false;
break;
}

if(CheckIfHitNormal(PixelPosition))
break;

OutputTexture[PixelPosition] = float4(1,1,1,1);

OutputTexture[PixelPosition] = float4(1, 1, 1, 1);
}

if (bClear)
{
for (int i = 1; i <= RTargetSize - ThreadIdX - 1; i++)
{
const uint2 PixelPosition = uint2(ThreadIdX + i, ThreadId.y);

OutputTexture[PixelPosition] = float4(0, 0, 0, 0);
}
}
}
}
Expand Down
4 changes: 3 additions & 1 deletion Source/UTC_LiquidShader/Private/LiquidShaderComponent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -478,7 +478,8 @@ void ULiquidShaderComponent::ComputeLiquidVolume(float DeltaTime, bool bInitiali
FHitResult LOutHit;
FCollisionQueryParams CollisionParams;
CollisionParams.bTraceComplex = true;

CollisionParams.bReturnFaceIndex = true;

TArray<FVector2d> VoxelLayers;
float MaxLocalBound = SMLiquidOwner->GetBoundingBox().Max.Z * SMComponent->GetComponentScale().Z;
float MinLocalBound = SMLiquidOwner->GetBoundingBox().Min.Z * SMComponent->GetComponentScale().Z;
Expand Down Expand Up @@ -529,6 +530,7 @@ void ULiquidShaderComponent::ComputeLiquidVolume(float DeltaTime, bool bInitiali
else if (bHit)
{
XIndex += ROutHit.Distance / VoxelSize;
RVectorTrace = false;
}
else
{
Expand Down