유니티 쉐이더 팁 - Rime 스타일의 폭포 제작



유니티 쉐이더 팁 - Rime 스타일의 폭포 제작

금별 0 74 11.26 17:21

There are games with such a memorable visual that it is terrible to consider the time spent on its development, take at least the latest God of War or RDR2. And there are projects that bribe their atmospheric, even if they are far from AAA. As an example, RiME has been praised for its style, sound and history. And recently, the level designer of the game went to the CD Projekt Red team to work on Cyberpunk 2077. RiME also inspired 3D artist Math Roodhuizen to create his own art.

And amid all this, I stumbled upon ArtStation on a realistic water creation guide. If last time it was about the river, then this time about the stylized waterfall. In the first part we will explain how to create a "ripple effect", and even directly in the game engine. For convenience, all steps are accompanied by gifs and / or pictures.
 

8lukajs1s-31mo7gfvimmginvuq.gif


First, thanks to Simon Trumpler, an artist from Tequila Games who worked on RiME . I was still new to shaders and VFX when I found his stuff and thought, “Wow, can I be able to do the same?”. I recommend reading the report to learn more about how to create stylized effects (such as fire, for example).

Now let's talk about the creation of a waterfall. This will be especially useful for people who are not familiar with the Shader Graph system. Our goal: to learn new ways of working and better understand the shaders.

I will use the example of Unity, but most of the methods are applicable in UE4 - if you are used to working there, just follow me. For convenience, each step is visualized by a gif or picture.

So, you will need:
 

  • Unity 2018.
  • Amplify Shader Editor (Unity plugin). But if you do not want to spend money on it, install Unity 2017 and download the free Shaderforge from the asset store (the new version of the engine does not support this plugin, but it still works in Unity 2017). Both tools are almost the same, except that some moments are called differently.
  • Autodesk Maya.
  • Something to create or edit textures. I use Photoshop, and sometimes even Substance Designer (but you definitely won't need it for this waterfall).


First, about the "ripple effect" that occurs when a waterfall falls on the surface. It can also be used for other purposes, for example, to create pulsations around objects in water.

ubjko5iypg5csetxipvglwfpjy8.gif

Open Unity and make sure you have the shader plugin installed. At the time of this writing, Unity has its own Shader Graph, which is still being developed. And while it’s not ready, I still recommend using the Amplify Shader Editor for Unity 2018 or Shaderforge in Unity 2017.

Create a new material and give it a name (I have it MAT_WaterWrinkles). Then right-click on the material in the Project Tab and go to Create> Amplify Shader> Surface Shader. In this case, the new shader will automatically apply.



You can select a shader at any time in the Materials tab> drop-down list of shaders (for Shaderforge there will be something like a PBL shader). Remember that the shader must be named both in the folder list and in the shader itself after it is opened.

8g05ve_dflwmkgqywfjpq30crdu.jpeg

As soon as you open a new shader, you will see something like this:

7ieepkf2levm_2zi1pjphvgeuue.jpeg

I will not write a detailed guide on the use of Shader Graph, and if you are completely new, first read the introductory guides.

In any case, to get the desired effect, we first need the usual Panner. Here it is with a test texture on the plane:

83hd9fk8wgk-hcuhmoxac7rcz_u.gif

Panner moves the UV coordinates. Make sure the Wrap Mode texture is set to Repeat. In Shaderforge, you may have to connect a temporary node to the Panner input, with Amplify some of these basic values ​​are already included in the node itself.

So, we have a moving texture. But we want to achieve this effect:

ubjko5iypg5csetxipvglwfpjy8.gif

And for this you need to scroll like this:

lwwwemj-vv8amtlxpfkynjek1gq.gif

As you can see, the structure of the node is the same - Panner simply moves the UV coordinates in the U and V directions (or X and Y). To get the right panning direction, we need to create a custom grid with UV. GIF for clarity:

By applying the same material to a different grid, we can control the direction of the texture in 3D space when it moves in the UV space.

j91odru3w4elitmc02elpxlm00s.gif

To enhance the effect, add a few more polygons and distort UV so that the texture in the center moves faster than at the edges. And place the UV so that the seam is not visible.

vsfvqynzumjlprdxippxpz_odqg.jpeg

An important conclusion follows from this: good effects rarely consist of one system and often represent a combination of several.

We got the texture moving in the right direction at the right speed. The UV sweep is placed in such a way that moving from right to left in the UV space with Panner turns into a movement in and out in the 3D space. To avoid seams in the texture on the 3D model, UV sweep must be added (hotkey X for snap to the grid) to the vertices of the texture space vertically. As a result, we have achieved the desired effect.



Now the transparency. Let's start with the basic things. Many simple calculations that you do in a shader will have values ​​from 0 (black) to 1 (white). That is, 0.5 is a shade of gray, and 0.2 is a shade of dark gray. When you apply these values ​​(in this case to the Opacity channel of the main output node), you will control the level of transparency of the material. Keep in mind that you first need to enable this feature. In Amplify, you can change the rendering type (in blend mode) from opaque to, for example, transparent. In this case, we will use the rendering type Transparent Cutout - the pixel displayed by this material is either completely transparent or completely opaque. This can be seen on the gif above - there are no "translucent" pixels displayed by this shader.

0zv2zwyehiurwcxxdvdq9c6jmrg.jpeg

Take the gradient texture in increments and place it on the shader. Here it connects to the output of the albedo (color) main node.

ftvmx1e9ujfhpcfcizmjwof5jmy.jpeg

And here it connects to the output of the Opacity Mask (this parameter is enabled when rendering type is Transparent Cutout).

zvl7oholli9y2wtctoafl_gcoda.jpeg

You can see that the gradient texture uses black and white pixel values ​​to determine transparency or opacity. Everything from 1 (white) to 0.5 (gray) becomes opaque, and everything from 0.5 (gray) to 1 (black) is completely transparent (or not displayed at all). Opacity Mask creates a hard line and rounds the values ​​to 0 or 1, depending on which number is closer.

Another grayscale texture:

ol_vkageq7enmygek80rhan1-hk.jpeg

Connected to the Opacity Mask:

cd9wjtycl78kqj0wx_f8mimpnti.jpeg

You get the idea. And guess how you can use it:

2urqdccavjdibo7blc0frlq-xpk.gif

You see a mostly blue image scrolling in the Shader Graph. And the fact that I use only R (red) output of this node. For the sake of optimization, I packed two grayscale textures (grayscale textures) into one file, but this is not necessary. Similar images can be packaged using Photoshop or Substance Designer.

px7k6ulmvnbqonfar8_sqjkfzga.jpeg

The ripple effect is a good start, but you can do better. Why not put two grayscale textures on top of each other to make the ripple effect more random?

zgtn78eo71em4hd8zyosznmyfjy.gif

I use the same texture, but I add different channels. I scroll through them at different speeds and slightly in different directions. The texture has a good gradient of gray values, which gives the feeling of a random ripple effect.

There is one more thing on the next gif that we haven’t discussed yet - so your option may look a little different:

7uowbnsld8tvgzcl6amkm2wajps.gif

You can see, for example, a pixel with a value of 0.2 (which is not rendered) passes over a pixel with a value of 0.4 (which is also not rendered) and suddenly becomes a pixel with a value of 0.6 - because we use an additional node (0.2 is added to 0.4 and it turns out to be 0.6). Adding these two wave grayscale textures on top of each other at different speeds and gives close to the desired effect.

2urqdccavjdibo7blc0frlq-xpk.gif

Here, to demonstrate the result, I added grayscale-textures on each other in Photoshop.

vaatuyfg9hr2clslyh3xoskstra.gif

However, the seam at the end of the mesh is still distinct. And we need to get this:

e-qs5fmcvn2fjqd3jdjxnoty-nw.gif

Instead of this:

4964w_tiq28mxap8bnczbd0tqm8.gif

In the first of the two gifs, the pulsations slowly subside and become smaller as they approach the edge of the grid. The easiest way to do this is to use vertex color (vertex colors).

Each model vertex contains its own data (for example, X, Y, and Z coordinates), as well as a color that has a value from 0 to 1. You can also set the color of the vertices in the 3D editor.


Most of the outer vertices are black (that is, they have a value of 0). They become white (closer to 1) when approaching the center. Note that you will need additional Subdivisions to get vertices that can be colored.

buuoppsouwnxep4s4ujpbbazixk.jpeg

For example, in Maya for coloring, you can go to the Mesh Display> Paint Vertex Color menu and click on the More Options field.

Now we can connect Vertex Color in our shader using Multiply.

66sm-wwyze85kybg_srrerrqabo.gif

I applied a gradient over the textures used and set the layer mode to Multiply.

xiwid1mg_pfo461adllkdm2t6-k.gif

The gradient enhances the gray value to 0 (black), so it will be more difficult to render the pixels (they are not displayed below the value of 0.5). This leads to the fact that the ripple lines shrink closer to the edge (the colors of the peaks mainly act as a gradient).

e-qs5fmcvn2fjqd3jdjxnoty-nw.gif

I added a few more nodes to control the thickness of the ripple lines. Here is the complete graph:

vub-soqrrulpflvlb3xhnzacme8.jpeg

Just experiment with the speed / direction of scrolling, adjust the texture and try to change the tiling to squeeze the maximum out of the effect.

This will help us in creating a more complex shader - a waterfall. We'll talk about it in the next part.

Source: https://habr.com/ru/post/434620/

Comments


번호 포토 분류 제목 글쓴이 날짜 조회
공지 외국 교육 이펙트 튜토리얼 모음(사이트/유튜브/비메오등등..) 댓글+4 금별 2018.05.12 1275
공지 이펙트 추천 사이트/블로그 댓글+5 금별 2018.05.12 1513
열람중 유니티 유니티 쉐이더 팁 - Rime 스타일의 폭포 제작 금별 11.26 75
95 유니티 유니티 이펙트 팁 - 데스스트랜딩 홀로그램 효과 참고해 만들기 금별 11.19 89
94 언리얼4 언리얼4 - 블랜더를 활용한 지형 버텍스 옵셋 이펙트 팁 금별 11.19 53
93 언리얼4 언리얼4 VFX Basics - Creating the scrolling texture with mask setup 금별 10.31 157
92 언리얼4 언리얼4 팁 - Gradient Mapping 금별 10.29 102
91 유니티 유니티 - 스타게이트 효과 참고영상 금별 10.29 103
90 유니티 유니티 - 2d Raymarched Smoke 금별 10.26 71
89 유니티 유니티 이펙트 팁 - 포털제작 금별 10.19 132
88 언리얼4 언리얼4 이펙트 팁 - Rift to R’lyeh FX 금별 10.15 168
87 언리얼4 언리얼4 - 버텍스 옵셋 예제와 노드 금별 09.16 241
86 유니티 유니티 - 포탈이펙트 예제와 제작과정 금별 09.09 341
85 유니티 유니티 - Stylized 폭포 제작하기 금별 09.07 179
84 유니티 유니티 - 원통형 메쉬에 토네이도형 uv 흐름제어 금별 08.30 221
83 유니티 유니티 이펙트 제작과정 - 사슬로 감싼 폭발형태 제작 금별 08.30 284
82 유니티 마법적 구슬형태 제작 금별 08.30 187
81 유니티 유니티 버텍스 옵셋 효과 예제 Juane Gray 금별 08.20 136
80 유니티 Skeleton Mage Summon With Shaders and Textures 금별 08.20 177
79 언리얼4 언리얼4 - 버블쉐이더 금별 08.20 179
78 유니티 유니티 쉐이더 - 쉐이더그래프/앰플리파이 쉐이더에서의 커스터 버택스 스트림 사용 금별 08.20 238
77 언리얼4 토네이도와 폭발효과 만들기 금별 08.18 242
76 언리얼4 언리얼4 머터리얼 팁 - 텍스쳐없이 만드는 머터리얼 패턴 금별 08.13 201
75 유니티 유니티 쉐이더 그래프 - Weaving Ring Tutorial 2 댓글+1 금별 08.12 174


Banner
Facebook Twitter GooglePlus KakaoStory NaverBand