How were the portals in Portal created? | Bitwise

แชร์
ฝัง
  • เผยแพร่เมื่อ 28 พ.ย. 2024

ความคิดเห็น • 1.5K

  • @DigiDigger
    @DigiDigger  5 ปีที่แล้ว +6174

    Wow, what happened? Two years after I stopped posting the youtube algorithm comes along and now this! :D
    I guess it's time to start making videos again! Thank you all for the kind comments!
    Since 2017, this channel has since been sort of an abandoned project of mine. I can't lie.... that really makes me want to make new content.

    • @ward7313
      @ward7313 5 ปีที่แล้ว +208

      The video is extremely well made, you explained something really complicated in an easy and exhaustive way

    • @Goudron
      @Goudron 5 ปีที่แล้ว +44

      Actually great video, good explanation and interesting topic
      I will wait for more

    • @uSaschka
      @uSaschka 5 ปีที่แล้ว +45

      Please make new content. I've discovered your channel half an hour ago and I can't stop watching your videos. There are explained so good.

    • @BodhiGeraci
      @BodhiGeraci 5 ปีที่แล้ว +10

      Moet je echt doen!

    • @catprog
      @catprog 5 ปีที่แล้ว +3

      I think it was thanks to the yourtube algorithim

  • @JustRyann96
    @JustRyann96 5 ปีที่แล้ว +2573

    3:49 "What is distance?"
    *Vsauce music plays*

    • @daskampffredchen
      @daskampffredchen 5 ปีที่แล้ว +64

      Or does it?
      Mindfield Intro starts

    • @De50prala
      @De50prala 5 ปีที่แล้ว +24

      Hey VSauce, Michael here

    • @noah321
      @noah321 5 ปีที่แล้ว +22

      Or is it?
      *vsauce music intensifies*

    • @daskampffredchen
      @daskampffredchen 5 ปีที่แล้ว +2

      @@De50prala Where are your fingers.*Pervert

    • @thesobolan7480
      @thesobolan7480 5 ปีที่แล้ว +5

      Wait what he hearted you 4 days ago

  • @baboucheone4841
    @baboucheone4841 5 ปีที่แล้ว +4186

    This is the tutorial I like to see because there is no code in it. It just explain the concept. This is very useful to auto check your method, and lets us thinking about code alone without been affected and atracted by what the guy in the video did in his code. Easy, great looking video !

    • @mikul9204
      @mikul9204 5 ปีที่แล้ว +77

      yeah, I wish all coding tutorials were like this because when I copy someone else's code maybe I'll understand it but there's no way I would be able to apply it to a different situation

    • @dies200
      @dies200 5 ปีที่แล้ว +75

      @@mikul9204 Dependes a lot on what you want to archive. If you are teaching a general concept (as you do here), yes. No code is better. But sometimes you want to teach how to do a certain thing in a certain language. Then it's better to explain the concepts and then walk through how to put that into code

    • @deoxal7947
      @deoxal7947 5 ปีที่แล้ว +10

      Ya, but It would have been nice if he linked to the source code though. That way we can take a look at the core algorithm.

    • @rockomundo
      @rockomundo 5 ปีที่แล้ว +3

      I just don't like coding so this is the best type of video to explain what's happening.

    • @reformed_attempt_1
      @reformed_attempt_1 5 ปีที่แล้ว +1

      I would like it to be a coding tutorial. Otherwise it's just useless

  • @ErdrickHero
    @ErdrickHero 5 ปีที่แล้ว +1961

    "Speedy thing goes in, speedy thing comes out."

    • @zombieslayer1468
      @zombieslayer1468 5 ปีที่แล้ว +83

      I thought that might become a meme some day.

    • @ΔημήτρηςΤσανακτσής-ν2η
      @ΔημήτρηςΤσανακτσής-ν2η 5 ปีที่แล้ว +30

      layman's terms

    • @arnox4554
      @arnox4554 5 ปีที่แล้ว +27

      Fun fact: The Unreal Engine 1 already had portals called WarpZones. Admittedly, they had to be made at map creation/editing and they wouldn't handle hitscan, but otherwise, yeah. This shit way back in 1999. Just another reason in a long ass list of reasons why Unreal Tournament is GOAT for the PC.

    • @rareskeletor5405
      @rareskeletor5405 5 ปีที่แล้ว +4

      can't explain that

    • @Hoch134
      @Hoch134 5 ปีที่แล้ว +3

      I love how it's the same sound that "ADA" (the computer of the ship) in Outer World has. Good things don't disappear.

  • @babylonian
    @babylonian 5 ปีที่แล้ว +471

    jeez, what a great video. never thought i could wrap my head around this, but you explained it perfectly. bravo!

    • @HellishPumpkin
      @HellishPumpkin 4 ปีที่แล้ว +3

      Nick Robinson Sup Nick

    • @justsomebodyhere4930
      @justsomebodyhere4930 4 ปีที่แล้ว +3

      This is the last place I thought I'd find you

    • @duckles426
      @duckles426 4 ปีที่แล้ว +7

      So i flew to japan to find a portal.

    • @derpboxstudios
      @derpboxstudios 10 หลายเดือนก่อน

      I am now permanently attached to the reply chain

  • @shadamethyst1258
    @shadamethyst1258 5 ปีที่แล้ว +2075

    You sadly omitted recursive rendering, that is, stuff seen through portals seen through portals seen through portals seen through portals seen through ...

    • @OutOfNameIdeas2
      @OutOfNameIdeas2 5 ปีที่แล้ว +22

      Make portal layer invisible to the camera

    • @FoxSlyme
      @FoxSlyme 5 ปีที่แล้ว +111

      @@OutOfNameIdeas2 this is a dumb way

    • @Turtledud3
      @Turtledud3 5 ปีที่แล้ว +272

      You have the portals camera look through and render the same image, but smaller, and overlay it in the middle of the first (at the scale). You also get a very slight intentional bend in the render, so eventually, it bends away and prevents indefinite looping at specific angles, which prevents the game from crashing due to infinite re-rendering of smaller portals. The angle you add to each render is directly comparable to how much rendering your system/engine can handle. For bad computer or engine, add more angle per render and have less portal renders. For better computer or engine, add less angle each time and therefore have a bigger "depth" by having more rendered portals.
      Try this sometime. Get two mirrors, preferably one on the wall and another small handheld mirror with an opaque backing. Try to see an infinite loop in the mirrors by facing them at each other. You will notice that no matter how hard you try, you can never see an infinite loop because the pattern in the mirror eventually bends off and prevents further patterns from being made. (Technically, if you had a 1-way see-through mirror and you looked directly through the back of the 1-way mirror at the wall mirror, then you could see an infinite loop, but we are coding the game to avoid this.) This principle of never seeing an infinite loop and only ever seeing so many at once is exactly how the game never crashes (in theory).
      Note I know nothing about the coding, but I do understand the logic behind it, so please correct me if I am wrong.

    • @shadamethyst1258
      @shadamethyst1258 5 ปีที่แล้ว +58

      @@Turtledud3 Your idea is interesting, and it would work. However, I believe the effects of perspective would become broken (that is, the further an object is, the less there is a visual scale difference between its frontmost parts and its rearmost parts).
      I don't really know :)

    • @v.horvath3507
      @v.horvath3507 5 ปีที่แล้ว +16

      Oh yeah, stuff like this: th-cam.com/video/0TZd95BCKMY/w-d-xo.html
      Would be nice to have a nice demo with explanation for that

  • @lonelyPorterCH
    @lonelyPorterCH 5 ปีที่แล้ว +50

    Portal was way ahead of its time, the portals really looked convincing^^

  • @gigglysamentz2021
    @gigglysamentz2021 5 ปีที่แล้ว +43

    If you listen to the developpers commentary, you learn some other things they did with the portals. If you drop the cube like at 6:44, it takes a lot of stuff to make that work. I think they made a sort of gradient of the effect of both side's gravity...

  • @Wolfenrahd
    @Wolfenrahd 4 ปีที่แล้ว +116

    Apparently Valve dynamically altered the wall's collision geometry whenever a portal was placed.

    • @kaydencebernard7775
      @kaydencebernard7775 4 ปีที่แล้ว

      Hmm i dont know how to see geometry frames and shit with the command prompt in source so im gonna see if someone else has photo or video evidence

    • @randomcatdude
      @randomcatdude 4 ปีที่แล้ว +11

      @@kaydencebernard7775 Pretty sure one of the CO-OP map developer commentaries has a commentary node that shows you how the geometry changes.

  • @khmnc
    @khmnc 5 ปีที่แล้ว +349

    i also tried this many years ago but i came up with a different solution
    instead of rendering the other side of the portal to a texture, i would actually use a stencil buffer to keep track of what part of the frame was portal and what wasn't as well as which portal it was
    i would then use a translation matrix to modify the position of everything in the level, set a clipping plane so that nothing that was supposed to be behind the portal would be drawn, and then render the frame again but only in the spots where the stencil buffer indicated there was a portal
    the result was a perfectly seamless portal
    for the physics, i created a collision object to represent the portal it's self but made it so that if a collision was detected but that point of collision happened within the portal object then it would be treated as if it wasn't a collision at all
    and just to make things look nice i used another clipping plane when rendering objects going though portals just so they wouldn't stick out the back

    • @shumanbeans
      @shumanbeans 5 ปีที่แล้ว +28

      I still don't understand the graphic part of making games (masks, shaders, redering, etc), hopefully, one day I will be able to come back to this comment and understand your solution.

    • @khmnc
      @khmnc 5 ปีที่แล้ว +7

      @@shumanbeans well, if you have any specific questions, i might be able to answer them
      though if you're just starting, googling a tutorial might be beter

    • @khmnc
      @khmnc 5 ปีที่แล้ว +1

      @Joe Duke what do you mean?

    • @TimBell87
      @TimBell87 5 ปีที่แล้ว +1

      Thanks, I spent the entire video wondering why you wouldn't just use this approach.

    • @khmnc
      @khmnc 5 ปีที่แล้ว

      @Joe Duke ah, alright, no i've never used a 3rd party game engine so i 've no idea what they're like

  • @eclmist
    @eclmist 5 ปีที่แล้ว +97

    The visual portion does not need to be anywhere near as complicated as proposed. Have the second camera point perpendicular to the plane (or tangent) of the portal and render with an off-center view frustum. This has the exact effect of "projecting" what you should be able to see through the portal onto a planar surface, skipping past all the perspective issues, distance issues, etc. It would also massively simplify recursive portals rendering. This will also be much better for performance as your view frustum will only need to be as big as the portal on your screen, so most of the time the majority of the scene would not even have to be rendered in the portal.
    We created this exact same effect many years ago in an intro computer graphics course, albeit in D3D11/OpenGL, but I'm sure Unity supports off-center view frustums as well.
    Edit: To make sure I wasn't just speaking out of my ass I just spent an hour replicating the visual effect in Unity. Can't get the camera to natively render off-axis but easily solved by supplying a custom perspective projection matrix. The above method works in Unity.

    • @Nohax8
      @Nohax8 5 ปีที่แล้ว +2

      can you make tutorial or upload project files please?

    • @Danuxsy
      @Danuxsy 4 ปีที่แล้ว +14

      Can I get some of your brain?

    • @drewmileham202
      @drewmileham202 4 ปีที่แล้ว

      Can you elaborate a bit more on this strategy?

    • @eclmist
      @eclmist 4 ปีที่แล้ว +3

      If there is enough interest, I will record a tutorial when I find some time

    • @drewmileham202
      @drewmileham202 4 ปีที่แล้ว

      Samuel Van Allen That would be great.

  • @RP-dy5mu
    @RP-dy5mu 5 ปีที่แล้ว +4

    "It's not as easy as you might think"
    I was blown away when I first saw it. I think it must be one of the toughest things to program. Honestly, the explanation you gave is actually much easier than what I thought!

    • @sly1024
      @sly1024 3 ปีที่แล้ว

      If you ever programmed a 3D camera position matrix, it's actually pretty straightforward. The portal basically transports light rays, so we can either move the whole scene to be where the portal shows or move the camera. This is the same how mirror/water reflections work, just flip the camera to the other side, render it to a texture and map it to the reflective surface.

  • @CubicalStudios
    @CubicalStudios 7 ปีที่แล้ว +75

    This is crazy

    • @DigiDigger
      @DigiDigger  7 ปีที่แล้ว +26

      ...call me maybe?

    • @CubicalStudios
      @CubicalStudios 7 ปีที่แล้ว +5

      XD

    • @CubicalStudios
      @CubicalStudios 7 ปีที่แล้ว +4

      How did you solve the camera clipping through the wall?
      gyazo.com/435e1ce3f34e10c2bafecf7cd9ee13e7

    • @DigiDigger
      @DigiDigger  7 ปีที่แล้ว +9

      If the camera is clipping through the wall before the player teleports to the other portal, you would either need to teleport the player a bit sooner, or change the clipping plane of the camera to be much closer to the player. Since you'll basically have your face pressed up against the wall, your camera has to have a really close near-clipping plane :)

  • @OrangeUtan115
    @OrangeUtan115 5 ปีที่แล้ว +178

    Q: How were the Portals in Portal created.
    A: By the portal gun
    Q: Who created the portal guns.
    A: Aperture science

    • @SalemYbor
      @SalemYbor 4 ปีที่แล้ว +10

      Q: Who created Aperture science.
      A: Cave Johnson.

    • @SteelRider
      @SteelRider 4 ปีที่แล้ว +6

      Q:who created Cave Johnson

    • @SteelRider
      @SteelRider 4 ปีที่แล้ว +4

      @Poralisium1337 humanity

    • @DeadGhost307
      @DeadGhost307 4 ปีที่แล้ว

      @@SalemYbor I was gonna do that

    • @DeadGhost307
      @DeadGhost307 4 ปีที่แล้ว

      @@SteelRider who created humanity

  • @Sketchy_Dood
    @Sketchy_Dood 5 ปีที่แล้ว +64

    Interesting, makes sense why there isn’t really any portal rip offs

    • @fss1704
      @fss1704 5 ปีที่แล้ว +3

      yes there are

    • @emilbrandwyne5747
      @emilbrandwyne5747 5 ปีที่แล้ว

      @Sébastien Levesque there is this portal shooter

    • @attinyit9609
      @attinyit9609 4 ปีที่แล้ว

      I know that's not the point but there are some really good Portal2 mods.

    • @nandurstudio
      @nandurstudio 4 ปีที่แล้ว +1

      try mari0

    • @borstenpinsel
      @borstenpinsel 4 ปีที่แล้ว

      Well, there is the predecessor of which portal is a RIP-off (game mechanic, not story). "Narbacular Drop". According to wikipedia, valve hired some of the devs of this game

  • @FBI_No.69420
    @FBI_No.69420 5 ปีที่แล้ว +83

    You need Moonrocks to make them work properly

    • @ahmed4363
      @ahmed4363 4 ปีที่แล้ว +4

      NOBODY'S GOING TO SPACE MATE

    • @Brahvim
      @Brahvim 3 ปีที่แล้ว

      No FBI, No.

  • @snuvels4945
    @snuvels4945 5 ปีที่แล้ว +2231

    Me listening to the ending: O ok
    DigiDigger: And that cover the basics of portals!
    Me: *Basics.....*
    Edit: just a joke i understood this entire vid and pracically already knew most of it the only thing hard for me is coding and stuff like that

    • @CabbageGod
      @CabbageGod 5 ปีที่แล้ว +40

      I guess it's basic to actual game devs. It seemed very simple and straightforward the way he broke it down. But I realize now that that's definitely because I have background in this, Unity in particular. So the basics of portals.. if you know a bit about game development.

    • @hannahnelson4569
      @hannahnelson4569 5 ปีที่แล้ว +13

      i think this would count as the basics, though functional it lacks some important mechanics that i recall were implemented in the games, namely the conservation of diagonal velocity to the portal utilized in portal 2 along with the infinite mirrors effect you can get by placing two portals across from each other

    • @OrchidAlloy
      @OrchidAlloy 5 ปีที่แล้ว

      Yeah this is just the basics

    • @ThePhoenix107
      @ThePhoenix107 5 ปีที่แล้ว +14

      @@CabbageGod
      I can confirm that. I created a portal effect myself a while ago and when you have done that you will know that this was just the basics.
      Implementing it had a bit more to it than these basics.
      For example, you will also have to use oblique frustum for each camera to make it look right. This means that you set a plane in 3D space where one side of this plane will not be rendered by the camera. This is necessary to clip everything behind the wall the portal is sitting on. For example, imagine a thin wall with a portal on it. Behind the wall, there is a box. Without oblique frustum, the box will get rendered when the camera is behind it and this will look odd when looking through the portal. With it on, the box will not be rendered.
      There are a lot of other details, like raycasting (shooting an invisible line to detect an object; used for example for picking up boxes in Portal) through portals, keeping the box in front of you while it is on the other side of the portal, physically at a completely different position, etc.

    • @li_tsz_fung
      @li_tsz_fung 5 ปีที่แล้ว

      @@CabbageGod The camera part would kill me. The physics part is not straight forward, but that should be fine. I might figure it out in few days if I didn't give up

  • @alteregoAtlas
    @alteregoAtlas 5 ปีที่แล้ว

    Thank you VERY much for getting straight the duck into it without 5 to 15 minutes of exposition and then explained every bit clearly and concisely man. You don’t know how much I appreciate that.

  • @WangleLine
    @WangleLine 5 ปีที่แล้ว +37

    This is such an underrated video O:

  • @quepertron
    @quepertron 5 ปีที่แล้ว

    Like most folks, no idea why this appeared in my recommended but what a FANTASTIC video, thank you!

  • @smorpd
    @smorpd 4 ปีที่แล้ว +8

    He said in the video that in order to retain an entity's velocity when going through portals, you need to transfer the velocity information when you enter the portal, to when you exit the portal, so that your velocity isn't just set to 0, and the angle of exit should just be in the same direction that the portal is facing. This is wrong. Sometimes when you enter a portal, you enter it at an angle, say, I run through a portal that is diagonally facing toward the ceiling, I would exit the portal with the same velocity that I entered it in, *and* I would exit it at an upward angle, relative to how I entered the first portal.

  • @yasuologitech1084
    @yasuologitech1084 5 ปีที่แล้ว +1

    As a game designer undergraduate, i find this really helpful
    subbed

  • @oatmealine
    @oatmealine 5 ปีที่แล้ว +9

    "teleport from portal 1 to portal 2"
    i didnt know this video also covered the basics of time travel

  • @dorobokino
    @dorobokino 4 ปีที่แล้ว +1

    Ahhh, this explanation is sooo good! I love how you go back and forth between problem and solution, building up to the final implementation bit by bit in a logicl manner. 10/10 presentation!

  • @dannydeko331
    @dannydeko331 5 ปีที่แล้ว +75

    TH-cam is like, "Let's hold this good content for a couple of years for no reason"

    • @milkdromeda8539
      @milkdromeda8539 4 ปีที่แล้ว

      And viewer be like, "let's watch this content which we dont want to just for the sake of getting like by comenting comment which there is already like a infinite of them"

  • @Tinkerer_Red
    @Tinkerer_Red 5 ปีที่แล้ว +1

    Just found your channel from TH-cam home page from your Terraria video. I already love this series. Looking forward to seeing more.

  • @Aaron-dt3xz
    @Aaron-dt3xz 5 ปีที่แล้ว +38

    Amazing! One more thing I thought of is that you can set the near clipping plane of the camera to the distance between the camera and the portal so that you don’t see objects behind the exit portal.

    • @leonardoraele
      @leonardoraele 5 ปีที่แล้ว +8

      That's actually very important.

  • @Raphiki77
    @Raphiki77 5 ปีที่แล้ว

    Ok well, I know this channel is supposed to be abandonned, but what a great video! Clear explanations, interesting, detailed steps... Congrats!

  • @DarkGT
    @DarkGT 5 ปีที่แล้ว +7

    TH-cam is really broken for not suggesting this video to me 2 years ago.

  • @ytsedome
    @ytsedome 3 ปีที่แล้ว

    What a video. I haven't seen such great video simple, elegant, ample, and funny - in years.
    Short but highly effective. Bravo.

  • @tom.looman
    @tom.looman 7 ปีที่แล้ว +95

    Nicely explained! I did some portal experiments in UE4 a while back and it's pretty much the same implementation
    I vaguely remember reading from one of Valve's presentations that they do all the rendering in one pass by setting the view/projecting matrices for the masked area of the portal so they don't use a secondary camera in the same way. It's been a while, so the details are blurry to me. That would save a bunch on performance, but is a lot more involved in getting to work proper.
    Are you Dutch by any chance?
    *subbed*

  • @utcarshsrivastava6640
    @utcarshsrivastava6640 4 ปีที่แล้ว

    Till today, I thought that it would have been really easy to make the game portals. You really showed by the effort that had to be done in the game, and that was 13 years back.

  • @ZOMBIEHEADSHOTKILLER
    @ZOMBIEHEADSHOTKILLER 5 ปีที่แล้ว +3

    i came here expecting it to be about how the actual game did it, sort of a boundary break style thing. But i think, you figuring it out yourself, outside the game, turned out even better.

  • @BombProofYT
    @BombProofYT 5 ปีที่แล้ว

    Yes! I'm so glad this wasn't an abandoned account! Please keep doing these type of videos, they are awesome.

  • @smashenYT
    @smashenYT 5 ปีที่แล้ว +203

    TH-cam is like "Hey this dude didn't upload in 2 years?! Lets give him some love"
    TH-camrs Daily uploading: 👀

    • @daetheknight.
      @daetheknight. 5 ปีที่แล้ว

      lol hey look its Smashen!! are you planning to upload portal or splitgate arena warfare to your channel now?? >.>

    • @smashenYT
      @smashenYT 5 ปีที่แล้ว +1

      @@daetheknight. You know me from somewhere? Currently I am a DBD youtuber. I once had Portal lets plays on my channel a long time ago 😆
      Not sure how people react if I suddenly upload other games

    • @daetheknight.
      @daetheknight. 5 ปีที่แล้ว

      @@smashenYT lol I watch your dbd videos all the time. Even join your stream when I can catch it.
      You can do a test video and see how people respond to it.
      Plenty of other toobers try it. And if it works then you have more things you can do. If it doesn't then you can go back to dbd

    • @smashenYT
      @smashenYT 5 ปีที่แล้ว +1

      @@daetheknight. yea your name seemed familiar. TH-cam recommends this to everyone I guess 😆
      You want that in English on my main channel?

    • @daetheknight.
      @daetheknight. 5 ปีที่แล้ว

      @@smashenYT si, creo que el lenguaje seria perfecto

  • @gamertherapyconsoleyoursel5804
    @gamertherapyconsoleyoursel5804 4 ปีที่แล้ว

    I'm really glad the YT algorithm showed me your videos, sad I missed them when they were coming out, hope to see more from you!

  • @pierrejassogne9680
    @pierrejassogne9680 5 ปีที่แล้ว +4

    I did not expect such a great video, why was this recomended to me now ??

  • @stinkystink9830
    @stinkystink9830 5 ปีที่แล้ว

    Brilliant concept; ask questions about games that an aspiring developer would ask, then build a world in parallel while walking through the material. Professor grade stuff man

  • @bernardonegri5416
    @bernardonegri5416 5 ปีที่แล้ว +5

    TH-cam employee: How about we recommend this video to everyone
    That guy boss: Y E S

  • @mike22273
    @mike22273 4 หลายเดือนก่อน

    In my early days of programming, I really thought the only solution to this was to have 2 identical maps with 2 identical versions of all players and physics objects, one map for each portal. But now I see it's not that bad. Thank you!

  • @MysteryPancake
    @MysteryPancake 5 ปีที่แล้ว +13

    Many Garry's Mod implementations of the portal gun use this method, including Bobblehead's Portal Gun and Dr Matt's TARDIS Rewrite

    • @randomcatdude
      @randomcatdude 4 ปีที่แล้ว +1

      Yup. Though unfortunately, the visual side is buggy as hell due to GMod's limitations, and the physics is wonky as hell too.

    • @MysteryPancake
      @MysteryPancake 4 ปีที่แล้ว

      @@randomcatdude ye, i imagine it's tricky without rebuilding the source engine

  • @calccalccalc
    @calccalccalc 4 ปีที่แล้ว

    I love casestudies like this that show the ugly but genuine reality of trial and error.
    Good work!

  • @PabloPerroPerro
    @PabloPerroPerro 7 ปีที่แล้ว +5

    Awesome video! Perfectly explained. I always wondered how portals worked and now I'm glad to understand it, you just got subscriber++ ;)

  • @sneckie
    @sneckie 2 ปีที่แล้ว

    This was a brilliant step-by-step tutorial. Seriously I wasn't expecting something this good, but...wow. Thank you!

  • @DhruvSringari
    @DhruvSringari 5 ปีที่แล้ว +32

    I'm still confused on the final fix to the portal implementation at 4:15. How does stretching what the camera fix our distance issue?

    • @Pluvillion
      @Pluvillion 5 ปีที่แล้ว +1

      Asking the same thing. Is the image stretched or is it positioned to make it seem like we're looking through a hole? What does the whole portal look like if it was the whole wall? How is it supposed to look like if we were to look at it in a different angle (assuming the viewpoint is still connected to the player's camera than the second one)?
      I got all the things listed here expect for the distance part. I honestly can't wrap around my head around it.

    • @GEB_Rosee_PPS
      @GEB_Rosee_PPS 5 ปีที่แล้ว +5

      its stretched out. Its like changing FOV in a game.

    • @BingusGaming-bq1zv
      @BingusGaming-bq1zv 4 ปีที่แล้ว +3

      Just imagine putting a camera six steps away from portal, 3 steps ahead of the 9 steps portal, because you are looking from nine steps the resolution is for example 1600 x 800, because field of view increases with distance, so now you just crop the displayed resolution to the correct resolution to maybe 1200 x 800 and display it on the exact same mirror size as the portal enlarging the object and making it look closer, all the while calculating the correct setps

    • @darkhoodchief
      @darkhoodchief 4 ปีที่แล้ว

      I don't if this is the right explanation but:
      The image on the portals comes from the image gathered by the portal camera.
      The camera gathers image in a ratio that is similar to display (most likely 16:9) which is longer horizontally.
      But if we try to project that in a portal which is longer vertically (likely 1:2), the image produced would be squeezed in the horizontal axis.
      In order to counter the squeezing of the image in the horizontal axis, we just stretch the image horizontally before projecting it in the portal plane.
      Also as he mentioned, we don't need all the information that cannot be seen through the other side so we just discard it and scale it up so the portal only projects what the player must see.
      Hope this helps, although I don't know if this is the exact thing that he is mentioning in the video.

  • @TheLetsgodzn
    @TheLetsgodzn 4 ปีที่แล้ว

    That was one of the best videos explaining game codes that i have ever seen, i always wonder me how portals in portal were created.

  • @cursedcliff7562
    @cursedcliff7562 5 ปีที่แล้ว +1590

    Why would youtube reccomend this to me in 2019 and the channel is dead 😭

    • @hubjump
      @hubjump 5 ปีที่แล้ว +86

      Maybe he'll come back and see his channel booming?

    • @daetheknight.
      @daetheknight. 5 ปีที่แล้ว +10

      youtube has been doing this nonsense a lot lately..

    • @cmanatlan
      @cmanatlan 5 ปีที่แล้ว

      ​@@cembaturkemikkiran4109 Check out the channel mix and jam, it does the same kind of thing showcased in this video but the channel is active

    • @cmanatlan
      @cmanatlan 5 ปีที่แล้ว +1

      Check out the channel mix and jam, it does the same kind of thing showcased in this video but the channel is active

    • @cmanatlan
      @cmanatlan 5 ปีที่แล้ว +2

      @@hubjump Check out the channel mix and jam, it does the same kind of thing showcased in this video but the channel is active

  • @ItsJJOLO
    @ItsJJOLO 5 ปีที่แล้ว +2

    Ending it with the radio tune was perfect.

  • @vladimirilyanov9432
    @vladimirilyanov9432 5 ปีที่แล้ว +6

    You forgot to talk about player rotations (let's say u jump in-ground and another portal in a wall.)
    P.S. I literally made a copy of portal 1 in unity before see nur video. And everything made same way BUT I didn't have portal collider as u did. This is a good solution. (I trigger physics. ignores collisions when enters the portal but I didn't think of adding collider on the portal itself. Heh)

  • @Hoch134
    @Hoch134 5 ปีที่แล้ว +1

    I'm very happy that this video got recommended to me (by TH-cam). It's quite sad that some videos never get the attention they deserve, but very nice to see that there are some exceptions.
    Very well made video!

  • @CristalianaIvor
    @CristalianaIvor 5 ปีที่แล้ว +3

    I think they have some more detail on how they created them when you turn on the directors commentary :)

  • @TheBillzilla
    @TheBillzilla 5 ปีที่แล้ว

    That was more complicated that I thought it'd be, thanks for explaining it all.

  • @Azzlanoid
    @Azzlanoid 5 ปีที่แล้ว +3

    I literally had this exact question in my mind yesterday

  • @snipperjoey1151
    @snipperjoey1151 5 ปีที่แล้ว

    That part where you resize the camera's view and the portal effect finally looks perfect made me audibly go "oh shit" out of how beautifully simple it ended up being. Fantastic video.

  • @SandeMC
    @SandeMC 5 ปีที่แล้ว +54

    Me: *trying to sleep*
    My brain at 2 am:

    • @thepixelkings3491
      @thepixelkings3491 5 ปีที่แล้ว +7

      *S P E E D Y T H I N G G O I N S P E E D Y T H I N G G O O U T*

    • @karlbischof2807
      @karlbischof2807 5 ปีที่แล้ว

      @@thepixelkings3491 lmao i was a bout to reply this

  • @sandwichofknowledge3326
    @sandwichofknowledge3326 5 ปีที่แล้ว

    I'm seeing this video now but I have been wondering about this question for YEARS. I always wanted to do some research and find out but this video does an incredible job at explaining everything. You explained every part of the question and made it strangely easy to understand

  • @ralseithelonely
    @ralseithelonely 5 ปีที่แล้ว +4

    I always thought there was another room rendered behind the portals, with the exact properties of the original room.
    It would kind of fix every problem with the camera and the teleport timing.

    • @AquaDoesStuff_
      @AquaDoesStuff_ 5 ปีที่แล้ว +2

      but that would also cause issues with room overlap, where if the duplicate was on top of another room it would break.

    • @dethswurl117
      @dethswurl117 5 ปีที่แล้ว

      That's a good idea but it would pretty much then double the gpu the game needs to run which is no fun

  • @out-of-will
    @out-of-will 4 ปีที่แล้ว +1

    Radio music at end: (Happy sounds)
    Captions: [Laughter]

  • @BenjaminGoldberg1
    @BenjaminGoldberg1 5 ปีที่แล้ว +6

    Obligatory "Now you are thinking with portals"

  • @EnoX-1988
    @EnoX-1988 5 ปีที่แล้ว +1

    Portal always fascinated me. I always wondered how this works though I was aware that they must use two "cameras". It all seems so easy but I bet there is so much complexity behind this game.

  • @Lennard222
    @Lennard222 5 ปีที่แล้ว +20

    It just puzzles me how somebody has implemented portals into Minecraft :0

    • @snoookie456
      @snoookie456 5 ปีที่แล้ว +1

      what puzzles me is how they manage to implement them in Darksiders

    • @SodAlmighty
      @SodAlmighty 5 ปีที่แล้ว

      Darksiders was awesome. It had pretty much any game mechanic you could imagine in there.

  • @ZachHixsonTutorials
    @ZachHixsonTutorials 5 ปีที่แล้ว

    That collision solution was fantastic! Such a simple solution to a very complex problem. If it works it works, and is probably the best out of all the example solutions you gave as all others have horrible draw backs performance or bug wise.

  • @vladimir_ckau
    @vladimir_ckau 7 ปีที่แล้ว +367

    Brilliant! How do you even have only 190 followers? :O

    • @DigiDigger
      @DigiDigger  7 ปีที่แล้ว +70

      I haven't really gotten much exposure yet. I try to just keep making videos and hopefully we'll gain some subs some day :)
      Can I ask: how did you come across my channel?

    • @TheMemoman
      @TheMemoman 7 ปีที่แล้ว +11

      I'm not the guy, I'm another guy, and I'm not 100% sure how I got here, but I can trace it back probabilistically.
      I'm gonna say that probably you were listed along some other lesser known game development channels in some reddit r/gamedev post about "good game analysis channels", to which I'll venture to say that a disclaimer was probably added about how your channel "is not updated often but the videos are great practical in depth stuff" to which I would have agreed after browsing the backlog. I probably subscribed after checking out this along a few other channels on the list and I remained subscribed with the hopes of sometime getting one of the cool videos produced here, such as this one. That's enough with hypothetical remembrances.
      This video was indeed very cool. I appreciate your practical quest and analytical process walkthrough. I thought it was thorough, thought provoking, motivating and engaging. Keep at it!

    • @vladimir_ckau
      @vladimir_ckau 7 ปีที่แล้ว +8

      You sure will! Keep up good work!
      I think I was looking for Hotline Miami analysis. That brought me here, I like what I see, so I sub.

    • @kipchickensout
      @kipchickensout 6 ปีที่แล้ว +1

      Владимир Остапенко 698 now, vladimir :D

    • @xayer98
      @xayer98 6 ปีที่แล้ว +1

      You showed up in related vids for me, but I'm actually the head of social media at a Toyota dealership and I 'd love to lend you my marketing and branding skills to help you get exposure. I was so shocked to see you had under 1,000 subs, but from the sound of this guys comment you've already come a long way in a year. I don't wanna get paid or anything. I really just enjoy your content and want to help it reach more people. I hope to hear back from you (:

  • @nitram_nosnibor
    @nitram_nosnibor 5 ปีที่แล้ว

    Wow this was such a fascinating watch! Thanks for the time and posting (although it was a couple of years ago) - you've gotta love TH-cam!

  • @ImTouchkv2
    @ImTouchkv2 5 ปีที่แล้ว +26

    Can we see the source code of the portals you've made? :D

  • @RaExpIn
    @RaExpIn 5 ปีที่แล้ว

    This was not what I was looking for, but TH-cams algorithm has done something right.

  • @caluwebrendbc
    @caluwebrendbc 6 ปีที่แล้ว +27

    Could you give a more in depth tutorial? Code wise, it would be so great!

  • @akkrecola
    @akkrecola 5 ปีที่แล้ว

    Hi @DigiDigger, just wanted to say that I seriously enjoyed the video and it was truly well made. Glad I found it when I did.
    I must be a good target audience for this type of content - 1) people who really don't really know how to code, but are actively seeking time to learn in the future, and 2) enjoy some applied concepts of programming to know what's possible when they do. And I'd presume there's a lot of people like me on this topic.
    Really cool video, will be watching if you make more of the Bitwise series! Keep it up!

  • @ErdrickHero
    @ErdrickHero 5 ปีที่แล้ว +9

    3:45 "Who wants $60?"

  • @world_of_hein
    @world_of_hein 5 ปีที่แล้ว +1

    This was fascinating! Excellent video :D

  • @bongobliss5795
    @bongobliss5795 5 ปีที่แล้ว +4

    Absolutely breathtaking, ive tried to do this once long ago and ended up doing minecrafts teleportation with ender stuff

  • @andreasscholz4375
    @andreasscholz4375 5 ปีที่แล้ว

    This video just showed up on my recommendations and it is absolutely awesome! I have no experience in 3D but I absolutely understood every bit of your video. Kudos!

  • @LulzAreGud
    @LulzAreGud 7 ปีที่แล้ว +8

    Could you elaborate more on how you went about using the two cubes to create the illusion of one single cube?

    • @thewowo
      @thewowo 6 ปีที่แล้ว +1

      create another cube at position: offset + pos = (current portal - position) + other portal. And something similar to rotation.
      then when exit destroy that clone.

    • @MMedic23
      @MMedic23 5 ปีที่แล้ว

      @@thewowo Yeah but how do you set collision?

    • @thewowo
      @thewowo 5 ปีที่แล้ว

      @@MMedic23 well, thats more complicated; make invisible walls around the portal and make that the things in the portal only collide with that walls.

    • @thewowo
      @thewowo 5 ปีที่แล้ว

      @@MMedic23 or disable the clone's collider an rigidbody

  • @sykegamer9657
    @sykegamer9657 5 ปีที่แล้ว +1

    i was thinking this was gonna be one of those talk to a valve guy for 20 min but no. this was cool

  • @danielb270
    @danielb270 5 ปีที่แล้ว +6

    I heard valve used their room system to spawn copies of rooms on the other side of each portal

    • @snoookie456
      @snoookie456 5 ปีที่แล้ว

      yeah, that is why test chambers are separated in both games

  • @Tomyb15
    @Tomyb15 5 ปีที่แล้ว +1

    Such a great explanation. This format you've come up with for explaining this is really good.
    I actually feel like I've learned a thing or two about game engines in such a short time.

  • @keybraker
    @keybraker 5 ปีที่แล้ว +3

    _I'm not even angry, any-more_ although you broke my heart and kill me. I'm still alive !

  • @johannengelhardt5885
    @johannengelhardt5885 5 ปีที่แล้ว

    Great video! I hope this will become an ongoing series. I love seeing how games are programmed.

  • @changoelchango
    @changoelchango 5 ปีที่แล้ว +3

    I feel like an aperture science intern now

  • @kepler1175
    @kepler1175 4 ปีที่แล้ว

    I’ve always been curious, loved the way you incrementally worked through the process, thank you for this great video

  • @williamsmith6921
    @williamsmith6921 5 ปีที่แล้ว +3

    I was actually looking for something like this and was just recommended it while looking at memes. What luck

  • @ivankontra3446
    @ivankontra3446 5 ปีที่แล้ว

    Logicwise, the question was answered in the first minute, which I do appreciate.

  • @Starwort
    @Starwort 5 ปีที่แล้ว +25

    Ok so this is really cool but I think your approach isn't the same as valve's; I once used p2's level editor to bug out a portal and the game started to not render some of the walls, revealing the effect: they seemed to just place/render an entire copy of the room behind the portal

    • @KaNofbeans
      @KaNofbeans 5 ปีที่แล้ว +7

      That is probably just the skybox or the hall of mirrors effect, you cant just instantly place entire rooms easily like that in the source engine.

    • @sharp14x
      @sharp14x 5 ปีที่แล้ว

      You just saw the nodraw.

    • @Starwort
      @Starwort 5 ปีที่แล้ว

      @@KaNofbeans could be, just saying what it looked like lol

    • @Starwort
      @Starwort 5 ปีที่แล้ว

      @@sharp14x definitely not nodraw, no nodraw effects and there was nothing behind the wall in question the same shape as the room being shown (bear in mind this was a rectangular puzzle editor room)

    • @clonkex
      @clonkex 4 ปีที่แล้ว

      @@Starwort I would guess this is a result of the stencil-buffer rendering. I'm no expert, but perhaps if the wall around the portal vanished it might not stencil out a proper portal shape and would just render the entire room. If they just placed an entire copy of the room behind the portal, you'd be able to place a portal at the edge of a wall and see the copy of the room appear behind that wall.

  • @qlein2
    @qlein2 5 ปีที่แล้ว +1

    kinda like an old mix and jam, awesome! hopefully he revives this channel :^)

  • @OlegGolubev_yolo
    @OlegGolubev_yolo 5 ปีที่แล้ว +5

    "just make a portal" what can be hard here?! - 2 cameras, nothing else
    - that's how it looks like from non-programmer boys (c)

  • @tallangroberg3202
    @tallangroberg3202 4 ปีที่แล้ว

    I can’t believe how good this channel is. I feel like I found a hidden gem.

  • @X606
    @X606 5 ปีที่แล้ว +3

    1 problem: If you move the camera back like that, what if there is an object in front of the portal camera? That is gonna look weird

    • @Asjagadra
      @Asjagadra 5 ปีที่แล้ว

      Maybe you can simply adjust the render distance in order to render only from the portal. That way, objects between the camera and the portal won't be rendered

    • @X606
      @X606 5 ปีที่แล้ว

      @@Asjagadra yeah that kind of works, but at some angles it doesnt

  • @MikalIkal
    @MikalIkal 4 ปีที่แล้ว

    This is surprisingly complicated and I never thought about it until now, That’s amazing! Great video!

  • @ayefkay
    @ayefkay 5 ปีที่แล้ว +3

    Will there be any code-type tutorial for this portal concept? Cheers

  • @Keyakina
    @Keyakina 5 ปีที่แล้ว

    300k views! So wholesome after seeing your comments! I'm really happy for you!!

  • @JKTCGMV13
    @JKTCGMV13 5 ปีที่แล้ว +4

    I was so worried this was going to be a video of some nerd trying to come up with weird theoretical physics to explain real life portals, but it was the _real_ how portals are created

  • @PCGGC
    @PCGGC 5 ปีที่แล้ว +1

    Great video, logical and interesting. Yes this just randomly showed up on my homepage today without searching lol and I'm glad it did! Make videos again!!!

  • @alexrechkin7
    @alexrechkin7 5 ปีที่แล้ว +4

    im not a coder, but i thought you just need to create 2 copy of the same 3d world and let portals connect this two worlds

    • @csbnikhil
      @csbnikhil 5 ปีที่แล้ว +3

      That would surely work, but since you say that you're not a coder, I'd like to tell you that your idea - when implemented, would take up a lot of system's memory, and that would be very hard to run across a wide range of computers, which would be against the principles of Valve.

    • @draketungsten74
      @draketungsten74 5 ปีที่แล้ว +2

      @@csbnikhil Except that's closer to what they actually did than what this video shows.

    • @draketungsten74
      @draketungsten74 5 ปีที่แล้ว

      I take it back, they re-render the image of the same room, which is more like what this video shows.

    • @csbnikhil
      @csbnikhil 5 ปีที่แล้ว

      But still managed to run smoothly on low end systems... Wow!

  • @Dedeu99
    @Dedeu99 4 ปีที่แล้ว

    Would love to see new concepts next like floating islands and destructible terrain xD glad the TH-cam algorithm found me a new subscription :D

  • @trueprogamer3018
    @trueprogamer3018 5 ปีที่แล้ว +7

    Why didn’t you show us how velocity transfers through a portal in your game lol

    • @Alkuf100
      @Alkuf100 5 ปีที่แล้ว +3

      TrueProGamer because he would have to code in velocity

    • @logix8969
      @logix8969 5 ปีที่แล้ว

      He did.... 7:21
      Pay attention!

    • @oglocfriend
      @oglocfriend 5 ปีที่แล้ว +3

      Dr Logiq thats valves portal you dumbass

    • @MyaTimes4
      @MyaTimes4 5 ปีที่แล้ว

      @@oglocfriend He still explains it...

  • @derobernugget2410
    @derobernugget2410 2 ปีที่แล้ว

    I think Valve actually did solve the wall problem by adding a small collider on the side of the portal. I played portal 2 with a friend and he once collided against that small hitbox and lost all his speed, he even seemed to be standing on the edge of the portal a bit. I think your portals recreated valve's portals almost perfectly, great job on that

  • @twentley8997
    @twentley8997 5 ปีที่แล้ว +8

    Kids be like : Oh that’s how you make one
    News : a kid made portal 3

  • @puntero
    @puntero 5 ปีที่แล้ว +2

    Amazing video. Me being a huge fan of Portal and having this question wandering around in my head for years, to finally see someone explain it in-depth is cheerful.
    What I would've of loved is a code representation of all the points taken in this video about portals in-game. Btw, so little subs with such intelligence? Oh well, might as well help out.

  • @jillcrungus
    @jillcrungus 5 ปีที่แล้ว +5

    I'd really appreciate the code for this implementation being put up somewhere to help understand this.

  • @exildur
    @exildur 5 ปีที่แล้ว

    You must be a talented coder to recreate this and explain it so well. Please do more complex game mechanics from a code standpoint!