查看: 799|回复: 11

[示例和教学] 【SciFi Bunk: Material Instancing | Unreal Engine】

[复制链接]

1

主题

342

帖子

7万

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
75866
发表于 2016-6-27 17:25:18 | 显示全部楼层 |阅读模式


本页面的内容:

      
Foreword

Overview

Goals

Master Material Setup
Albedo Setup
Metallic Setup
Roughness Setup
Occlusion Setup
Emissive Setup
Normal Setup
Parallax Setup

Material Instancing

Application to Meshes

Extra Features
     Foreword
This tutorial was provided by community member Liam Tart (PogoP), and is published here with permission.

Thank you, Liam!
Overview
This tutorial will explain how master materials and material instancing can be used to quickly and efficiently build a set of tileable materials that can be applied to meshes in your scene. By texturing your meshes using tileable materials, you do not have to rely on baking from a high poly model and you can rapidly change the look and feel of your environment.

This tutorial has been written alongside the production of the Sci-fi Bunk Room scene on the Unreal Launcher Learn tab, so it is recommended to download that in order to show this use of material instancing in practice.

This tutorial will show you how to set up an efficient master material that can be instanced to make a variety of different material types, such as various metals and plastics, which can then be applied to different material IDs on your mesh. This master material will also use a number of switches to enable you to turn specific functions on/off depending on the material in question, such as parallax and detail normal maps.

Before starting this tutorial, it is recommend you read the 材质 docs to get a basic understanding of how materials and material instancing work. This tutorial will show how to apply these concepts to a working environment.
Goals
The end goal of setting up this master material is to create a material that can be instanced and give access to a number of parameters that will allow us to tweak our materials quickly. You can put whatever options and features you like into your master material, but as a base, it is useful to allow the option to input specific albedo, roughness, metallic, and normal maps, and also have fine control over these features by adding in an albedo tint, and a roughness and metallic value.

The screenshot below shows just how much flexibility this will give your environments, allowing you to quickly change the way your scene looks by tweaking a few values.

<img alt="image_0.jpg[/img] src="./images/Resources/Community/SciFiBunk_MaterialInstancing/image_0.jpg[/img]

Master Material Setup
We will start by creating your master material. This is what all of the materials in your scene will be instanced from, so it needs to be set up correctly and efficiently as it likely get quite complex. One advantage to using a master material is that if you want to add more features to your materials later on, you need only apply it to the master material and it will propagate down to the instances.

Here is an example showing the final master material setup. All of the input textures and constants in this material are parameterized to allow access in the instanced material. To do this, you can right click on the value or map and click Convert to parameter, and then you can assign it a name. This will allow you to change it quickly in the material instance.

Also, the Static Switch parameter is extensively used in this material, which allows you to choose between using certain setups such as detail normal maps, parallax etc. This will make your final material instance cheaper as you are able to switch off un-needed features. More about this can be read here: Parameter Expressions

<img alt="image_1.jpg[/img] src="./images/Resources/Community/SciFiBunk_MaterialInstancing/image_1.jpg[/img]


Albedo Setup
<img alt="image_2.jpg[/img] src="./images/Resources/Community/SciFiBunk_MaterialInstancing/image_2.jpg[/img]


In this section, you want to be able to choose between using a specific albedo map or a simple color value, which will allow you to rapidly prototype materials by specifying a simple value to get the correct albedo. You can then bring that value through to Photoshop as a base for your final albedo map. This will also apply to the Roughness Setup section of this tutorial.

As stated previously, this setup allows you to choose between using an albedo map or a color value for your base color. You choose between the two by using the static switch parameter called UseDiffuseMap in your instanced material. If this is set to true, you can then use the input a specific albedo texture, and this is multiplied with a DiffTint constant value which allows you to tint the color of the specified albedo map. If you do not use an albedo map, you can define the albedo value using DiffuseValue.

To the left of the DiffMap texture input, you can see that a node has been plugged into the UV slot. This connects to the Parallax part of the master material. You could add a UV tiling setup into this as well, which would allow you to control the tiling of your material in UE4 rather than in your 3d modeling package.

The following example shows the flexibility of this system. On the left, the material is using a single color for the albedo map. In the middle, it is using just an albedo map. On the right, it is using an albedo map that has been tinted orange. This shows how you can use the same maps to get a lot of variety in the engine.

<img alt="image_3.jpg[/img] src="./images/Resources/Community/SciFiBunk_MaterialInstancing/image_3.jpg[/img]


Metallic Setup
<img alt="image_4.jpg[/img] src="./images/Resources/Community/SciFiBunk_MaterialInstancing/image_4.jpg[/img]


This is very simple and lets you choose between using a metallic map or a single value to define your materials' metallic properties.

This is useful because it allows you to choose between using a single value, which would be good for a tiling metal material for example, but also gives you the option to specify a metallic map if you want certain parts of your material to be non-metal whilst others are metallic.

The following example shows this in action. The material on the left uses a metallic value of 0, the middle a value of 1, and the one on the right uses a specific metallic map.

<img alt="image_5.jpg[/img] src="./images/Resources/Community/SciFiBunk_MaterialInstancing/image_5.jpg[/img]


Roughness Setup
<img alt="image_6.jpg[/img] src="./images/Resources/Community/SciFiBunk_MaterialInstancing/image_6.jpg[/img]


Similar to the albedo setup, this allows you to choose between using a roughness map or a single value to define your overall roughness. This is great for quickly assigning roughness values to materials and then later taking this value through to Photoshop to create a unique roughness map for your material.

The following example shows this working. The material on the left uses a roughness value of 1, the middle uses a roughness value of 0, and the one on the right uses a specific roughness map.

<img alt="image_7.jpg[/img] src="./images/Resources/Community/SciFiBunk_MaterialInstancing/image_7.jpg[/img]


The UseDetailRoughness static switch lets you use a detail roughness map which is plugged into the DetailTiling constant which is multiplied with a TexCoord, to allow you to tile your detail roughness map. This value also plugs into the detail normal map. This is useful for materials that require a texture that can only be viewed up close and can have a very high tiling rate.

The following example shows this in action. The material on the left does not use a detail roughness/normal map, the one in the middle uses a detail map with a tiling rate of 1, and the one on the right uses a tiling rate of 4.

<img alt="image_75.jpg[/img] src="./images/Resources/Community/SciFiBunk_MaterialInstancing/image_75.jpg[/img]


Occlusion Setup
<img alt="image_8.jpg[/img] src="./images/Resources/Community/SciFiBunk_MaterialInstancing/image_8.jpg[/img]


This setup uses a static switch parameter to choose between using an occlusion map or a single value. Most materials will use an occlusion value of 1 which is a simple white color, however this gives you the option to use a specific ambient occlusion map if your material requires it, for example if this material is for a uniquely unwrapped model that has darker areas where light may not reach.

Emissive Setup
<img alt="image_9.jpg[/img] src="./images/Resources/Community/SciFiBunk_MaterialInstancing/image_9.jpg[/img]


This setup lets you choose between using an emissive on your material or not (by default it is set to false to increase performance). There is also another static switch used which lets you choose to specify a specific emissive map. If you choose to not use a specific emissive map, you can use the EmissiveScale parameter to set your emissive value. However, this EmissiveScale parameter will also be used if you do specify an EmissiveMap, allowing you greater control of the brightness of your material.

The following example shows how this emissive setup works. The material on the left has an emissive scale set to 0, the middle set to 1, and the one on the right is set to 2.

<img alt="image_10.jpg[/img] src="./images/Resources/Community/SciFiBunk_MaterialInstancing/image_10.jpg[/img]


Normal Setup
<img alt="image_11.jpg[/img] src="./images/Resources/Community/SciFiBunk_MaterialInstancing/image_11.jpg[/img]


The normal map setup is fairly simple even if it may look slightly more complex. By default, this material will default to a flat normal map texture, though you could add a switch to turn the normal map off and use a constant value instead, which may save on texture memory.

This setup also allows you to combine a normal map with a detail normal map. The DetailTiling constant is multiplied with a TexCoord which allows you to control the tiling rate. The DetailNormalStrength lets you control the strength of the detail normal map.

Parallax Setup
<img alt="image_12.jpg[/img] src="./images/Resources/Community/SciFiBunk_MaterialInstancing/image_12.jpg[/img]


This parallax setup lets you use a BumpOffset node which gives your materials an illusion of depth if a heightmap is applied. More about this can be read here (Bump Offset).

This setup is plugged into the UV slots of all the aforementioned sections, meaning if parallax is enabled then all your maps will receive the effect.

The following example shows how the Parallax effect works. On the left, Parallax is disabled, and on the right, Parallax is set to 0.007. It's a fairly subtle effect but may work well depending on the material in question.

<img alt="image_13.jpg[/img] src="./images/Resources/Community/SciFiBunk_MaterialInstancing/image_13.jpg[/img]

Material Instancing
Now that your master material is setup, you can right click on your master material and crate a material instance.

<img alt="image_14.jpg[/img] src="./images/Resources/Community/SciFiBunk_MaterialInstancing/image_14.jpg[/img]


You can then name this material and organize it in whichever folder you like. I'd recommend setting up folders per material type, ie, a folder for all your metals, a folder for plastics, etc.

You can now double click on your newly created material instance and you will see the following:

<img alt="image_15.jpg[/img] src="./images/Resources/Community/SciFiBunk_MaterialInstancing/image_15.jpg[/img]


As you can see, all of the parameterized values and static switches that we set up in the master material are visible here in the material instance. Enabling switches such as UseDiffuseMap will enable you to input your own diffuse/albedo map, and will also enable certain parameters tied to this, such as the diffuse multiply option in this case.

Here is my material setup for the Sci-fi Bunk scene. You can see that I have created a library of tiling materials with various colors and material properties, which can easily be applied to meshes in the scene.

<img alt="image_16.jpg[/img] src="./images/Resources/Community/SciFiBunk_MaterialInstancing/image_16.jpg[/img]

Application to Meshes
Now that you have a material library set up, you can easily apply these tiling materials to your meshes. As you can see in the following image, this mesh doesn't use any uniquely baked normal maps, but instead relies on tiling materials to build up a believable surface. When you have an entire library of meshes built this way, you can see the advantages to using material instances, as you are able to tweak one single value and it will propagate throughout your scene. For example, if I wanted to change the wood texture used in this scene, I'd only have to change it once in the wood material instance, and my entire scene would update. This is far quicker than having to re-texture several unique diffuse maps.

<img alt="image_17.jpg[/img] src="./images/Resources/Community/SciFiBunk_MaterialInstancing/image_17.jpg[/img]

Extra Features
Now that your base master material and material library is set up, you can easily expand your master material and give it more features. For example, in this material setup, there is no option for vertex painting. You could add a basic lerp function combined with vertex paint to allow you to, for example, paint dirt on to your material surfaces. More information on this can be read here: 2路混合材质.

That should be all you need to get a basic master material setup for your scene. Remember to check out the Sci-fi Bunk Room scene to see exactly how this can be applied. Good luck!
回复

使用道具 举报

0

主题

820

帖子

2666

积分

vip会员

Rank: 1

积分
2666
发表于 2016-7-2 20:32:35 | 显示全部楼层
我来看看 这个怎么样
回复 支持 反对

使用道具 举报

0

主题

891

帖子

2943

积分

vip会员

Rank: 1

积分
2943
发表于 2016-7-4 03:08:10 来自手机 | 显示全部楼层
楼主好人!
回复 支持 反对

使用道具 举报

0

主题

1219

帖子

3800

积分

vip会员

Rank: 1

积分
3800
发表于 2016-7-4 12:53:28 | 显示全部楼层
谢谢楼主分享
回复 支持 反对

使用道具 举报

0

主题

830

帖子

2763

积分

vip会员

Rank: 1

积分
2763
发表于 2016-7-5 14:40:26 来自手机 | 显示全部楼层
全就行啊,,支持 一下
回复 支持 反对

使用道具 举报

0

主题

885

帖子

2946

积分

vip会员

Rank: 1

积分
2946
发表于 2016-7-9 00:48:28 | 显示全部楼层
最喜欢全套的了
回复 支持 反对

使用道具 举报

0

主题

882

帖子

2904

积分

vip会员

Rank: 1

积分
2904
发表于 2016-7-17 14:43:23 来自手机 | 显示全部楼层
我吭哧瘪肚 终于下载下来了,但是不会用- -
回复 支持 反对

使用道具 举报

0

主题

902

帖子

2945

积分

vip会员

Rank: 1

积分
2945
发表于 2016-7-18 10:39:04 来自手机 | 显示全部楼层
我一天来看一回,看看能不能打折。
回复 支持 反对

使用道具 举报

0

主题

819

帖子

2721

积分

vip会员

Rank: 1

积分
2721
发表于 2016-7-20 18:28:14 来自手机 | 显示全部楼层
不错,我喜欢这个,看看多少金币哦
回复 支持 反对

使用道具 举报

0

主题

836

帖子

2741

积分

vip会员

Rank: 1

积分
2741
发表于 2016-7-22 02:34:32 | 显示全部楼层
看看有近期需要的
回复 支持 反对

使用道具 举报

*滑块验证:
您需要登录后才可以回帖 登录 | enginedx注册

本版积分规则

 
 



邮件留言:


 
返回顶部