excellent video, it reminded me of coding adventure at first but your explanation of the ray-sphere intersection is really clear! thanks!
@MartinDonald4 жыл бұрын
Thanks! I love Sebastian's videos. Full of great info.
@GmZorZ4 жыл бұрын
@@MartinDonald not sure if it would be in your interest, but i am currently struggling with cone/cylinder intersections for my ray tracer, so if you ever get ideas for videos about rays and intersections i have your bell turned on ;-)
@davidmurphy5634 жыл бұрын
I'm currently programming a procedural solar system and was looking for approaches for the atmo. And instead I find this. In Godot no less. Just bought you a pint on patreon. Thank you man.
@MartinDonald4 жыл бұрын
Thank you very much! Really appreciated :)
@davidmurphy5634 жыл бұрын
I implemented this and had an odd issue. When looking directly down toward the planet there's a completely unshaded square front and centre between the camera and the planet. When looking side on I've got a nice atmo so I'm not far from the answer hopefully. I've literally just copied the shader so far and haven't gone through it properly yet but I was wondering if you have any ideas where I'm going wrong? EDIT: missed your reply, oh you're very welcome! I'm grateful to you for doing this, it's exactly what I needed explained in beautiful detail.
@davidmurphy5634 жыл бұрын
@@MartinDonald This is bizarre. I thought it might be the camera as mine has gimbals and zooms and all sorts so I added a new vanilla one and made that current. Same bug. Thought it might be my implementation of the shader (I'm instancing the meshes procedurally in code including the CubeMesh), so I did it that way on a fresh scene and that worked perfectly, no weird box, just not on my actual project... So it's not the shader code and it's not the camera. Grr. It's the same whether you're above the atmo or below, so it's not the neg culling. It's just like there's a "so not shade here" plane a metre from the camera... What else could it possibly be?
@MartinDonald4 жыл бұрын
@@davidmurphy563 hmm sorry, I'm not sure what the problem could be, if you're rendering to a mesh cube as I do in the video then perhaps your sphere radius is too large and it's clipping with the cube? Since you're a patron you can also download my project files for this video and see if there are any clues in there 🔍
@davidmurphy5634 жыл бұрын
@@MartinDonald Yeah, I'm baffled by it too. Like I say, I got it going perfectly on another quick mockup project, just not my game... My radius is 10k but the CubeMesh is bigger and anyway, it's the opposite of that: the unshaded diamond shaped region is on the local -y axis between the camera and the world. Just like if there were an unshading plane as a child of the camera positioned on a tangent in the direction of the world removing the shade. There isn't such a plane obvs, that's just how it looks. Very frustrating. Anyway, sorry to pester, I'll keep plugging away. I'll try deleting the shader and making a new one, see if that fixes it.
@ZiplawDev2 жыл бұрын
brother this is amazing, I remember watching Sebastian lague's atmosphere video and having no idea where to start, this seems like a much more manageable approach, and you explained it wonderfully
@Polygarden Жыл бұрын
Great video! Good to see more people doing shaders for Godot. From there it's not a big step towards clouds and atmospherics. I went this entire pathway inside of shadertoy. ^^
@WilcoVerhoef2 жыл бұрын
It looks like the atmosphere has the same density at all heights, until it cuts off at some point. Maybe the easiest hacky way of making it look like the atmosphere thins out at higher altitudes; is to not just look at the thickness ΔT, but first raise it to some power. So thickness = c * ΔT ^ e.
@stayroh2 жыл бұрын
Realy Realy good tutorial tysm. I will use this to try to find the position where the second buggy of a train wagon should be on a path (the train tracks in this case)
@danieldrew23564 жыл бұрын
Really good, high-quality video!
@tissuepaper99622 жыл бұрын
These videos are really helping me study for the graphics exam I'm trying to procrastinate on. Damn you Martin!
@finsflexin2 жыл бұрын
Outer Wilds was the best game I’ve ever played. Whatever you are doing, I need to stay updated!
@Rossilaz582 жыл бұрын
This is really good, but something that would make it even better is casting the shadow of the planet onto the atmosphere.
@pokonomo3 жыл бұрын
That was an amazing explanation, thank you!
@isaackershnerART11 ай бұрын
i know it has been a while but I am stuck in UE4 trying to decipher what the is equivalent to this line: vec4 view = INV_PROJECTION_MATRIX * vec4(ndc, 1.0); specifically, what is INV_PROJECTION_MATRIX for hlsl or in ue4 nodes. Great tutorial btw!!!!
@brodakarat63402 ай бұрын
im doing a assignment where i gotta write a research on something in games and i chose atmospheres after seeing sebastian lagues one. my specific research is how are modern techniques optimising for realtime apps compared to raw ray marching
@n41sd3 жыл бұрын
Amazing channel!! this is really necessary for godot!! Sugestion put some tags on video.
@jamesb91204 жыл бұрын
I think I have found where Sebastian Lague gets his ideas from...
@LeoninMinecraft2 жыл бұрын
this looks like a lot of fun to impliment. Im going to try making it with Unity
@ciberman3 жыл бұрын
So... Are you telling me you are the new Sebastian League?
@jpsilver35103 жыл бұрын
100%
@faimenDev2 жыл бұрын
Man, it's excellent video, thx!
@monsoonsheep2 жыл бұрын
Brilliant work!
@mimisaiko Жыл бұрын
This is exactly what I'm thinking about lately after watching those video that put GoPro camera on a balloon and let it fly to space.
@VladgavligGapchich4 жыл бұрын
Great video, as usual! Can't wait to leave the same comment again and again :)
@imbw2672 жыл бұрын
Adding a sigmoid curve modifier from r=sr to r=2*sr would allow the atmosphere to blend into space
@Grytix5567 Жыл бұрын
how can you use this im so lost
@HarryLarsson-b2n4 күн бұрын
you should decrease the density with altitude
@feffo99084 жыл бұрын
hei man, amazing work both at explaining and coding! just a question: while calculating the light interaction, i noticed that using a global vector for light direction is not working as I should use the relative direction to camera (otherwise the illuminated area always face the same direction of the screen) I would do some math to calculate the relative light direction starting from the global, but i'm a noob with shader and dont know the code the extrapolate the camera direction. Since you havent mentioned it in the video, how did you solve it?
@MartinDonald4 жыл бұрын
Thanks! You're absolutely right, you just need to multiply it by your cam matrix like so: vec4(light_dir.xyz, 1.0) * CAMERA_MATRIX;
@feffo99084 жыл бұрын
@@MartinDonald works wonderfully! thanks a lot!
@Sandmule Жыл бұрын
Works great, only have one issue (kzbin.info/www/bejne/hXS9hYmmm7KGr9U): for whatever reason: float t2 = min(t+x, max_depth*1.8); //gives accurate looking results float t2 = min(t+x, max_depth); //planet still shows up in front
@samwelwalter9072 жыл бұрын
Having trouble when the atmosphere is scaled to large radius values like 600k and above
@gordon12013 жыл бұрын
Anyone know what is the equivalent of VIEW in unity?
@syuta93173 жыл бұрын
that worked for me: struct v2f { float2 uv : TEXCOORD0; float3 view : TEXCOORD1; float4 vertex : SV_POSITION; }; v2f vert (appdata v) { v2f o; o.vertex = UnityObjectToClipPos(v.vertex); o.uv = v.uv; o.view = mul(unity_ObjectToWorld, v.vertex); return o; } in fragment shader: float3 VIEW= normalize(i.view - _WorldSpaceCameraPos);
@jpsilver35103 жыл бұрын
@@syuta9317 thank you
@addmix2 жыл бұрын
Godot brand Sebastian Lague
@sntghujkkbbbgtttttuuoppp Жыл бұрын
Fantastic video - you really helped me grasp this concept so much better than I otherwise would've. I'll give your channel a shout in the credits of our indie game, if it ever releases :)
@tux_the_astronaut4 жыл бұрын
How did you get the atmosphere to render really far away when I do the atmosphere has black rings
@MartinDonald4 жыл бұрын
This is probably due to the depth buffer becoming less accurate at really long distances. You can try offsetting the depth test in the shader when the planet is really far away? Or maybe you could look into swapping your planet for a simple sprite for seriously long distances.
@Pracedru4 жыл бұрын
I suggest increasing the camera near plane when you are far away.
@jpsilver35103 жыл бұрын
Does anyone know how to sample the depth texture in unity using hdrp?
@nicks47274 жыл бұрын
How do you get the sun to light all the planets? I've been having troubles with that in Unity URP because they don't support real time point lights. Is there a better way to make the sun the main light source?
@toupocallen75724 жыл бұрын
I'm sure you don't have time to answer such a dumb question but I was wondering how did you keep the player upright when on the planet. I've tried a bunch of stuff but once the planet starts moving I cant get anything to work.
@MartinDonald4 жыл бұрын
Not a dumb question at all! 3D transforms are a nightmare. Check out this page in the godot docs, particularly the part about quaternion rotations at the end: docs.godotengine.org/en/stable/tutorials/3d/using_transforms.html
@jpsilver35103 жыл бұрын
Can you please do this in unity as well?
@MartinDonald3 жыл бұрын
I probably can't, but I can recommend Sebastian Lague's video on planet atmospheres, which is done in Unity: kzbin.info/www/bejne/eqnJdpWrod55mbs
@jpsilver35103 жыл бұрын
@@MartinDonald thank you! I have seen it but he doesn't really go in too much depth, as far as i know he only mentions the rsi, but thank you for this video. Im really close to getting it in unity hdrp, just having issues with sampling the depth texture. For some reason the screen position does not get interpolated so only the bottom left corner gets all the depth of the entire depth map. Please do keep on keeping on, im loving your videos. I understood this the first time you explained it.
@thelifeoftheepie76433 жыл бұрын
How did u get the lit side to properly render? In my case the lit side disappears completely when looking at the unlit side and looks like the color/light is only hitting the very top/surface of the atmosphere and not the inside. How can I fix this?
@jpsilver35103 жыл бұрын
I had the same issue when i tried to render the atmosphere with a sphere, you need to use a cube like he said
@jackisgoofingoff55102 жыл бұрын
right, I am trying to understand, just trying...
@JackabeeT2 жыл бұрын
WHY ARE CIRCLES AND SPHERES SO HARD.
@finsflexin2 жыл бұрын
You need some work with your variable names. Nobody’s gonna know what “r”, “y”, “ndc”, “depth” (of what?), and “so”