Files
nexus/wiki/concepts/MaterialFunction.md
2026-04-26 12:02:53 +08:00

29 lines
1.3 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: "MaterialFunction"
type: concept
tags: ["unreal-engine", "materials", "shader"]
sources: ["unreal-technical-artist"]
last_updated: 2026-04-26
---
## Definition
UE5 Material Editor 中可封装、可复用的节点逻辑单元。封装一组节点图作为黑盒函数,供多个 Master Material 引用。
## Purpose
消除跨 Master Material 的重复节点簇,确保同一逻辑只需维护一处。
## Usage in This Wiki
- [[unreal-technical-artist]] 强制规定:所有可复用逻辑必须封装为 Material Function禁止在多个 Master Material 间重复节点簇
- 示例MF_TriplanarMapping三平面映射封装 WorldPosition 投影逻辑,可在任意岩石、悬崖、地形混合材质中使用
## Key Principles
- 单一职责:一个 Function 只做一件事(三平面映射 / 噪声叠加 / 顶点偏移等)
- 输入输出清晰:所有可调参数通过 Input 节点暴露
- 禁止副作用Function 内部不应修改外部状态
- 避免 Static Switch 嵌套:每个 Static Switch 使引用该 Function 的材质排列数翻倍
## Related
- [[MaterialEditor]] — Material Function 的创作环境
- [[QualitySwitch]] — 同一材质内的质量分层机制
- [[NiagaraVFX]] — VFX 系统,类似 Function 的模块化复用理念