Press "Enter" to skip to content

Shader graph displacment

内容纲要

Shader graph 的 Displacement 思路与UE4和 Amplify Shader Editor 的point offset都不同

Shader graph的disp有两个需要注意的点:

  • 需要以point (object space)作为置换的基础
  • 如果用到texture ,需要使用 Sample Texture 2D LOD 才能起作用, 默认的Sample Texture 2D不起作用

具体原因如下:
Sample Texture 2D 在screen view中可以自动选择lod,但是 置换是在fragment 之前,所以必须使用能够手动制定lod的Sample Texture 2D LOD 节点(SG真傻X)

file

The basic Sample Texture 2D uses a fragment shader function in which the GPU automatically determines the appropriate mip map level of detail to use based on how much the UV changes between the pixel being drawn and the pixels next to it.

This doesn't work in a vertex shader because the GPU doesn't know where that vertex is on screen, or how it relates to the surfaces that will eventually be drawn with it.

Sample Texture 2D LOD let's you explicitly choose the mip level yourself.

file

https://blogs.unity3d.com/cn/2018/10/05/art-that-moves-creating-animated-materials-with-shader-graph/

发表评论

您的电子邮箱地址不会被公开。 必填项已用*标注