PLEASE HELP ME WITH GODOT 4.0.1 SKY SHADER!
Asked Answered
S

2

0

Ai wrote this code:

shader_type sky;



uniform vec4 sky_top_color : hint_color = vec4(0.0, 0.0, 0.1, 1.0);

uniform vec4 sky_horizon_color : hint_color = vec4(0.0, 0.0, 0.2, 1.0);

uniform sampler2D star_texture;

uniform sampler2D moon_texture;

uniform float moon_size = 0.1;

uniform float moon_brightness = 1.0;

uniform float star_brightness = 1.0;



void sky() {

// Sky gradient

COLOR = mix(sky_horizon_color, sky_top_color, max(VERTEX.y, 0.0));



// Stars

COLOR.rgb += texture(star_texture, VERTEX.xy).rgb * star_brightness;



// Moon

float moon_angle = atan(VERTEX.x, VERTEX.z);

float moon_y = sqrt(VERTEX.x * VERTEX.x + VERTEX.z * VERTEX.z);

vec2 moon_uv = vec2(moon_angle / (2.0 * PI) + 0.5, moon_y);

COLOR.rgb += texture(moon_texture, moon_uv).rgb * moon_size * moon_brightness;

}

Is there anything wrong?? I don't see any visible errors, but godot just says: error(3): Expected valid type hint after ':'.

PLEASE HELP!!!!! I am a total beguiner.

Stenotype answered 2/4, 2023 at 8:30 Comment(0)
S
0

PLS HELP!!!!

Stenotype answered 2/4, 2023 at 8:31 Comment(0)
T
0

Stenotype Have you tried asking AI what's wrong with the code? 😃

If this is for Godot 4, hint_color is no longer used in the shading language. Try source_color instead.

Thickset answered 2/4, 2023 at 11:55 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.