标签: godot-shader-language

Material.tres 使用旧的已弃用的参数名称?

问题:

我有一个使用 godot4(第一个稳定版本)中的着色器的材质,这是着色器的代码:

shader_type canvas_item;

uniform sampler2D custom_texture;
uniform float cutoff: hint_range(0, 1) = 1;
uniform float smoothness: hint_range(0, 1) = 0.1;
uniform vec3 color = vec3(0, 0, 0);
uniform bool inverted = false;
uniform bool linear_fade = true;

void fragment() {
    if (!linear_fade) {
        float value = texture(custom_texture, UV).r;
        if (inverted) {
            value = 1.0 - value;
        }
        float alpha = smoothstep(cutoff, cutoff + smoothness, value * (1.0 - smoothness) + smoothness);
        COLOR = vec4(color.rgb, alpha);
    } else { …
Run Code Online (Sandbox Code Playgroud)

godot godot-shader-language

4
推荐指数
1
解决办法
907
查看次数

标签 统计

godot ×1

godot-shader-language ×1