Files
BlueRoseNote/03-UnrealEngine/卡通渲染相关资料/渲染功能/ARC/Rendering/局部位置缩放.md

55 lines
1.4 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
---
title: 局部位置缩放
date: 2026-05-03 00:00:00
excerpt: 逐材质局部空间顶点缩放
tags:
- ARC
- Rendering
- VertexFactory
rating: ⭐
---
# 局部位置缩放
返回 [[Rendering]]
## 概述
允许通过材质图在局部空间Local Space对顶点位置进行缩放实现不依赖 Actor Transform 的比例调整。
## 实现
在各 VertexFactory 中通过 `VertexFactoryUpdateLocalPositionScale` 函数实现:
```hlsl
void VertexFactoryUpdateLocalPositionScale(
inout FVertexFactoryInput Input,
inout FVertexFactoryIntermediates Intermediates,
float3 scale)
{
Input.Position.xyz *= scale;
}
```
`USES_LOCAL_POSITION_SCALE` 宏控制启用,在世界变换之前应用。
## 使用场景
- 角色部件的动态缩放(如拳头放大的夸张动画效果)
- 不同 LOD 级别的微调
- 格斗游戏中攻击判定与视觉表现分离时的视觉调整
## 材质属性
`MP_LocalPositionScale`float3通过材质图控制。参见 [[自定义材质属性]]。
## 修改文件列表
| 文件 | 修改类型 |
|------|---------|
| `Shaders/Private/LocalVertexFactory.ush` | 新增缩放函数 |
| `Shaders/Private/GpuSkinVertexFactory.ush` | 同上 |
| `Shaders/Private/LandscapeVertexFactory.ush` | 同上 |
| `Shaders/Private/MeshParticleVertexFactory.ush` | 同上 |
| 所有 Particle VertexFactory | 同上 |