Sky Shaders in Godot 4.0 | What You Should Know

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hey everyone today we're talking about shaders and gatto4 specifically Sky shaders that will allow you to upgrade your sky from this to this Sky shaders are a new Shader type made for the sky background in your world environment node and they allow you to have more Dynamic control over the sky material so why is a sky Shader instead of a standard spatial Shader well I'm glad you rhetorically asked that question goto 4 features five Shader types spatial which is your standard material canvas item for 2D particle shaders fog shaders and Sky shaders each Shader is designed for a specific task and Sky shaders have a number of built-in parameters that make it a lot easier to make Dynamic and procedural Skies so let's take a look to see how to set one up your Sky Shader will reside in your world environment node which houses a number of visual settings for your parents scene right now we're focused on the sky settings which you can set to a Shader material the material itself operates like any other Shader but the type here at the top is set to Sky and you don't have access to the vertex or fragment functions you find in a spatial Shader instead you have a sky function that will contain your final settings like color Alpha and fog let's take our brand new Shader and add some color to our blank Sky we can set a basic Blue Sky by using the color setting and assigning a blue color through a vector with this code here now that's nothing fancy but we're already getting some advantages with our Sky Shader back in our world environment node if you set your light settings to use your Sky your scenes lighting will also reflect the changes made in your Sky Shader this allows you to utilize your skies to achieve real-time lighting changes in your 3D scene your 3D scene uses a Radiance Cube map for image based lighting and Sky shaders updates the radiance Cube map Vex Sky shaders can update up to six times for frame but we'll get to that in a minute the power from these skyshaders comes from the built-in parameters you can access the eye Direction parameter is going to do a lot of the heavy lifting and gives the normalized direction of the current pixel in other words it provides a detail about the curvature of our Sky the sky itself acts like a dome over our scene and we can see the values of our eye Direction parameter if we plug it into our color now while the multi-colored grid Sky may not be usable on its own we can use this information to shape our colors to reflect the spherical atmosphere we all know and love let's take our blue sky and make a gradient effect on the horizon the eye Direction can give us the slope of our Sky based on its normals the X Y and Z values show the zero to one gradients of our Dome at the Apex of our Sky our y value will be one or white and as we get closer to the Horizon the normals begin to point increasingly horizontal until the Y value reaches zero or black by taking the Y value we can create this nice gradient here then we can use this Alpha gradient to lurk between a base Sky color and a horizon color another useful feature is the ability to get directional light information without having to pass variables through a script by using light zero energy for example you can connect the energy value of our light to make the sky darker or brighter or use light zero direction to create a simple day night transition based on which direction your light is pointing you're also not limited to just one light sky shaders will automatically grab info on up to four different lights in your scene now in addition to light information you also have access to the UV coordinates of your sky this really comes from the world of cartography if you've ever seen a flattened map of Earth the areas near the poles are actually smaller than they appear panoramic images utilize the same technique to project a rectangular image onto a sphere by using the sky coordinates parameter we can project a panoramic image to the UVS of our Sky to for example create an overlay of clouds on your Sky color for more expensive operations where you're using Ray marching or other techniques to create a physically accurate atmosphere or Cloud you can also make use of the additional render passes built into the Shader to reduce draw time using the half res or quarter rev pass you can render fewer pixels to achieve similar quality effects at a reduced cost you also have access to the time parameter let's say that you had a cloud overlay that you wanted to animate slowly to create Some Cloud movement with time you can add to the UV position of our texture to slowly or quickly rotate the clouds and like other shaders you can add uniform variables that you can manipulate and access within scripts allowing you to create a global day and night system for instance that can control your Sky Shader and other elements of your game like weather or other game events simultaneously put all these parameters to use and you can come up with a pretty convincing sky if you're interested in more shaders and Gato check out this video here where I walk through the creation of a watersheder and as always keep creating
Info
Channel: StayAtHomeDev
Views: 37,098
Rating: undefined out of 5
Keywords: made with godot, godot 4, godot engine, godot 4 tutorial, godot, godot 4.0, godot 4.0 tutorial, godot 4.0 3d, how to use godot, how to make a game in godot, how to learn godot, why use godot, how to godot, godot devlog, godot 4 beta, godot 4 new features, migrate to godot 4, godot 3d tutorial, stayathomedev, godot 2023, godot 4.0 stable, godot 4.0 stable release date, godot shader, godot shader tutorial, godot shaders 3d, godot sky shader, godot sky, godot skybox
Id: SzNmHPr4vf8
Channel Id: undefined
Length: 5min 42sec (342 seconds)
Published: Tue Mar 14 2023
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.