敲击将输出归一化后给铁块材质用,可以累积锤击量,并且除了接缝之外的其他地方,变形正确,但是现在的面数精度还不够,0.2mm太糙了
This commit is contained in:
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
@@ -107,7 +107,7 @@ UTextureRenderTarget2D* AIronBlock::CreateDeformRT(const FString& RTName, int32
|
|||||||
if (RenderTarget)
|
if (RenderTarget)
|
||||||
{
|
{
|
||||||
// **关键修复 1:** 设置为32位浮点数格式,以匹配 FLinearColor 和 CS 的 PF_A32B32G32R32F
|
// **关键修复 1:** 设置为32位浮点数格式,以匹配 FLinearColor 和 CS 的 PF_A32B32G32R32F
|
||||||
RenderTarget->RenderTargetFormat = RTF_RGBA32f;
|
//RenderTarget->RenderTargetFormat = RTF_RGBA32f;
|
||||||
|
|
||||||
// **关键修复 2:** 明确告诉引擎我们需要为这个纹理创建UAV
|
// **关键修复 2:** 明确告诉引擎我们需要为这个纹理创建UAV
|
||||||
//RenderTarget->bCanCreateUAV = true;
|
//RenderTarget->bCanCreateUAV = true;
|
||||||
@@ -119,17 +119,21 @@ UTextureRenderTarget2D* AIronBlock::CreateDeformRT(const FString& RTName, int32
|
|||||||
RenderTarget->bAutoGenerateMips = false;
|
RenderTarget->bAutoGenerateMips = false;
|
||||||
RenderTarget->AddressX = TA_Clamp;
|
RenderTarget->AddressX = TA_Clamp;
|
||||||
RenderTarget->AddressY = 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)
|
// 定义你要清除的颜色 (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 的清除函数
|
// 调用 Kismet Rendering Library 的清除函数
|
||||||
UKismetRenderingLibrary::ClearRenderTarget2D(
|
UKismetRenderingLibrary::ClearRenderTarget2D(
|
||||||
this->GetWorld(), // 通常传入你的 World 或 Actor
|
this->GetWorld(), // 通常传入你的 World 或 Actor
|
||||||
RenderTarget,
|
RenderTarget,
|
||||||
ClearColor
|
ClearColor
|
||||||
);
|
);
|
||||||
// 立即创建RHI资源
|
FlushRenderingCommands();
|
||||||
//RenderTarget->UpdateResource();
|
RenderTarget->UpdateResourceImmediate(true);
|
||||||
}
|
}
|
||||||
return RenderTarget;
|
return RenderTarget;
|
||||||
}
|
}
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user