-
-
Notifications
You must be signed in to change notification settings - Fork 3.5k
Open
Labels
area:manualIssues and PRs related to the Manual/Tutorials section of the documentationIssues and PRs related to the Manual/Tutorials section of the documentationenhancementtopic:shaders
Milestone

Description
Godot version:
3.1 Alpha 2
OS/device including version:
Windows 7 Professional Service Pack 1
Issue description:
Shader turns entire sprite white.
Tried both of the following shader coding:
shader_type canvas_item;
//Set target colors.
uniform vec4 target_color_1 : hint_color;
uniform vec4 target_color_2 : hint_color;
uniform vec4 target_color_3 : hint_color;
//Set replacement colors.
uniform vec4 replace_color_1 : hint_color;
uniform vec4 replace_color_2 : hint_color;
uniform vec4 replace_color_3 : hint_color;
void fragment() {
if (COLOR == target_color_1)
{
COLOR = replace_color_1
}
if (COLOR == target_color_2)
{
COLOR = replace_color_2
}
if (COLOR == target_color_3)
{
COLOR = replace_color_3
}
}
And:
shader_type canvas_item;
uniform float threshold : hint_range(0,1) = 0.01;
uniform vec4 T0:hint_color = vec4(0.058823, 0.058823, 0.058823, 1);
uniform vec4 T1:hint_color = vec4(0.254902, 0.254902, 0.254902, 1);
uniform vec4 T2:hint_color = vec4(0.45098, 0.45098, 0.45098, 1);
uniform vec4 R0 : hint_color;
uniform vec4 R1 : hint_color;
uniform vec4 R2 : hint_color;
void fragment() {
vec3 c = COLOR.rgb;
if (abs(T0.r-c.r) <= threshold && abs(T0.g-c.g) <= threshold && abs(T0.b-c.b) <= threshold) {COLOR.rgb = R0.rgb;}
if (abs(T1.r-c.r) <= threshold && abs(T1.g-c.g) <= threshold && abs(T1.b-c.b) <= threshold) {COLOR.rgb = R1.rgb;}
if (abs(T2.r-c.r) <= threshold && abs(T2.g-c.g) <= threshold && abs(T2.b-c.b) <= threshold) {COLOR.rgb = R2.rgb;}
}
Steps to reproduce:
Run app.
Metadata
Metadata
Assignees
Labels
area:manualIssues and PRs related to the Manual/Tutorials section of the documentationIssues and PRs related to the Manual/Tutorials section of the documentationenhancementtopic:shaders