Portal (the video game) uses a hybrid approach to recursive portals: the first few iterations are drawn using a recursive camera technique (like in your portals), but the initial texture is a scaled and distorted version of the previous frame. The effect looks pretty good, but there are some cases where it breaks down, like when the portals are not at 180 degrees to each other, if they're too close, or if they're drawn at a sharp angle on-screen. It definitely beats having a black texture, though, and looks passable even with only 2 or 3 "real" levels of recursion. It really helps sell the look on low graphics settings, and it's very important in Portal 2's co-op where having player 1's portals + player 2's portals + water reflections + shadows + splitscreen/partnerview means there can be tons and tons of rendering passes. Objects partway through portals use a "clone" approach (also like in your portals). The clone has limited support for physics, and tries to transfer forces applied to it to the real object on the other side of the portal. It doesn't work very well and looks "spongy" if you try to break it, but it at least prevents you from making things intersect and dropping things inside your own hitbox, and works best with simple cubes which is what most of Portal's objects are anyways. There are some physics optimizations: objects close to portals don't collide with anything far from portals, objects far from portals don't collide with any clones, and so on. Oh, and to make the portals appear oval-shaped, it just draws an oval to the stencil buffer and hides the seam with the rim texture and particle system. As far as physics are concerned, the portals are rectangular. (My source for this is a great talk given at some school by Valve graphics and physics programmers, but I can't seem to find it anymore!)
@@SebastianLague That talk is here if you're wondering: ua-cam.com/video/ivyseNMVt-4/v-deo.html&t=3642 And check out my other comment for more info: ua-cam.com/video/cWpFZbjtSQg/v-deo.html&lc=UgwV7y6dKJgF-7S44fJ4AaABAg EDIT: Hmm, seems you can't click the comment link. I think if you right-click and open in new tab it will work, but you might have to pause the video and scroll down.
When ever I get frustrated at work (working on the software engines that run artificial intelligence), I come and listen to Sebastian. He's so calm about coding and debugging that I nominate him the "Bob Ross of Software Development" 😁 Combine that with his self-deprecating, deadpan humor and it's a pure delight watching (and re-watching) these videos.
"The reason for the traveler's unfortunate demise is that this function that detects when an object leaves the portal depends on the internal physics loop which runs on its own fixed timestamp" Me, eating unsalted peanuts and has never coded anything: A rookie mistake
I felt similarly about his implementation of natural selection. Not that I was looking how to do it, but it was something I was planning on simulating myself and now doesn't seem worthwhile since someone else has done it in such a... quality way. I like to feel original or at the very least that I've improved on the system from which I derived my inspiration.
Do you think the guys behind supposedly calm and chill programming channels actual freak out and break shit when they've been stuck on a problem for a long time? Like, he says how he had an issue, so he found an article with the solution, when in reality he tore his hair out searching google for hours until he misclicked on a link that luckily had the solution.
I absolutely do. When you make a video you are editing it & planning out & designing an experience for somebody. You can craft that experience to be whatever you want it to be. It's just like a cute girl who uploads a new profile picture on her facebook. Do you really think she didn't take 50 pictures and fix her hair, and adjust the angle, and do a million steps to make the final result look as good as possible?
@@gblawrence034 I've been kind of numbed to the frustration by now. When I can't figure something out I don't get angry, I instead get lazy and stop working on it. Then I come back to it later on again and again when I feel more motivated.
3:30 It took me a few moments to realize that this was, in fact, not editing, but something you programmed into the game for the sake of visualization Super well done, I learned a lot!
Portal is nowhere near the first game engine to use this technique. But most of the early ones used this to increase performance (yeah, ironic, right? But with the right setup it does the trick). I don't know if there are earlier examples, but the most prominent game using this technique purely for performance reasons is the Descent series. (came out the same year as Doom, yet could do a fully 3d world on a 386) Another prominent example that used it for a mixture of performance and special effects is the Build engine. (Duke Nukem 3D's engine) Given that the Build engine is not a proper 3d engine and has a lot of similar limitations to DOOM, the portal based rendering system is one of the reasons why you can nonetheless do things that are impossible for Doom, such as having a building with multiple levels. The reason this works is because the windows/doors/whatever into each floor are actually portals that take you to a different portion of what is otherwise a 2d map. An interesting limitation of the Build engine caused by it's 2d nature but use of portals is while you can have a multi-storey building with access to different levels, and windows that show all the levels at once... You cannot have two openings directly above one another. All openings to different locations have to be horizontally seperated. This is because while the portals can be at different heights on a wall that gives the impression of there being multiple levels to a building, in reality the entire world is 2d, and a wall section can only have a single portal on it. So while two portals can be at different apparent heights and be horizontally adjacent, you cannot put a portal on top of another portal... It's weird, and fascinating looking at the strange limitations of older games...
"It's seven minutes into the video and you still can't walk through the portals" "Overcome with grief and rage, I began debugging" "I'll cue up some old-timey music so we can sit back and watch the result" This is not only one of your most educational videos, but one of your funniest to date as well. Coding Adventure is my favourite dev series on UA-cam
I personally think foggy portals is a great solution to the recursion problem! Could also add a blur filter at each subsequent iteration to make the end of the recursion less noticeable. Beautiful work anyhow!
@@isaacgejames They're pretty simple actually, and once you understand what they really mean you can do some nice stuff with them. In essence they're literally just a set of 3 numbers. You could use the Vector3 class to store whatever numbers you want. Usually they are used to represent a direction, but also commonly used to represent a position. A direction is really just a position _relative_ to another position.
@@isaacgejames Yeah so to create a direction that points forwards, you'd use 0, 0, 1. That's 0 units on X, 0 units on Y and 1 unit on Z, which means the final location is 1 unit forwards. 0, 0, 2 would also point forwards, as would 0, 0, 6000. The way to picture this is just imagine a point at the centre (so, 0, 0, 0) and a point at your vector (such as 0, 1, 0) and then imagine an arrow pointing from the centre to the vector point.
@@isaacgejames The Godot Game Engine has a nice documentation on how vectors work and what you can do with them. Have a look here: docs.godotengine.org/en/3.2/tutorials/math/vector_math.html
Shaders are not that complicated actually, maybe just a little bit confusing at first Shader cutting out part of the camera view like in the video is very clever, but also very easy to do
Shades can be done with nodes right? Maybe start there. Maybe someone with more expertise can highlight the benefits of using nodes compared to writing code
@@Labiote Here is a course from a game dev professor. I already have it purchased so I can't tell what the current price is. These go on sale for 10 bucks all the time. I have done her other courses and they are amazingly programming rich. www.udemy.com/course/unity-shaders/
"But we have no time for this. We are 7 minutes in the video and still can't walk through portals" (c) I love this man! Each and every tutorial is full of useful stuff, clear explanations and don't waste the viewers' time. I wish all the UA-cam tutorials were so awesome and respectful about the time!
You could add some *magical* distortion instead of the fading out effect . Like water distortion or blur that starts from the second portal and scales up.
that's not an instant solution. you need to come up with a shader that will sufficiently distort image after N iterations. that might be harder than it sounds, and also might turn out to be messy and/or not cheap. besides, how does the fully distorted image look, is it white noise, is it pink noise, is it black or some other pure color? whatever it is, it doesn't sound that much better. if it's about eye-candy, you could practically add a slight distortion effect only to the second iteration and keep the remainder of the solution intact, and arrive at what you proposed, but arguably much cheaper, and in a controlled manner.
@@milanstevic8424 What MTandi proposed was an idea, it sounds like you're trying to put him down for suggesting a possibility. The kinks can be worked out later.
@@milanstevic8424 You're talking as if the portal itself was easy to make. It's fucking obviously the distortion effect would be harder to make than it sounds. Easier said than done, as every god damn coding project goes.
I think the easiest solution would be to just reuse the view from the second to last portal. It's not completely accurate, but probably good enough given it's super small.
@Ben Wager and @Avana I don't get you two. I have argued my position => i.e. I've offered an educated argument against such an idea, and also offered an alternative solution to introduce a visual effect of what he called a *magical* distortion. If you want to be emotional about it, go watch Twilight.
Videos like these are one of the reasons why I constantly keep falling in love with game development. I just discovered your channel, and within 2 minutes, I was subbed. What a well done video!
Amazing! When I was doing my course project on game development, I wanted to implement portals. I researched for many weeks, arriving to the same conclusion as you for the camera movements, clone on teleport and the screen texture cutout, but you went above and beyond in implementing the portal within portals rendering, and the trick of making the portal surface a cube without back-face culling absolutely blew my mind! Thank you for all this great education.
it is awesome indeed. rich in IQ and well investigated so that we can all have a quality discussion and at least some concrete troubleshooting experience from a dev perspective. Seb's channel doesn't hold your hand, but instead grabs you up by the collar.
Using a 3D object on a 2D Screen, to project a 3D object onto a smaller 2D Screen, which is apart of the Original 3D object projected on the 2D Screen, projecting a 2D object that projects a 3D Looking object? *Makes sense to me.*
@@xGOKOPx Then it all is used to light up pixels on a monitor, which emits photons, that then pass through the eye lens, converge on your retina, creating smaller inversed image. Then photons pass through the membrane of photoreceptive cone and rod cells and get absorbed by pigment, making it oscillate. Due to that oscillation pigment falls apart, which triggers chain of chemical reaction, which changes salt concentrations inside the cell. That triggers neurons, which encode image to a smaller format, where edges are compressed. Then that signal is transmitted via repeated sequence of releasing chemicals and conducting electricity, until it finally reaches the image processing part of the brain, which was trained to recognize visual patterns in order to feed information to other brain neurons.
Just my guess: The centre of a cloud moves across a map of perlin noise. The (noise value [above some threshold]) x (proximity to centre of cloud) defines the radii of either: low poly spheres unioned together, or: spheres unioned together with low poly marching cubes algo to create the cloud's surface.
For the recursion problem: The guys from Valve "solved" it by just re-using the rendered texture from a certain point on, e.g. from a depth of 3. They then distort them to make them warp out of frame. This does not look very realistic, but People won't see it if you start re-use at a depth of 5 or so... Depends on the size of the portals and the details in the scene of course.
While I'm only a simple gamer I really enjoy how you show what goes on behind a game mechanic. The most coding I've ever done was visual coding with the Unreal Engine. Following tutorials and messing around with what I learned.
@@thatboredinternetwanderer140 It acts as an "End Line of Code" command to the compiler in most languages. Although a new paragraph could be used (as it is in python), there are some situations where you want something the compiler recognises as a new line without a physical new line (For loops do this in some languages), and other situations where a physical new line splitting code may be problematic (eg. small screens, or zooming in for a presentation, or just splitting a long line of code into the things it does for readability). The semicolon is ANNOYING, I agree, but having something there to detect the end of the line can allow for formatting that isn't possible without it. Sure, as an amateur, its annoying, but its worth it for the proffessionals doing massive coding tasks beyond either of our comprehension.
The fading to black is how mirrors work IRL, so that makes a lot of sense. Edit, for all of you saying "but it's not a mirror." The point is to make be more sensible than "oh it just cuts off at a certain distance." It doesn't even have to fade to black across so many iterations, maybe just the last four fade to black.
@@muuubiee Because of what Seeky Unbounded said. Mirrors are not perfectly reflective, so with every reflection they absorb a tiny bit of light matching their own true color. Which for most happens to be green. (Look through a thick piece of glass at its side) For portals you could probably either do a similar thing in any given color (e.g. based on player team) or simulate the color of air/fog.
Guys If u want to use this in HDRP or URP its really easy. I got working portals in both. In PortalTravelers change line 56 from foreach (var mat in renderer.materials) to foreach (var mat in renderer.sharedMaterials). In MainCamera change line 11 from void OnPreCull to void LateUpdate for URP enable the Post Processing checkbox under each portal camera. (Main camera doesn't matter) for HDPR I did not change anything. * Found this solution on Github but just wanted to share here. *Using 2021.3.15
Brother, you saved me! I spend 2 hour to find out what is wrong with it. I read waay too many doc, and now I know some new method for SRP, HDRP and LWRP... I just wanted to use URP 😭
Awesome... I have been looking into making portals for a few years now, and this is the most complete example and explanation I have found so far dealing with pretty much all the problems you can run into. Except getting light to work through portals... but not sure even Portal got that implemented.
"While I've been writing this, the car's been struggling tremendously to drive over a little rock. 10/10 for effort, though." This kind of thing is what makes your channel fantastic instead of merely great. :)
You are doing a really great job! To make people UNDERSTAND something instead of just showing what you know! One of the best channels I found in these days to keep learning. Keep growing.
I think that could just be done with having cloned lights for if the light is close enough. I dont know if there is a way to check for that but would propally give a really good effect
@@RoboDK7 Simply cloning lights wouldn't work. You still need to block the light so only the light that goes through the portal is rendered. One way would be to have an invisible object around the portal that can block the light and layers or similar to assign lights to specific layers, but then if the portals are close to each other you could still see double lights in some places. It's very tricky. But probably Sebastian would find some transformation matrix or whatever that saves the day 😂
@@alejolab That sounds like a such a nightmare for dynamic portal. You might have to construct some in-between space that contains the geometry and lightsources as clones, and merge the results somehow. But I'm very happy to be proven wrong on that, especially with working code examples :P
This took a lot of troubleshooting for me to work out, but after a several attempts and a lot of troubleshooting I got this to work better than I had ever had portals working before.
I actually have a modded to hell version running. I don"t close it just disable the sound so I can watch videos while eating because it takes like 5 min to start. I was really confused how it re enabled the sound by itself :D
This is the best implementation of portals I've ever seen in unity. Making the "portal" a cube and slicing the 3D object blew my mind when I saw how well you solved some of the technical limitations I'd ran into previously. Simply amazing.
Absolutely amazing watching you chip away at the issue you face when creating something like this , I have been coding information systems for 13 years now , but this is next level
ALL the games I grew up playing had swirly, colorful cloud portals (think Hexen, Heretic) AND the game paused for an eternity while loading the other side of the portal. This video was amazing. Also, I now understand why the early games had swirly clouds instead of a view through the portal. Great video.
I am so thankful for your documentation of your progress. I really wish I knew how to understand the maths behind all the projects you do accomplish. Im just a simple ReactJS web developer and I have absolutely no clue where to even begin to learn any of this. I really want to become a solo game developer and clearly have a long journey ahead of me. Im happy I subbed as there is so much stupefying content on this platform and it's a breath of fresh air to watch this type of content, keep up the great work.
im just making this a comment for whatever fix i find shader fix in the properties section below the _InactiveColour ("Inactive Colour", Color) = (1, 1, 1, 1) just paste in: _MainTex("Base (RGB)", 2D) = "white" { } teleport rotation fix if you walk through a portal and your rotation snaps, thats normal, but likely not wanted. if you copied the project directly from the repo, you shouldn't have this problem, but here's the solution: in your movement script, switch the inheritance to PortalTraveller then paste this function somewhere public override void Teleport(Transform fromPortal, Transform toPortal, Vector3 pos, Quaternion rot) { transform.position = pos; Vector3 eulerRot = rot.eulerAngles; float delta = Mathf.DeltaAngle(rotationY, eulerRot.y); rotationY += delta; transform.eulerAngles = Vector3.up * rotationY; Physics.SyncTransforms(); } if you paste this and do nothing with it, it likely wont work. this is because i might use a different variable name than you the rotationY is probably going to be the only different variable, this variable is for the camera's Mouse X: rotationY += Input.GetAxisRaw("Mouse X") * sensitivity * Time.deltaTime; also, the Physics.SyncTransforms() fixes another problem, which was if you used a character controller, you wouldn't teleport :D
About once every year I rewatch this video, and it makes me so happy that every time I watch it, I understand a little bit more of what's going on in the video. It's hard to notice progress as learning is a rather slow process, but this really made me realize just how much I've learned in the past couple of years. Also, the video is just fantastic!
Just get your AI to interprete what is seen on screen. a simple solution to this is to draw the world in a simplified way for the AI. Example: First person shooter The AI sees pathing decals as a simple green spots that fade away when they reach them, enemies as red boxes (shoot here when visible after x amount of time to simulate reaction time), allies as blue (do not shoot) and the environment as yellow. This can be rendered at a really low resolution, but using the exact same setup as the world render uses. The AI then just needs to be trained (by you or by some learning algorithm, depending on your prefered behavior) to use the camera output to perform desirable actions. Something along the lines of "If green can be seen, move towards green", "if red can be seen, stop and fire your weapon towards red", "if blue can be seen, follow blue" and "else move randomly". This would give you a zomby like AI that can use portals, runs around in groups and, whenever it sees a checkpoint, moves towards it - so it could patrol an area or follow a certain course through a level, but also adapt whenever a portal happens to open infront of them to rethink it's movement and actions.
@@GermanTopGameTV Much simpler without training: Just loop trough the pixels of the image, the AI would receive (with simplified environment) and just check whether the color is seen on it or not. Then do desired action based on these and other factores. Aiming at a specific pixel is also easy calculatable. Or make it move towards until the target color is at the center of the AI's screen, to simulate movement and reaction time
A lot depends on how your AI sees in the first place- if it is raycasting, you can do the same sort of matrix transformation to deflect the rays they cast out when those rays hit a portal. If you are using a pathfinding based solution, you'd want to link up the portals' nodes on the pathfinding graph.
AI site wouldnt be very hard in comparison to all he did for the player to be able to see. The math is simple the hard part is shaders and artifacts etc..
@@GermanTopGameTVnah lol. Even if you could manage to train an NN (which you would absolutely need) to actually do this well, you would have like .4 fps
I love watching random Unity videos with random cool mechanics, cause even though this portal stuff is something that I'm probably not going to implement into the game I'm working on, you actually gave me a perfect solution for an issue I was running into with deciding which way my player should be moving down a zipline when hooking onto the zipline from anywhere that's not either end point!
I come back to this channel often, but I often think Godot is more aligned with Sebastian's vibe. Unity seems like it has more technical support so maybe it's a situation of having less potential road blocks toward ideation. Easier flow state because you avoid running into engine problems. Who knows.
You are an absolute legend and my idol for problem-solving and coding in general. I agree with what have been said previously in some comments here: "You are the Bob Ross of coding."
Apart from this whole video being great and really interesting, I love the end sequence too. The way the blocks fall through the first portal, with the second one angled so they go through the first again, but at a different angle so they exit the second at just the right angle so they fall back through the second out of the first and then, my favorite bit, the yellow one hits the tree with a gentle thud. Absolutely beautiful! Did that take long to set up, or just happy accident?
I love the approach he takes to learn some of these things, going so far to demonstrate using an entire scrap of a scene to show us, the viewers, a better idea before actually showing it implemented. It works great to learn from and it works great to teach from. Always looking forward to the next adventure from him. It's great.
Omg u might be the most hard working dude on yt learns blender and unity how to code and write algorithms to visuallize the code and edit the video all with commentary. Like wow that’s a quick sub
something you could try with the recursive portals is render closest to farthest instead of farthest to closest, and not draw over already drawn pixels, similar to how old software rendering worked if I'm not mistaken, might be faster and/or help with the problem of what to render at the end
An idea that I've seen in other implementations of the portal effect is the scaling of objects. If Object X goes into Portal A, and Portal B is smaller than Portal A, then Object X will pop out smaller relative to the difference in size between the portals. Could probably also be implemented in reverse. Feel free to give this a shot. And don't forget to implement preservation of velocity, if you haven't already. "Fling into space."
i have mad respect for coders like yall. like i cant even figure out simple math (like 13 x 3) without a piece of paper, and yall can make compelx algrothimz that make portals work??? your so cool.
I love watching things like this but I never feel like i personally have the time or interest to learn programming this deep. Which is a shame, because I would love to work on projects like this.
im a software engineer and this is nowhere close to what i do. "programming" and computer science is wayyyy bigger than learning to code. if you find the little piece you like, youll never quit!
You can play around doing projects like this without deep knowledge of programming. You will need to learn maths and behavior of stuff you want to create, but your programming knowledge will affect how performant created thing will work, or how hard it will be to expand on already created. The main fun of game dev is doing random stuff because you have sudden thought "How will this look like?" It's also worth noting that Unity is very beginner-friendly, and if you don't like code, you can try UE4, but it has scarce documentation and no so friendly, but prototyping in blueprints is faster than in Unity
the portal game tutorial was the first of your videos i ever watched, and it at the very least got me to think about math and projection in 3D space as a 9 or 10 year old. very fond memories of my early days with unity :) you are an absolute master with your shaders and procedural mesh stuff. such an inspiration, i love the nature of your work.
This channel is, frankly, too good relative to the number of views it gets. Something is clearly wrong with the world. I'd love to see you cover non-Euclidean space rendering (à la Stanley's Parable) where you can walk down an entire hallway/region where space is compressed or expanded. But it seems like it'd require ray tracing to get the visuals to behave properly. Also, I'd love to know how proper ray-tracing would account for portals.
I mean, most of that is probably this. If you want an endless hallway, stick a 'portal' on one end that's the size of the hallway, and done. When you want to let them out, get rid of that portal
Can you answer the age old question of what happens when a moving portal falls onto an object? Does the object go flying out the other side with the same velocity of the moving portal, or does it simply plop out the other side?
The answer is "kinda" simple: there is no definite answer, because of relativity. Is the teleporting process happening in portal space, or in "world space"? Happening in portal space means, that the object just will keep its velocity (negative falling velocity) relatively to the portal, while happening in world space means, that it will keep its velocity (0) relative to the world. If the two portal sides are facing in the same direction, this will be the same result for both cases.
Answer: depends on your implementation, whatever you want to happen happens, or to be more accurate whatever you instruct the computer to do , it'll do.
When portal is moving objects around it don't gain velocity with it, so I think it would just pop on the other side It's kinda like dropping hula hoop on it I think
There is no reason to think the object would gain the portals velocity. Even though this is complete science fiction, it would be safe to assume you would just ''plop" out from the other side.
Not necessarily. If we consider a universe with just an object and a portal, the object having velocity would be indistinguishable from the portal having that velocity. So, if this were happening in the real world, the objects end velocity would be its current velocity - the portals velocity. However, if I'm understanding this specific implementation of portals, it doesn't care about the portals velocity So the object will simply "plop" out the other side.
This is awesome! If you take inspiration from mirrors they are actually slightly green. If you add some slight colourisation for the portal for an effect it could hide the recursion limit.
"Filled with grief and rage, I began debugging." - Every game developer ever
That is such a big mood
*Every -game- developer ever
The question always comes from
Why it doesn't work ?
To
How it possibly have worked?
motbus i relate to this!
yes this is me
this is so relatable :)
Portal (the video game) uses a hybrid approach to recursive portals: the first few iterations are drawn using a recursive camera technique (like in your portals), but the initial texture is a scaled and distorted version of the previous frame. The effect looks pretty good, but there are some cases where it breaks down, like when the portals are not at 180 degrees to each other, if they're too close, or if they're drawn at a sharp angle on-screen. It definitely beats having a black texture, though, and looks passable even with only 2 or 3 "real" levels of recursion. It really helps sell the look on low graphics settings, and it's very important in Portal 2's co-op where having player 1's portals + player 2's portals + water reflections + shadows + splitscreen/partnerview means there can be tons and tons of rendering passes.
Objects partway through portals use a "clone" approach (also like in your portals). The clone has limited support for physics, and tries to transfer forces applied to it to the real object on the other side of the portal. It doesn't work very well and looks "spongy" if you try to break it, but it at least prevents you from making things intersect and dropping things inside your own hitbox, and works best with simple cubes which is what most of Portal's objects are anyways. There are some physics optimizations: objects close to portals don't collide with anything far from portals, objects far from portals don't collide with any clones, and so on.
Oh, and to make the portals appear oval-shaped, it just draws an oval to the stencil buffer and hides the seam with the rim texture and particle system. As far as physics are concerned, the portals are rectangular.
(My source for this is a great talk given at some school by Valve graphics and physics programmers, but I can't seem to find it anymore!)
That's really interesting thanks! I was wondering what their approach was. Will have to look about for that talk.
@@SebastianLague That talk is here if you're wondering: ua-cam.com/video/ivyseNMVt-4/v-deo.html&t=3642 And check out my other comment for more info: ua-cam.com/video/cWpFZbjtSQg/v-deo.html&lc=UgwV7y6dKJgF-7S44fJ4AaABAg
EDIT: Hmm, seems you can't click the comment link. I think if you right-click and open in new tab it will work, but you might have to pause the video and scroll down.
@@clonkex Awesome, thanks!
This explains how the math challenges actually influenced the game design. That's stunning
@@SebastianLague Another idea is to lower the resolution of the cameras with each iteration into it.
Whoooaaa that was amazing :o
He is in a "league of his on" right ?
Get it ? Cuz his name is sebastian lague...
Hi
yooooooo dani
ngl that portals looking kinda THICC
Why is this comment underrated
When ever I get frustrated at work (working on the software engines that run artificial intelligence), I come and listen to Sebastian. He's so calm about coding and debugging that I nominate him the "Bob Ross of Software Development" 😁 Combine that with his self-deprecating, deadpan humor and it's a pure delight watching (and re-watching) these videos.
sebastian ross
I second the nomination
Good bro
@@rootabeta9015 I third the nomination
@@Enderia2 May I fourth?
I love coding videos for this reason:
"I also got sidetracked and started drawing clouds."
"No time. 7 min in. gotta get to it."
"The reason for the traveler's unfortunate demise is that this function that detects when an object leaves the portal depends on the internal physics loop which runs on its own fixed timestamp"
Me, eating unsalted peanuts and has never coded anything: A rookie mistake
@TF Tingle Thanks, but you forgot to fly away, Captain!
This is the level of detail I come to the comments section for.
Mann... you have no idea some of the wonky bugs I've had due to those being different loops.
"The reason for the traveler's unfortunate demise is this weird entity called "Dominus Gaul" spawned in and started wreaking havoc on its code"
Why did this terrible comment get 1k likes
I hate that you made this video after I spent the last four weeks looking how to do it.
Also love you thanks.
oh dude i know the feeling
I felt similarly about his implementation of natural selection. Not that I was looking how to do it, but it was something I was planning on simulating myself and now doesn't seem worthwhile since someone else has done it in such a... quality way. I like to feel original or at the very least that I've improved on the system from which I derived my inspiration.
I know right... My implementation looks very bad after I've seen this
@@BlakeGillman Well maybe you could find a way to do something even more interesting with it as a base!
@Marcello Menezes
There’s also this> ua-cam.com/video/_SmPR5mvH7w/v-deo.html
Video
"The code for this is actually quite simple."
Proceeds to execute rocket science.
Well that would certainly explain the KSP music in the background :P
Rocket science is also pretty simple.
It's the rocket *engineering* that's the difficult part.
@@Mafia200100 modestly, I'm a KSP player.
Hoo-ray
@@Mafia200100 Rocket Engineering is quite simple, it's the maths thats complicated.
Do you think the guys behind supposedly calm and chill programming channels actual freak out and break shit when they've been stuck on a problem for a long time? Like, he says how he had an issue, so he found an article with the solution, when in reality he tore his hair out searching google for hours until he misclicked on a link that luckily had the solution.
His voice is far too soothing. I refuse to imagine this possibility.
I think the youtuber 'Code Bullet' is a perfect example of this happening
I absolutely do. When you make a video you are editing it & planning out & designing an experience for somebody.
You can craft that experience to be whatever you want it to be.
It's just like a cute girl who uploads a new profile picture on her facebook. Do you really think she didn't take 50 pictures and fix her hair, and adjust the angle, and do a million steps to make the final result look as good as possible?
I get disproportionately mad when I can’t figure something out
@@gblawrence034 I've been kind of numbed to the frustration by now. When I can't figure something out I don't get angry, I instead get lazy and stop working on it. Then I come back to it later on again and again when I feel more motivated.
3:30 It took me a few moments to realize that this was, in fact, not editing, but something you programmed into the game for the sake of visualization
Super well done, I learned a lot!
Yeah, but he allready coded it, no biggie to display the maths on the screen. Cool visualization anyways :)
Indeed, it's extremely helpful
He is a genius
It's such a cool edit trick
This just proved me how insane valve was when they made portal
Funny enough, valve’s implementation was completely different!
*how insane a bunch of college students were when they made portal ;)
@@ducky8075 It was actually extremely similar.
@@localatticus4748 The difference is that Valve used stencil buffers for their portals, instead of render targets.
Portal is nowhere near the first game engine to use this technique.
But most of the early ones used this to increase performance (yeah, ironic, right? But with the right setup it does the trick).
I don't know if there are earlier examples, but the most prominent game using this technique purely for performance reasons is the Descent series. (came out the same year as Doom, yet could do a fully 3d world on a 386)
Another prominent example that used it for a mixture of performance and special effects is the Build engine. (Duke Nukem 3D's engine)
Given that the Build engine is not a proper 3d engine and has a lot of similar limitations to DOOM, the portal based rendering system is one of the reasons why you can nonetheless do things that are impossible for Doom, such as having a building with multiple levels.
The reason this works is because the windows/doors/whatever into each floor are actually portals that take you to a different portion of what is otherwise a 2d map.
An interesting limitation of the Build engine caused by it's 2d nature but use of portals is while you can have a multi-storey building with access to different levels, and windows that show all the levels at once...
You cannot have two openings directly above one another.
All openings to different locations have to be horizontally seperated.
This is because while the portals can be at different heights on a wall that gives the impression of there being multiple levels to a building, in reality the entire world is 2d, and a wall section can only have a single portal on it.
So while two portals can be at different apparent heights and be horizontally adjacent, you cannot put a portal on top of another portal...
It's weird, and fascinating looking at the strange limitations of older games...
"It's seven minutes into the video and you still can't walk through the portals"
"Overcome with grief and rage, I began debugging"
"I'll cue up some old-timey music so we can sit back and watch the result"
This is not only one of your most educational videos, but one of your funniest to date as well. Coding Adventure is my favourite dev series on UA-cam
I personally think foggy portals is a great solution to the recursion problem! Could also add a blur filter at each subsequent iteration to make the end of the recursion less noticeable. Beautiful work anyhow!
the portal games detect 3+ portals and just start repeating the already rendered textures, as an idea
@@pixeldustinteractive smart!
It could also be used to get away with rendering the back portals at a lower resolution
@@pixeldustinteractive portal 1 has a setting for how many to do, that goes up to nine. How does that interact with this?
@@romajimamulo isnt that just the cutoff for when its a texture of last frame?
"I got a bit side tracked by making some low poly clouds"
There is something lowkey hilarious about everything you say Seb.
"The code for this pretty simple..."
Me: Sees Vector4
Vector4 is just 4 independent numbers.
It's how those 4 numbers _interact_ with another 4 numbers that makes it complicated. ;-)
Wach @brackes
@@mateineli209 what
@@bogiesmigforl1 He means @Brackeys i think
@@thatboredinternetwanderer140 i mean he
"The maths went way over my head"
Me: nods along
10 hours?
Yea how 10 hours ago? Early access of some sort?
@@BigBean916 Patreon users get early access to new video releases I think.
Your comment is 11 hours in past somehow.
@@me.unpredictable280 all comments are from the past
"The maths went way over my head"
Me, seeing simple vector multiplication.
Can relate.
Relatable
@@isaacgejames They're pretty simple actually, and once you understand what they really mean you can do some nice stuff with them. In essence they're literally just a set of 3 numbers. You could use the Vector3 class to store whatever numbers you want. Usually they are used to represent a direction, but also commonly used to represent a position. A direction is really just a position _relative_ to another position.
@@isaacgejames Yeah so to create a direction that points forwards, you'd use 0, 0, 1. That's 0 units on X, 0 units on Y and 1 unit on Z, which means the final location is 1 unit forwards. 0, 0, 2 would also point forwards, as would 0, 0, 6000. The way to picture this is just imagine a point at the centre (so, 0, 0, 0) and a point at your vector (such as 0, 1, 0) and then imagine an arrow pointing from the centre to the vector point.
@@isaacgejames The Godot Game Engine has a nice documentation on how vectors work and what you can do with them. Have a look here:
docs.godotengine.org/en/3.2/tutorials/math/vector_math.html
Insane work put into this. Writing shaders scare me but this was so great.
Shaders are not that complicated actually, maybe just a little bit confusing at first
Shader cutting out part of the camera view like in the video is very clever, but also very easy to do
@@r033cx I'm really interested by learning stuff about shaders. Where should I start digging ?
Shades can be done with nodes right? Maybe start there.
Maybe someone with more expertise can highlight the benefits of using nodes compared to writing code
@@Labiote Here is a course from a game dev professor. I already have it purchased so I can't tell what the current price is. These go on sale for 10 bucks all the time. I have done her other courses and they are amazingly programming rich. www.udemy.com/course/unity-shaders/
"But we have no time for this. We are 7 minutes in the video and still can't walk through portals" (c)
I love this man! Each and every tutorial is full of useful stuff, clear explanations and don't waste the viewers' time. I wish all the UA-cam tutorials were so awesome and respectful about the time!
god bless the internet
Siege Tales! Wow you have great taste in videos!
Never thought I'd be seeing you here! Love your videos dude or dudette!
Siege Tales you're literally in the most unexpected places I swear dude
Ikr
Ew
7:10 those are some nice clouds
You could add some *magical* distortion instead of the fading out effect .
Like water distortion or blur that starts from the second portal and scales up.
that's not an instant solution. you need to come up with a shader that will sufficiently distort image after N iterations. that might be harder than it sounds, and also might turn out to be messy and/or not cheap. besides, how does the fully distorted image look, is it white noise, is it pink noise, is it black or some other pure color? whatever it is, it doesn't sound that much better. if it's about eye-candy, you could practically add a slight distortion effect only to the second iteration and keep the remainder of the solution intact, and arrive at what you proposed, but arguably much cheaper, and in a controlled manner.
@@milanstevic8424 What MTandi proposed was an idea, it sounds like you're trying to put him down for suggesting a possibility. The kinks can be worked out later.
@@milanstevic8424 You're talking as if the portal itself was easy to make. It's fucking obviously the distortion effect would be harder to make than it sounds. Easier said than done, as every god damn coding project goes.
I think the easiest solution would be to just reuse the view from the second to last portal. It's not completely accurate, but probably good enough given it's super small.
@Ben Wager and @Avana
I don't get you two.
I have argued my position => i.e. I've offered an educated argument against such an idea, and also offered an alternative solution to introduce a visual effect of what he called a *magical* distortion.
If you want to be emotional about it, go watch Twilight.
This was a triumph!
I'm making a note here:
Huge success!
It's hard to overstate my satisfaction!
Aperture Science:
We do what we must, because we can.
Except the ones who are dead.
But there's no sense crying over every mistake
I understand maybe 6% of each coding adventure video and just keep coming back to remind myself how much more I still have to learn
Videos like these are one of the reasons why I constantly keep falling in love with game development. I just discovered your channel, and within 2 minutes, I was subbed. What a well done video!
Amazing! When I was doing my course project on game development, I wanted to implement portals. I researched for many weeks, arriving to the same conclusion as you for the camera movements, clone on teleport and the screen texture cutout, but you went above and beyond in implementing the portal within portals rendering, and the trick of making the portal surface a cube without back-face culling absolutely blew my mind! Thank you for all this great education.
it is awesome indeed. rich in IQ and well investigated so that we can all have a quality discussion and at least some concrete troubleshooting experience from a dev perspective. Seb's channel doesn't hold your hand, but instead grabs you up by the collar.
Using a 3D object on a 2D Screen, to project a 3D object onto a smaller 2D Screen, which is apart of the Original 3D object projected on the 2D Screen, projecting a 2D object that projects a 3D Looking object?
*Makes sense to me.*
All that "rendered" on your 2D eyesight plane
@@xGOKOPx Then it all is used to light up pixels on a monitor, which emits photons, that then pass through the eye lens, converge on your retina, creating smaller inversed image. Then photons pass through the membrane of photoreceptive cone and rod cells and get absorbed by pigment, making it oscillate. Due to that oscillation pigment falls apart, which triggers chain of chemical reaction, which changes salt concentrations inside the cell. That triggers neurons, which encode image to a smaller format, where edges are compressed. Then that signal is transmitted via repeated sequence of releasing chemicals and conducting electricity, until it finally reaches the image processing part of the brain, which was trained to recognize visual patterns in order to feed information to other brain neurons.
Pretty sure he mentioned somewhere in the video he made a 4d plane
@@doeverything2615 literally
The editing on this video is phenomenal
absolutely enjoyed everysingle part of this video
I honestly want you to make a library out of this, so nobody has to repeat this painful endeavor.
That would be really cool
CodyCantEatThis used this code, too! So...
I know you have a Coding Adventure: Clouds, but could you post a tutorial on how you did those Low Poly ones? They're beautiful
Just my guess:
The centre of a cloud moves across a map of perlin noise.
The (noise value [above some threshold]) x (proximity to centre of cloud) defines the radii of either:
low poly spheres unioned together,
or: spheres unioned together with low poly marching cubes algo to create the cloud's surface.
I lost my mind at the model cutoff , you go way beyond ! Cheers !
For the recursion problem:
The guys from Valve "solved" it by just re-using the rendered texture from a certain point on, e.g. from a depth of 3. They then distort them to make them warp out of frame. This does not look very realistic, but People won't see it if you start re-use at a depth of 5 or so... Depends on the size of the portals and the details in the scene of course.
While I'm only a simple gamer I really enjoy how you show what goes on behind a game mechanic.
The most coding I've ever done was visual coding with the Unreal Engine. Following tutorials and messing around with what I learned.
this guy is a legend in mathematics and programming, super inspiring for everyone such as me
Sebastian: *coding 4D planes*
Me: *getting errors coding Hello World*
Gotta start from somewhere
lemme guess, ; ?
@@CodingCorvus why is the semicolon necessary
@@thatboredinternetwanderer140 It acts as an "End Line of Code" command to the compiler in most languages. Although a new paragraph could be used (as it is in python), there are some situations where you want something the compiler recognises as a new line without a physical new line (For loops do this in some languages), and other situations where a physical new line splitting code may be problematic (eg. small screens, or zooming in for a presentation, or just splitting a long line of code into the things it does for readability).
The semicolon is ANNOYING, I agree, but having something there to detect the end of the line can allow for formatting that isn't possible without it. Sure, as an amateur, its annoying, but its worth it for the proffessionals doing massive coding tasks beyond either of our comprehension.
@@samfriend3675 yeah i know
The fading to black is how mirrors work IRL, so that makes a lot of sense.
Edit, for all of you saying "but it's not a mirror."
The point is to make be more sensible than "oh it just cuts off at a certain distance." It doesn't even have to fade to black across so many iterations, maybe just the last four fade to black.
well mirrors don't perfectly reflect the light so they eat up the energy, proper portal wouldn't eat it up so it wouldn't lose any light
fading to greenish black makes more sense
@@hamhampangpang_customer Because of red shifting?
@@muuubiee Because of what Seeky Unbounded said. Mirrors are not perfectly reflective, so with every reflection they absorb a tiny bit of light matching their own true color. Which for most happens to be green. (Look through a thick piece of glass at its side)
For portals you could probably either do a similar thing in any given color (e.g. based on player team) or simulate the color of air/fog.
It's not a mirror though.
Guys If u want to use this in HDRP or URP its really easy. I got working portals in both.
In PortalTravelers change line 56 from foreach (var mat in renderer.materials) to foreach (var mat in renderer.sharedMaterials).
In MainCamera change line 11 from void OnPreCull to void LateUpdate
for URP enable the Post Processing checkbox under each portal camera. (Main camera doesn't matter)
for HDPR I did not change anything.
* Found this solution on Github but just wanted to share here.
*Using 2021.3.15
Thanks a lot man ! I was going to quit haha
Brother, you saved me! I spend 2 hour to find out what is wrong with it. I read waay too many doc, and now I know some new method for SRP, HDRP and LWRP... I just wanted to use URP 😭
Awesome... I have been looking into making portals for a few years now, and this is the most complete example and explanation I have found so far dealing with pretty much all the problems you can run into.
Except getting light to work through portals... but not sure even Portal got that implemented.
This is by far the most comprehensive portal implementation I have seen. An area of improvement would be lighting through portals. Very nice work!
"While I've been writing this, the car's been struggling tremendously to drive over a little rock. 10/10 for effort, though."
This kind of thing is what makes your channel fantastic instead of merely great. :)
"Alleviate the GPUs suffering...."
Chuck that bad boy into even more complex math solutions.
Yeah, alleviate the gpu so the cpu can suffer xD To be fair, that's what the cpu is for anyways :)
6:20 KSP music then you acheve space)))))) So many memories.......
You are doing a really great job! To make people UNDERSTAND something instead of just showing what you know! One of the best channels I found in these days to keep learning. Keep growing.
There „camera box“ absolutely blew my mind
Thank you for the tidbit about `w`, I haven't seen such a casual / clear presentation of the mechanics presented anywhere else.
Still not perfect, the hardest part remains : lighting. Let light go through portals
As the video progressed I assumed he would get to this eventually. Those are great portals anyway
I think that could just be done with having cloned lights for if the light is close enough. I dont know if there is a way to check for that but would propally give a really good effect
yeah I would love to see an episode on lighting and physics through portals!
@@RoboDK7 Simply cloning lights wouldn't work. You still need to block the light so only the light that goes through the portal is rendered. One way would be to have an invisible object around the portal that can block the light and layers or similar to assign lights to specific layers, but then if the portals are close to each other you could still see double lights in some places. It's very tricky.
But probably Sebastian would find some transformation matrix or whatever that saves the day 😂
@@alejolab That sounds like a such a nightmare for dynamic portal. You might have to construct some in-between space that contains the geometry and lightsources as clones, and merge the results somehow.
But I'm very happy to be proven wrong on that, especially with working code examples :P
This is amazing! I’ve seen many people code their own portals, but this is by far the best one I’ve seen!
Aperture Science's computing department is really going above and beyond
This took a lot of troubleshooting for me to work out, but after a several attempts and a lot of troubleshooting I got this to work better than I had ever had portals working before.
Still good work, even four years later
Almost thought I had KSP open in the background >___>
Also, relative velocity with portals could be fun.
same lol
I was about to ask what the music at 6:30 was, I knew I recognised it from a game but couldn't place which one.
I actually have a modded to hell version running. I don"t close it just disable the sound so I can watch videos while eating because it takes like 5 min to start. I was really confused how it re enabled the sound by itself :D
This is the best implementation of portals I've ever seen in unity. Making the "portal" a cube and slicing the 3D object blew my mind when I saw how well you solved some of the technical limitations I'd ran into previously.
Simply amazing.
We are blessed with this video
Absolutely amazing watching you chip away at the issue you face when creating something like this , I have been coding information systems for 13 years now , but this is next level
ALL the games I grew up playing had swirly, colorful cloud portals (think Hexen, Heretic) AND the game paused for an eternity while loading the other side of the portal. This video was amazing. Also, I now understand why the early games had swirly clouds instead of a view through the portal. Great video.
11:10 imagine a game that's only shadows
like that would be really cool
I am so thankful for your documentation of your progress. I really wish I knew how to understand the maths behind all the projects you do accomplish. Im just a simple ReactJS web developer and I have absolutely no clue where to even begin to learn any of this. I really want to become a solo game developer and clearly have a long journey ahead of me. Im happy I subbed as there is so much stupefying content on this platform and it's a breath of fresh air to watch this type of content, keep up the great work.
How's it going?
When you think when he explains stuff with animations and you see that he actually coded it to explain
The fact that you share all your project files for free is awesome.... Thanks man.
Thanks for walking us through all the issues a seemingly "simple" portal throws at one. I enjoyed it very much.
That old automobile casually rolling off the cliff with the classy relaxing oldtimey music in the background... Lmao
im just making this a comment for whatever fix i find
shader fix
in the properties section below the
_InactiveColour ("Inactive Colour", Color) = (1, 1, 1, 1)
just paste in:
_MainTex("Base (RGB)", 2D) = "white" { }
teleport rotation fix
if you walk through a portal and your rotation snaps, thats normal, but likely not wanted.
if you copied the project directly from the repo, you shouldn't have this problem, but here's the solution:
in your movement script, switch the inheritance to PortalTraveller
then paste this function somewhere
public override void Teleport(Transform fromPortal, Transform toPortal, Vector3 pos, Quaternion rot) {
transform.position = pos;
Vector3 eulerRot = rot.eulerAngles;
float delta = Mathf.DeltaAngle(rotationY, eulerRot.y);
rotationY += delta;
transform.eulerAngles = Vector3.up * rotationY;
Physics.SyncTransforms();
}
if you paste this and do nothing with it, it likely wont work.
this is because i might use a different variable name than you
the rotationY is probably going to be the only different variable, this variable is for the camera's Mouse X:
rotationY += Input.GetAxisRaw("Mouse X") * sensitivity * Time.deltaTime;
also, the Physics.SyncTransforms() fixes another problem, which was if you used a character controller, you wouldn't teleport
:D
Now you're thinking with portals.
Took me longer than I expected to find this comment, but at least *somebody* posted it
About once every year I rewatch this video, and it makes me so happy that every time I watch it, I understand a little bit more of what's going on in the video. It's hard to notice progress as learning is a rather slow process, but this really made me realize just how much I've learned in the past couple of years. Also, the video is just fantastic!
You're a mad lad.
Thank you for displaying your journey for each coding adventure.
It's really interesting work.
I wonder how you would solve the problem of the possibility of AI seeing through the portal. Nevertheless, thanks for the great video!
Just get your AI to interprete what is seen on screen. a simple solution to this is to draw the world in a simplified way for the AI.
Example: First person shooter
The AI sees pathing decals as a simple green spots that fade away when they reach them, enemies as red boxes (shoot here when visible after x amount of time to simulate reaction time), allies as blue (do not shoot) and the environment as yellow. This can be rendered at a really low resolution, but using the exact same setup as the world render uses. The AI then just needs to be trained (by you or by some learning algorithm, depending on your prefered behavior) to use the camera output to perform desirable actions. Something along the lines of "If green can be seen, move towards green", "if red can be seen, stop and fire your weapon towards red", "if blue can be seen, follow blue" and "else move randomly". This would give you a zomby like AI that can use portals, runs around in groups and, whenever it sees a checkpoint, moves towards it - so it could patrol an area or follow a certain course through a level, but also adapt whenever a portal happens to open infront of them to rethink it's movement and actions.
@@GermanTopGameTV Much simpler without training: Just loop trough the pixels of the image, the AI would receive (with simplified environment) and just check whether the color is seen on it or not. Then do desired action based on these and other factores. Aiming at a specific pixel is also easy calculatable. Or make it move towards until the target color is at the center of the AI's screen, to simulate movement and reaction time
A lot depends on how your AI sees in the first place- if it is raycasting, you can do the same sort of matrix transformation to deflect the rays they cast out when those rays hit a portal. If you are using a pathfinding based solution, you'd want to link up the portals' nodes on the pathfinding graph.
AI site wouldnt be very hard in comparison to all he did for the player to be able to see. The math is simple the hard part is shaders and artifacts etc..
@@GermanTopGameTVnah lol. Even if you could manage to train an NN (which you would absolutely need) to actually do this well, you would have like .4 fps
I always love seeing these in my subbox, great stuff man!
Valve: our Portal series was really hard to develop and unique!
Sebastian: hold my adventure.
Valve, actually: we hired like 10/20 college students and they made portal so we threw 40 people at portal 2
Sebastian, you're hands down the best Unity resource on UA-cam. Keep doing what you're doing!
I love watching random Unity videos with random cool mechanics, cause even though this portal stuff is something that I'm probably not going to implement into the game I'm working on, you actually gave me a perfect solution for an issue I was running into with deciding which way my player should be moving down a zipline when hooking onto the zipline from anywhere that's not either end point!
You should do a Shader programing tutorial Series!
I come back to this channel often, but I often think Godot is more aligned with Sebastian's vibe. Unity seems like it has more technical support so maybe it's a situation of having less potential road blocks toward ideation. Easier flow state because you avoid running into engine problems. Who knows.
I wonder how he's going to add this concept to his solar system project...
Wait. WORMHOLES!
quantum tunnels
You are an absolute legend and my idol for problem-solving and coding in general.
I agree with what have been said previously in some comments here: "You are the Bob Ross of coding."
I've been using unity for 4 years and this guy is still way ahead of me.
Apart from this whole video being great and really interesting, I love the end sequence too.
The way the blocks fall through the first portal, with the second one angled so they go through the first again, but at a different angle so they exit the second at just the right angle so they fall back through the second out of the first and then, my favorite bit, the yellow one hits the tree with a gentle thud. Absolutely beautiful!
Did that take long to set up, or just happy accident?
My reaction when i see a new coding adventure: *screams*, "Wow another one!"
I love the approach he takes to learn some of these things, going so far to demonstrate using an entire scrap of a scene to show us, the viewers, a better idea before actually showing it implemented. It works great to learn from and it works great to teach from. Always looking forward to the next adventure from him. It's great.
Omg u might be the most hard working dude on yt learns blender and unity how to code and write algorithms to visuallize the code and edit the video all with commentary. Like wow that’s a quick sub
The music for this video is set up like a horror movie, love it.
something you could try with the recursive portals is render closest to farthest instead of farthest to closest, and not draw over already drawn pixels, similar to how old software rendering worked if I'm not mistaken, might be faster and/or help with the problem of what to render at the end
I just felt completely stupid after watching your programming skills.
didnt we all ?
Isn't this the case in every video?
DeGandalf isn’t that to point to make us feel that way ?
What's left out is the hours involved in reaching the next iteration
I mean... who didn't?
15:47 GLaDOS voice from somewhere in the Room: "Now you're thinking with portals"
Coding Adventure: Aperture Science Handheld Portal Device
Wow, those 16 minutes were like watching Bob Ross of programming, pure joy and beauty. Thanks for that video, I've enjoyed it a lot!
This blows my mind. Explained like it’s so simple. Great effect.
An idea that I've seen in other implementations of the portal effect is the scaling of objects.
If Object X goes into Portal A, and Portal B is smaller than Portal A, then Object X will pop out smaller relative to the difference in size between the portals.
Could probably also be implemented in reverse.
Feel free to give this a shot.
And don't forget to implement preservation of velocity, if you haven't already.
"Fling into space."
Not exactly the same but reminds me of tiny huge island in Mario 64
I am so happy that I stumbled upon you, now I can try to reverse engineer it
"wait, did I open ksp in the background on accident?" ... "oh, same royalty free music. Got it."
i have mad respect for coders like yall. like i cant even figure out simple math (like 13 x 3) without a piece of paper, and yall can make compelx algrothimz that make portals work??? your so cool.
I love how simple and straight forward this guys work is. Nice job sticking with the KISS method!
Looked at the description and said it in GLaDOS' voice "Experimenting with portals, for science (you monster)"
same lol
6:08 I just played ksp and went to close it, and was really confused when it wasn't open. Then I realized background music is a thing
I love watching things like this but I never feel like i personally have the time or interest to learn programming this deep. Which is a shame, because I would love to work on projects like this.
im a software engineer and this is nowhere close to what i do. "programming" and computer science is wayyyy bigger than learning to code. if you find the little piece you like, youll never quit!
You can try it will never hurt
You can play around doing projects like this without deep knowledge of programming. You will need to learn maths and behavior of stuff you want to create, but your programming knowledge will affect how performant created thing will work, or how hard it will be to expand on already created.
The main fun of game dev is doing random stuff because you have sudden thought "How will this look like?"
It's also worth noting that Unity is very beginner-friendly, and if you don't like code, you can try UE4, but it has scarce documentation and no so friendly, but prototyping in blueprints is faster than in Unity
I love programming and dame design, but I just don't think I have the time to learn unity as deep as I'd want to.
the portal game tutorial was the first of your videos i ever watched, and it at the very least got me to think about math and projection in 3D space as a 9 or 10 year old. very fond memories of my early days with unity :) you are an absolute master with your shaders and procedural mesh stuff. such an inspiration, i love the nature of your work.
Thank you very much Sebastian,another step closer to the vr holowdeck.
Welcome to aperture science
This channel is, frankly, too good relative to the number of views it gets. Something is clearly wrong with the world.
I'd love to see you cover non-Euclidean space rendering (à la Stanley's Parable) where you can walk down an entire hallway/region where space is compressed or expanded. But it seems like it'd require ray tracing to get the visuals to behave properly. Also, I'd love to know how proper ray-tracing would account for portals.
I opine!
I mean, most of that is probably this. If you want an endless hallway, stick a 'portal' on one end that's the size of the hallway, and done. When you want to let them out, get rid of that portal
Can you answer the age old question of what happens when a moving portal falls onto an object? Does the object go flying out the other side with the same velocity of the moving portal, or does it simply plop out the other side?
The answer is "kinda" simple: there is no definite answer, because of relativity.
Is the teleporting process happening in portal space, or in "world space"?
Happening in portal space means, that the object just will keep its velocity (negative falling velocity) relatively to the portal, while happening in world space means, that it will keep its velocity (0) relative to the world.
If the two portal sides are facing in the same direction, this will be the same result for both cases.
Answer: depends on your implementation, whatever you want to happen happens, or to be more accurate whatever you instruct the computer to do , it'll do.
When portal is moving objects around it don't gain velocity with it, so I think it would just pop on the other side
It's kinda like dropping hula hoop on it I think
There is no reason to think the object would gain the portals velocity. Even though this is complete science fiction, it would be safe to assume you would just ''plop" out from the other side.
Not necessarily. If we consider a universe with just an object and a portal, the object having velocity would be indistinguishable from the portal having that velocity. So, if this were happening in the real world, the objects end velocity would be its current velocity - the portals velocity. However, if I'm understanding this specific implementation of portals, it doesn't care about the portals velocity So the object will simply "plop" out the other side.
This is awesome!
If you take inspiration from mirrors they are actually slightly green. If you add some slight colourisation for the portal for an effect it could hide the recursion limit.
The skills behind no matter the math or programming skills, are astoundingly unreal. Frickin amazing stuff.