Simple sky shader with clouds Godot 4 tutorial
Вставка
- Опубліковано 13 вер 2023
- -------------------------------------------------------------------------------
Equipment:
Keyboard: amzn.to/3vpsLOU
Microphone: amzn.to/3tsq2nz
Monitor: amzn.to/3ttsIBl
[Advertising] All links in this section are affiliate links. If you purchase through one of these links, I will receive a commission. Nothing changes for you when shopping.
------------------------------------------------------------------------------- Subscribe us here: / @perfectionh_
Instagram: / perfectionh_yt
Music:
Lo-Fi Fashion Chill Hip Hop by Alex-Productions | / @alexproductionsnocopy...
Music promoted by www.chosic.com/free-music/all/
Creative Commons CC BY 3.0
creativecommons.org/licenses/...
Sweet Dreams by BatchBug | / batchbug
Music promoted by www.chosic.com/free-music/all/
Creative Commons Attribution 3.0 Unported License
creativecommons.org/licenses/...
Morning Routine by Ghostrifter Official | / ghostrifter-official
Music promoted by www.chosic.com/free-music/all/
Creative Commons CC BY-SA 3.0
creativecommons.org/licenses/...
Song: Outlandr - Overcome [Arcade Release]
Music provided by NoCopyrightSounds
Free Download/Stream: ncs.io/ Watch: ncs.lnk.to/AT/youtube - Фільми й анімація
Absolutely stunning results, thanks for sharing. For anyone else that had a hard time reading the code (especially differentiating + and *), here is the snippet I have that is working:
vec2 sky_uv = EYEDIR.xz / EYEDIR.y;
vec3 clouds = texture(cloud_texture, (sky_uv*cloud_scale) + (TIME*cloud_direction*cloud_speed*.01)).rgb - texture(cloud_texture2, (sky_uv * cloud_scale) + (TIME * cloud_direction2 * cloud_speed2*.01)).rgb;
clouds = clouds - smoothstep(0.0, EYEDIR.y, cloud_distance);
clouds = clamp(clouds,0,1);
sky += clouds;
I made one change compared to the video, and that was multiplying the cloud_speed by .01. Without this addition, I could not get a small enough float in the inspector. It kept resetting to 0 instead.
Thanks for this comment. It’s good to have people like you in the community :D I’m the guy who’s responsible for the blender content here on this channel, don’t know why my mate doesn’t answer comments xD
Hello everything is fine? Thank you very much for making this excerpt available!
I'm on Godot 4.2.1 and line 86 (clouds = clouds - smoothstep(0.0, EYEDIR.y, cloud_distance);) gives the following error "Invalid arguments to operator '-': 'vec3, vec2' "
Could you tell me how I can solve it?
Thanks in advance!
Hello, it's me again, I managed to understand what happened, I hadn't been able to see very well at first, but "+ TIME" was used in the line and not "* TIME", so mine was exactly like in the video, everything works, Here's the code in case anyone needs it:
vec2 sky_uv = EYEDIR.xz / EYEDIR.y;
vec3 clouds = texture(cloud_texture, sky_uv * cloud_scale + TIME * cloud_direction * cloud_speed).rgb - texture(cloud_texture2, sky_uv * cloud_scale + TIME * cloud_direction2 * cloud_speed2).rgb;
clouds = clouds - smoothstep(0.0, EYEDIR.y, cloud_distance);
clouds = clamp(clouds, 0.0, 1.0);
sky += clouds;
And thank you for the video, it helped me a lot!
This is a beautiful foundation for building many interesting skyboxes, you can use a mix of textures and noise even, lots of ways to go from here. Shader code intimidates me immensely so without this I would have likely not bothered. This is pretty basic math at least, that I can understand lol
Fabulous, I was just looking into how to get an animated sky shader like this!
As a follow-up, I achieved my first sky shader using this tutorial. I wanted a sea of dark, rolling clouds and the result is nice, but I have a lot to learn.
A tip for the video, even when you are zoomed in on the shader code, it is very difficult to see the difference between +/* (even at 1080p video). But I was still able to figure it out. Thanks!
Cool idea, but how I can make them voluminous?
Is it possible to make this with a physical sky? I really liked this but i need to use physical sky.
can I please get the code line for clouds? Can't really see it thanks to youtube compression.
Yes, I can do that. In 3 days I am back home.
code please. I'm also having a hard time reading it
nvm thanks i figured it out.. THANKS FOR THE AWESOME VIDEO
Have you tried this out with a day/night cycle?
No, not yet
This does not work for me using Godot 4.2
If anyone else gets this: UNKOWN IDENTIFIER IN EXPRESION 'sky' error
you can use COLOR.rgb instead
Here is the code
// NOTE: Shader automatically converted from Godot Engine 4.2.1.stable's PanoramaSkyMaterial.
shader_type sky;
uniform sampler2D source_panorama : filter_nearest, source_color, hint_default_black;
uniform sampler2D cloud_texture;
uniform sampler2D cloud_texture2;
uniform vec2 cloud_direction;
uniform vec2 cloud_direction2;
uniform vec2 cloud_scale;
uniform float cloud_distance;
uniform float cloud_speed;
uniform float cloud_speed2;
void sky() {
// Fragment shader code
vec2 sky_uv = EYEDIR.xz / EYEDIR.y;
vec3 clouds = texture(cloud_texture, (sky_uv * cloud_scale) + (TIME * cloud_direction * cloud_speed * 0.01)).rgb - texture(cloud_texture2, (sky_uv * cloud_scale) + (TIME * cloud_direction2 * cloud_speed2 * 0.01)).rgb;
clouds = clouds - smoothstep(0.0, EYEDIR.y, cloud_distance);
clouds = clamp(clouds, 0.0, 1.0);
COLOR.rgb += clouds;
COLOR.rgb *= texture(source_panorama, SKY_COORDS).rgb;
}
Thanks.
Mega Hilfreich danke :-) aber ich empfehle dir im Speziellen für Tutorials die Software immer auf englisch zu stellen ;-)
Stimmt, gar nicht daran gedacht, vielen Dank für den Tipp :)
3:56 you type cloud_speed instead of cloud_speed2
WE CAN NOT HEAR YOU OVER THE MUSIC
bro hes not even speaking 💀💀💀
😅 i cant see
Can you provide a description for the script
@@lyreads3228 I just commented the snippet that I got working above. Had the same issue