Godot 4 3D Day Night Cycle Using Physical Sky

  Рет қаралды 9,186

Robin Lamb

Robin Lamb

Күн бұрын

How to make a day night cycle in Godot 4.0 in a 3D scene using the new PhysicalSkyMaterial.

Пікірлер: 48
@kiyasuihito
@kiyasuihito 3 ай бұрын
Most straightforward tutorial I've seen yet. I feel this is the way Godot intends to do d/n cycles.
@robinlambstudio
@robinlambstudio 3 ай бұрын
Thank you! I hope they will add more options to it in the future, though, like a moon as well as sun and clouds.
@megasailoor
@megasailoor Жыл бұрын
Cheers. I'm drunk and my brain no workies. This made my sky be a sky. I'll subscribe now.
@LaurentSparksMusic
@LaurentSparksMusic 2 ай бұрын
relateable
@proatgaimz
@proatgaimz Жыл бұрын
Awesome! looking forward to more content!
@robinlambstudio
@robinlambstudio Жыл бұрын
Thank you!
@evilyxof
@evilyxof Жыл бұрын
Wow this was faster than I thought! I did it and set my secconds to 1440 to replicate minecraft day n night cycle only bc I really think it's a good balance for a day n night cycle. Thanks a lot!
@robinlambstudio
@robinlambstudio Жыл бұрын
Thank you!
@alexeykurilo4381
@alexeykurilo4381 Жыл бұрын
simle but effective. Looking forvard to new tutorials from you
@robinlambstudio
@robinlambstudio Жыл бұрын
Thank you!
@greencopter4444
@greencopter4444 Жыл бұрын
Clear and concise. Thank you!
@robinlambstudio
@robinlambstudio Жыл бұрын
Thank you!
@ShadowWolf936
@ShadowWolf936 9 ай бұрын
Thank you so much for this video.
@robinlambstudio
@robinlambstudio 9 ай бұрын
Thank you! Glad you found it helpful.
@MoogieSRO
@MoogieSRO 14 күн бұрын
Nothing happens for me when I add the directional light. Rotating the light doesn't affect the sky at all. I have a World Environment node, "Environment", Mode = "Sky", Sky = "Sky", Sky Material = "Physical Sky Material", I made the horizontal blue-black gradient, then I added a DirectionalLight3D node. Nothing happened. The DirectionalLight3D only changes the shading on my character.
@RedHedDes
@RedHedDes Жыл бұрын
Great tutorial! Subbed.
@robinlambstudio
@robinlambstudio Жыл бұрын
Thank you!
@MjkL1337
@MjkL1337 4 ай бұрын
i did this with gdscript converting from pi to degrees and then to actual minutes so i have an actual accurate time of day along with it. any idea on how to make a moon along with the sun? I'll try to add clouds as models and have the sky turn progressively grey/white with weather along with it. thanks!
@adelatorremothelet
@adelatorremothelet Жыл бұрын
Nice tutoral, thanks for posting it. It would by nice to have a tutorial on the other settings of the sky.
@robinlambstudio
@robinlambstudio Жыл бұрын
Thank you!
@keletsorabalao7454
@keletsorabalao7454 Жыл бұрын
Much appreciated 👍
@robinlambstudio
@robinlambstudio Жыл бұрын
Thank you! Glad you found it helpful!
@kraig800i
@kraig800i 4 ай бұрын
Background Mode = Sky Sky material =PhysicalSkyMaterial Interpolation = linear fill= linear Visible gradient clearly radiant. It's like the sky is emiting from the 0,0,0 point of the scene. This is weird I have never had this happen to me prior this. . . . . . any idea on how I can fix it? ? ? ? (EDIT) Okay so the type of gradient doesn't change how it looks too much in the final game. . . . but I have a new problem, it doesn't seem to want to run in game. But it runs in loops perfectly in the stand alone scene I made for it.
@supernrdgaming
@supernrdgaming 9 ай бұрын
Very helpful!
@robinlambstudio
@robinlambstudio 9 ай бұрын
Thank you!
@TheCatofCaesar
@TheCatofCaesar Жыл бұрын
nice!
@robinlambstudio
@robinlambstudio Жыл бұрын
Thank you!
@ignitexo9700
@ignitexo9700 8 ай бұрын
Can we add cloud to it by any chance, btw love the tutorial
@robinlambstudio
@robinlambstudio 8 ай бұрын
Thank you! Unfortunately, there is not an option to add clouds, like the procedural sky has. Hopefully this will be added to the Physical Sky in the future.
@peadamo
@peadamo 7 ай бұрын
thanks good tutorial
@robinlambstudio
@robinlambstudio 7 ай бұрын
Thank you! Glad you found it helpful.
@Msgraciepacey
@Msgraciepacey Жыл бұрын
Hi Robin it's me again ! Do you know how to do this using two different sky boxes?
@robinlambstudio
@robinlambstudio Жыл бұрын
Hello. You can have only one sky in a scene in Godot. The two ways to have a day night cycle would be to use a Physical Sky like in this tutorial and using a sky shader. Can you tell me more about what your goal is? You can tweak the gradient in the night sky under the physical settings to get a better day night transition if that is what you want. You can also, I think use an image for the night background with physical sky (Sky textures need to be I think 4096 * 2048). Keep in mind that in the Physical Sky, the night sky will be multiplied with the day sky, so if it is too dark it will show during the day. I would first try tweaking the gradient in the night sky until you get a good transition between day and night. If you want stars, you could probably do that with an image if you could find something appropriate the correct size that wouldn't be too dark to show during day. If you need something else, you might need to use a sky shader to achieve it.
@Msgraciepacey
@Msgraciepacey Жыл бұрын
@@robinlambstudio hi Robin! Thanks for this explanation. What I meant was is there anyway to do a day/night cycle using two different HDRis? I did notice that in the night sky you can use an image instead of the gradient but like you said if it's too dark it will show in the day time. I tried used panoramaskymaterial but this way only allows you to use one HDRi and no option for night sky like physical sky
@robinlambstudio
@robinlambstudio Жыл бұрын
@@Msgraciepacey I think the problem with doing a day night cycle with a panorama is usually it is an hdri photo of the sky at a certain time. So the transition between the two would be pretty rough. I looked up the Godot documentation for panoramic skies, and there is a set_panorama() ( I think it was called that anyway.) You could try bringing in your two backgrounds var background1 = preload( "pathtoyourbackground") etc. and try doing a timer to change the background. I am not at my computer now, so I haven't tried this to know if it would work, or how fast the panorama will change if it works. If it doesn't work, you could save all the stuff in your scene except the WorldEnvironment as a scene, and make two different scenes night and day that would inherit it, and save the player position in a preloaded script to know where to load it when shifting between day and night. You could do something like make a short 2D thing that covers the screen between the transition that says "It is morning / night now" so the rough transition is not as noticeable. As far as the sun, you may be able to use a Sprite3D with Billboard Mode set and rotate it around your world (which would only work if the world was small), or maybe you could actually put it is the player scene so it always appears the same distance from the player. It would be a challenge getting a sun to look good with a high resolution photo background (and many already have a sun in them).
@robinlambstudio
@robinlambstudio Жыл бұрын
@@Msgraciepacey While I was looking at procedural skies, there is an option in procedural skies to add cover, and you can use an image texture for this cover. You can swap out panoramic textures here (I did it with an animation player just with a keyframe of the texture). You will still get the sun moving across the sky as the directional light rotates. The picture will be multiplied by the sky colors. The transition between day and night will still be rough, though, and a dotted line seam shows in the sky with some textures, even though it is a seamless panorama, (which I think may be a bug)
@GeneralChrisGaming
@GeneralChrisGaming 5 ай бұрын
Its alright but that Orangeish red limit what shades I can use for night
@laserproductions3748
@laserproductions3748 8 ай бұрын
❤❤❤
@ajloveslotr
@ajloveslotr Жыл бұрын
Did I miss a step? Mine doesn't do anything 😭
@robinlambstudio
@robinlambstudio Жыл бұрын
Hello. Make sure that your directional light is rotating in the animation, and that the animation plays when you start the scene. Did you set the animation to automatically play when you start the scene? If the animation is not playing, the sun will not turn and the sky not change.
@Msgraciepacey
@Msgraciepacey Жыл бұрын
Do you know how to do this using GdScript?
@robinlambstudio
@robinlambstudio Жыл бұрын
Hello! Thanks for your question. To rotate your directional light in GdScript, create a script for the scene containing your directional light. Add a variable for the speed for the light to turn: var sun_rotation_speed = 0.3 (I would recommend this to start with so you can see if its working, in your actual gave you would probably want the speed much slower). Then under the _process(delta) method add: $DirectionalLight3D.rotation.x += sun_rotation_speed * delta After that line, I would also add: if $DirectionalLight3D.rotation.x >= 360: $DirectionalLight3D.rotation.x = 0 to make sure that you don't keep accumulating degrees after 360, which I have heard, anyway, can cause problems. This should rotate your directional light from code.
@Msgraciepacey
@Msgraciepacey Жыл бұрын
@@robinlambstudio Hi Robin this worked thanks! Any idea how I move the sun through the sky. Currently it's rotating around it's own axis. I'm new to programming and I'm new to godot so I'm struggling a bit 😅
@robinlambstudio
@robinlambstudio Жыл бұрын
@@Msgraciepacey Thank you! What kind of movement are you trying to get? If you just want a sunrise and sunset, from one side of the sky to the other, this should do it. You are rotating the directional light on its own axis, but the physical sky determines where the sun would be in the sky based on which way light is coming from for the day night cycle. In the Godot, it doesn't really matter where you put a directional light in the scene, the effect will be the same, only rotating it changes which direction it is coming from. If you drop in a character controller, you should be able to see a sunrise on one side of the game world and sunset on the other, if that is what you are trying to achieve.
@Msgraciepacey
@Msgraciepacey Жыл бұрын
@@robinlambstudio I ran my game again and pointed to camera at the sky realised that it was travelling through the sky thank you Robin! Please do more tutorials like this and I hope I can ask you more questions in the future
@robinlambstudio
@robinlambstudio Жыл бұрын
@@Msgraciepacey Thank you!
@Boildroid
@Boildroid 9 ай бұрын
Is it possible to add clouds to physical sky?
@robinlambstudio
@robinlambstudio 9 ай бұрын
Unfortunately, there is not an option to add a texture or noise as clouds, like for procedural skies. Hopefully this will be added in the future.
Moebius-style 3D Rendering | Useless Game Dev
8:12
Useless Game Dev
Рет қаралды 840 М.
Day & Night Cycle in under 8 minutes! Godot 4.0 Tutorial
7:34
Smart Sigma Kid #funny #sigma
00:14
CRAZY GREAPA
Рет қаралды 6 МЛН
Officer Rabbit is so bad. He made Luffy deaf. #funny #supersiblings #comedy
00:18
Funny superhero siblings
Рет қаралды 19 МЛН
Help Me Celebrate! 😍🙏
00:35
Alan Chikin Chow
Рет қаралды 84 МЛН
Зу-зу Күлпаш 2. Интернет мошенник
40:13
ASTANATV Movie
Рет қаралды 611 М.
Every 2D Node Explained in 9 Minutes !
9:19
Lukky
Рет қаралды 346 М.
20 Tips That Make Unreal Engine EASY (Beginner Friendly)
12:32
Ben Crawshaw
Рет қаралды 6 М.
My game is 262,000 times faster than Minecraft. I'll show you how.
12:20
IGoByLotsOfNames
Рет қаралды 1,1 МЛН
How Games Make VFX (Demonstrated in Godot 4)
5:46
PlayWithFurcifer
Рет қаралды 350 М.
10 Minutes vs. 10 Years of Animation
19:29
Isto Inc.
Рет қаралды 1 МЛН
Easy Day/Night Cycle in Godot (Tutorial)
4:43
Garbaj
Рет қаралды 18 М.
10 more pro tutorials most Blender artists haven't seen
17:46
Robin Squares
Рет қаралды 21 М.
Blender Vs. Maya
11:30
Film Stop
Рет қаралды 182 М.
So I Made A Water Shader In Godot 4 And It Was Quite Simple
11:32
Smart Sigma Kid #funny #sigma
00:14
CRAZY GREAPA
Рет қаралды 6 МЛН