敲击将输出归一化后给铁块材质用,可以累积锤击量,并且除了接缝之外的其他地方,变形正确,但是现在的面数精度还不够,0.2mm太糙了

This commit is contained in:
zhangqing
2025-11-14 22:31:04 +08:00
parent 2bcbd01c78
commit a358e46a59
8 changed files with 9 additions and 5 deletions
Binary file not shown.
Binary file not shown.
+9 -5
View File
@@ -107,7 +107,7 @@ UTextureRenderTarget2D* AIronBlock::CreateDeformRT(const FString& RTName, int32
if (RenderTarget)
{
// **关键修复 1:** 设置为32位浮点数格式,以匹配 FLinearColor 和 CS 的 PF_A32B32G32R32F
RenderTarget->RenderTargetFormat = RTF_RGBA32f;
//RenderTarget->RenderTargetFormat = RTF_RGBA32f;
// **关键修复 2:** 明确告诉引擎我们需要为这个纹理创建UAV
//RenderTarget->bCanCreateUAV = true;
@@ -119,17 +119,21 @@ UTextureRenderTarget2D* AIronBlock::CreateDeformRT(const FString& RTName, int32
RenderTarget->bAutoGenerateMips = false;
RenderTarget->AddressX = TA_Clamp;
RenderTarget->AddressY = TA_Clamp;
FLinearColor ClearColor = FLinearColor(0.25f, 0.25f, 0.25f, 1.0f);
RenderTarget->ClearColor = ClearColor;
// 立即创建RHI资源
RenderTarget->UpdateResource();
// 定义你要清除的颜色 (R=0.5, G=0.5, B=0.5)
const FLinearColor ClearColor(0.5, 0.5, 0.5, 1);
//FLinearColor ClearColor = FLinearColor(0.25f, 0.25f, 0.25f, 1.0f);
// 调用 Kismet Rendering Library 的清除函数
UKismetRenderingLibrary::ClearRenderTarget2D(
this->GetWorld(), // 通常传入你的 World 或 Actor
RenderTarget,
ClearColor
);
// 立即创建RHI资源
//RenderTarget->UpdateResource();
FlushRenderingCommands();
RenderTarget->UpdateResourceImmediate(true);
}
return RenderTarget;
}
Binary file not shown.
Binary file not shown.