简体   繁体   中英

Sample gradient range in Unity Shader Graph

I'm trying to put together a simple shader with Unity' Shader graph. The material should appear white, yellow and blue - and static. However in the sample gradient, it's only displaying yellow. If I change the time input to Sine, the gradients blends through the colours. What is going wrong. 在此处输入图片说明

在梯度采样器的“时间”输入中插入一个“UV”节点,而不是“时间”节点。

First thing to know is that a Gradient goes from 0 to 1. The 0 is on the left (in white) and the 1 in on the right (in yellow). I guess that the blue is between approx. 0.25 and 0.3.

On the other hand, you use the Time, which has a constantly evolving value far above 1. Therefore, it is always on the max, meaning plain yellow.

If you use SinTime, the value alternates with a sinusoid between 0 and 1, making the color go from left to right then from right to left.

Additional information: as of today (2019.1.12) it seems that there is a bug in Shader Graph when you use Gradient on a system where the decimal separator is "," The generated shader is created with a "," instead of "." in functions, messing up the arguments.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM