title: ue4-材质编辑器material
categories: UnrealEngine4
tags: [ue4, 材质, material]
date: 2019-04-21 23:00:50
comments: false
ue4-材质编辑器material. 类似于 unity 的 shaderlab, unity 中是以 文本 的方式写 shader, 而 ue4 是以 可视化 方式写shader, 两者写完都要进行编译后才能看到效果. 同时 ue4 还支持编写 hlsl. 可以参照下面的 [unity 与 ue4 的 material, shader 对比](#unity 与 ue4 的 material, shader 对比)
替换预览模型
选中模型mesh资源 (可以是 场景内 或 Content中 的) , 再点击材质编辑器预览中的 茶壶
也可以 选中 模型 资源, 点击这里替换预览模型
快速创建贴图节点
快速创建贴图节点: 选中 贴图 资源, 然后在材质编辑器中, 按住 T 键再点击 鼠标左键
给贴图节点替换贴图:
最简单粗暴的还是直接把 贴图 拖进去
Physics Material
- Physics Material in Unreal Engine 4 - https://www.youtube.com/watch?v=YEyqewn409E
可以摩擦力等物理系数, 来达到真实的效果
material 和 material instance 区别
参考:
- Instanced Materials - https://docs.unrealengine.com/en-us/Engine/Rendering/Materials/MaterialInstances
- A Material Instance in Unreal Engine 4 - https://www.youtube.com/watch?v=qus9WjHX4_4
简单的说
- material 是可编辑逻辑的且需要编译的,
- material instance 是在 material 的基础上实例化出来的, 是不可编辑逻辑的且不需要编译的, 只能编辑 material 暴露出来的参数
unity 与 ue4 的 material, shader 对比
unity 中写的 shader (xxx.shader) 等价于 ue4 中 material, 都是需要 写逻辑 和 编译 .
unity 中的 material (xxx.mat) 等价于 ue4 中的 material instance, 都不需要 写逻辑 和 编译, 只将 unity xxx.shader中 和 ue4 material 的需要控制的参数暴露出来 (也就是 gl 中 uniform 变量) 形成一个 材质, 交给程序控制或编辑中调整.
多维材质
需要在 max 等建模软件中指定多个材质id, 就可以在 ue4 中赋予多个材质球