As I mentioned there's a lot more work to make this robust, and there's also more I could do to make it faster. For instance, I could use (something like) frustum culling to ignore geometry outside of the portal edges. These test levels work well enough on my modern PC though, so I'll leave it here for now...
Hello, I have one multiplayer project on ue5 in which I would like to add motion as in quake 3, could you give a formula to calculate motion in quake 3, in the form of a normal mathematical formula(Maybe with some notes. ) ? I searched for it on the Internet, found only the source code, but in them I do not know where to look for the piece of code I need, and I saw a little of it, after which I realized that it would be easier to ask a knowledgeable person for a formula and write everything from scratch than to try to rewrite the original code. I would be very grateful if you would provide this. PS I apologize for my English, I used a translator.
Hi! Ive worked on a similar feature for qfusion and also worked on my software quake engine tochris so I feel I need to share my thoughts on this ;) To facilitate near plane clipping, I would suggest adding the fifth plane to the frustum in the generic rendering pipeline, this will eliminate a huge amount of polygons that need to be clipped
During Quake's development, 3dRealms was working on the original Prey. Prey had portals as its main VSD (visible surface determination) structure instead of Quake's PVS. The abilitry to have these gameplay portals was quite hyped in the media at that time.
Narbacular drop was released in 2005. It was some of the team that ended up making portal. Gabe Newell liked it, so he hired the whole team, and they subsequently made portal. So valve still win :)
The original Unreal had portals back in 1998, but the game didn't use them heavily even though they were pretty advanced. Two portals could be at any angle to each other. They didn't have to be vertical, but some angles could result in your view angle jumping when passing through them, and some kinds of weapons didn't work when shot through them.
Chapter 70 of the Graphics Programming Black Book mentions that the Quake developers tried using portals for rendering instead of PVS. However they ultimately decided against it because it made worst-case performance worse without improving average performance. If you haven't checked that out, you should. It might give you some ideas.
Not exactly Quake spirit, but those portals would look sick with some see-through vertical, wavey water with maybe a little translucent animated texture.
you're wild man, doing this in the spirit of the original software implementation is very cool. now you just need a time machine and you can make a mod of Portal for Halflife goldsrc
That reminds me of the old days when I've been listening to Carmack's QuakeCon keynotes as in I do not understand 95% of the technical stuff... but I still had a lot of fun listening to it. :)
divVerent made portals in QuakeC code about 13 years ago. It is what is used in Xonotic and old Nexuiz. In those games they are called Warpzones. (xonotic-data pk3dir- > qcsrc -> lib-> warpzone) But that is a hack of the water render implementation (also in QuakeC), iirc, and is not the same approach as your implementation.
I love this channel. Jedi Academy taught me how to program and helped me learn the quake engine. I wonder if you’d explain how bsp inception and subsequent child map entity tracking could be improved compared to the implementation of misc_bsp. one of my favorite game mods from back then let you save and load map entities, but you couldn’t sub tree the map entity logic when placing a bsp. That would’ve been cool
All your videos are so fascinating! I was 10 when i started playing Quake 1 in the late 90's, and these give a cool sense of nostalgia, and curiosity at the same time. Wish you the best, and thanks for the great vid!
We need to start using BSP trees in more stuff again tbh. The fact that we *can* kill it with hardware instead does *not* mean we *should.* A beautiful program running just as fast as it needs to is ok. But a beautiful program running 10,000x faster than it needs to is *exquisite.* Let us not be like the engineers, who build bridges that barely stand. Let us be obsessed with over-engineering, to build bridges that will stand until the sun consumes the Earth.
BSP is very sensitive to geometry details. So it would be inefficient in modern games. Manually placed sectors, portals, occluders should prevail. Modern games lack quality development. Nowadays you can see highpoly meshes with absurd polycount, so it's done with colliders too. And LODs are automatically generated without any manual fixing. You can see smallest hairs on character faces, but not detailed skin textures. You can see highpoly rocks, but not detailed wall corners, which are represented as geometrically perfect. And so on.
Oh man I really hope we can get fully functional ones allowing grenades and monsters as well. Could really make some trippy lovecraftian stuff and mess with players with infinite corridors and labyrinths.
Awesome! Implementation as in Duke Nukem 3D ))) There where lot of custom levels in use with non-euclidean geometry, the most fun experience for multiplayer setups.
I don't think portals like this tend to use stencil buffers in modern games. I think they render the destination scene to a separate off-screen texture backed by another frame buffer and then place that in the portal location.
There are lots of ways to do it. Imo the best way to do something is the one that takes the least frame time and memory to do. Idk which one that is, but it's probably one that doesn't use very many extra buffers.
IMO, I would rather use a stencil and depth buffer to clip the destination geometry to the portal's surface in the source source geometry. That way, I could use a single deferred lighting/shading pipeline to light both sides of the portal with lights/shadows being able to pass through.
What an amazing job! I just discovered your camapaign for Quake and after playing it for a couple of minutes it's really something good, thank you! Btw, do you think it could be possible to pre-render portals into a set of images or a compressed video, maybe even a couple of parallax cubemaps to save some performance?
Thanks for the kind words. To be clear, I had nothing to do with the development of the Alkaline mod, I merely used it in this project. It is a fantastic campaign though. To answer your question: I suppose that would be possible, although it'd only ever be an approximation since you'd want it to appear right from all angles. Thanks again.
Would you be able to apply any effects (even very cheap ones like desaturation / palette changing) to stuff that's rendered through a portal, to make them a bit less transparent? Maybe just needs a stack of renderer parameters. A bit of geometry wobble would be cooler, but probably not doable :)
Awesome! When I was a kid in 1999 I used to mess with QuakeC and the source files. I wanted to make rockets and grenades to jump the teleports too, which they didn't. It added an extra layer of fun. And I managed to do it without knowing anything about coding! The only problem that I encountered was that the rockets and grenades were choosing seemingly random trajectories when leaving the teleports on the other side. Couldn't beat that bug then due to lack of knowledge. Even played my mod at a lan party:)
Nice, I did something similar in Q3 many years ago, basically modifying the standard teleporter and combined that with the portal camera. A few of these videos are still scattered around, e.g. "roomillusion4". PS: I like your technical approach.
Yeah, I did think about the Q3 see-through portals when I was doing this (eg. the one near the lava in q3dm7). I seem to remember there were some technical limitations, so the renderer couldn't handle portals looking at portals?
@@MattsRamblingscorrect. Portals couldn't look at other portals and if I remember correctly, things also broke down if the player could see two portals simultaneously as well.
Wow I keep forgetting how fast software rendererers can get messy. Another youtuber, jdh, just gave up debugging his renderer for his game. (it makes for a good content I suppose...) Though, I'm more interested how physics might interact with portals. The original Portal (2007) is a mess trying to deal with player AABB going through non-AA portals, collision etc (It makes for amazing speedruns though). I wonder if there are cleaner, more elegant solutions.
technically CPU can render everything that a GPU can because there is a fully complete and well-defined software implementation of OpenGL 4.5 called freedesktop mesa llvmpipe that enables any OpenGL code to run on any CPU even when there is no hardware OpenGL accelerator present. Slower result than most hardware GPU of course, but this GPU emulator is optimized to the greatest extent it is possible to optimize a CPU to render 3D, so its performance on very large modern CPUs like AMD Ryzen 9 5950X should not be underestimated
It's possible to clip triangle models by clearing depth buffer outside portal area. Yes, it is not cheap. But some optimizations are possible, like clearing it only around models that needs to be clipped.
How do you avoid the portal clipping the near plane as you pass through it? Also doesn't Quake use PVS, so are you doing PVS lookup for the viewpoint transformed into the portal destination space (which might be behind a wall) or from the portal itself somehow?
@@charlieking7600 Well, as a mod obviously. I would be surprised if it was not done before. Makes me think if there are other Quake engine games that have portals. I can't remember any.
so that the portal is the camera surface and the origin is the player, any number of new cameras, portals, and the portal is the forward clipping plane
Recently i implemented portals myself in my experimental softwarte rendering engine. But my portals works differently - this is just a render into texture. And result portal looks not so smooth as yours (is blocky).
Somewhat, but build is still "2.5D", which simplifies the occlusion tracking, it only needs two integers per raster column to achieve zero overdraw. However, build has its own sophistication to handle concave sectors (as opposed to doom's convex sectors and quake's convex leaves)
I used to play a mod for Q3 which had portals like this, and it was long before Valve's Portal Does anyone know that? maybe? I wondering what it would like to play that again!!!
You probably played Xonotic (previously Nexuiz), which is basically Unreal Tournament with bunnyhopping. It's built upon Darkplaces and uses gameplay feature known as warp zones. These are seamless portals.
Great stuff, it'd be interesting to see somebody attempt myhouse.wad in the Quake engine using this, the portal rendering would be perfect to pull off some of the tricks required.
I'd like to see that working on original hardware to some extend. Imagine how mind blowing it would be for people back then if this existed at the time? Pretty good video
As I mentioned there's a lot more work to make this robust, and there's also more I could do to make it faster. For instance, I could use (something like) frustum culling to ignore geometry outside of the portal edges. These test levels work well enough on my modern PC though, so I'll leave it here for now...
Nice work! I was wondering why you don't mention frustum culling As part of the partitioning step. Looking forward to more on this.
Hello, I have one multiplayer project on ue5 in which I would like to add motion as in quake 3, could you give a formula to calculate motion in quake 3, in the form of a normal mathematical formula(Maybe with some notes. ) ? I searched for it on the Internet, found only the source code, but in them I do not know where to look for the piece of code I need, and I saw a little of it, after which I realized that it would be easier to ask a knowledgeable person for a formula and write everything from scratch than to try to rewrite the original code.
I would be very grateful if you would provide this.
PS
I apologize for my English, I used a translator.
Hi! Ive worked on a similar feature for qfusion and also worked on my software quake engine tochris so I feel I need to share my thoughts on this ;)
To facilitate near plane clipping, I would suggest adding the fifth plane to the frustum in the generic rendering pipeline, this will eliminate a huge amount of polygons that need to be clipped
During Quake's development, 3dRealms was working on the original Prey. Prey had portals as its main VSD (visible surface determination) structure instead of Quake's PVS. The abilitry to have these gameplay portals was quite hyped in the media at that time.
ruclips.net/video/dMfen_wicEA/видео.html
@AletheiaBasin Prey was never released though, until Human Head made the 2006 Prey based on idtech4.
Narbacular drop was released in 2005.
It was some of the team that ended up making portal. Gabe Newell liked it, so he hired the whole team, and they subsequently made portal.
So valve still win :)
The original Unreal had portals back in 1998, but the game didn't use them heavily even though they were pretty advanced. Two portals could be at any angle to each other. They didn't have to be vertical, but some angles could result in your view angle jumping when passing through them, and some kinds of weapons didn't work when shot through them.
@@SuperAlgae yes, UT made some use of them too, eg DM-Fractal. OldUnreal's modern versions fix hitscan weapons through portals if I recall correctly.
Very nice! :D I especially applaud your decision to adhere to the original principles while looking for possible solutions to the issues.
babe wake up new matt's ramblings video
Thank you for your contributions in the field of Quakelogy
Chapter 70 of the Graphics Programming Black Book mentions that the Quake developers tried using portals for rendering instead of PVS. However they ultimately decided against it because it made worst-case performance worse without improving average performance.
If you haven't checked that out, you should. It might give you some ideas.
Yes, that did spring to mind! It's pretty much the same problem only with portals between each leaf, I think.
IIRC the original Unreal engine was portal based
Not exactly Quake spirit, but those portals would look sick with some see-through vertical, wavey water with maybe a little translucent animated texture.
you're wild man, doing this in the spirit of the original software implementation is very cool. now you just need a time machine and you can make a mod of Portal for Halflife goldsrc
🤯🤯 incredible work as always. Mappers would have a blast with this!
Thanks! Good to see you here.
@MattsRamblings heck yeah! It's in GZdoom and now, Quake!
That reminds me of the old days when I've been listening to Carmack's QuakeCon keynotes as in I do not understand 95% of the technical stuff... but I still had a lot of fun listening to it. :)
divVerent made portals in QuakeC code about 13 years ago.
It is what is used in Xonotic and old Nexuiz.
In those games they are called Warpzones. (xonotic-data pk3dir- > qcsrc -> lib-> warpzone)
But that is a hack of the water render implementation (also in QuakeC), iirc, and is not the same approach as your implementation.
your profile picture fascinates me the more i downscale it the more it looks like a regular image that is not made of lines
I love this channel. Jedi Academy taught me how to program and helped me learn the quake engine. I wonder if you’d explain how bsp inception and subsequent child map entity tracking could be improved compared to the implementation of misc_bsp. one of my favorite game mods from back then let you save and load map entities, but you couldn’t sub tree the map entity logic when placing a bsp. That would’ve been cool
Man, even this "basic" implementation of portals looks totally awesome! This could be an amazing addition to the Retroquad engine.
This is one of the coolest things I've seen about Quake. Congratulations on the work!
All your videos are so fascinating! I was 10 when i started playing Quake 1 in the late 90's, and these give a cool sense of nostalgia, and curiosity at the same time. Wish you the best, and thanks for the great vid!
We need to start using BSP trees in more stuff again tbh.
The fact that we *can* kill it with hardware instead does *not* mean we *should.*
A beautiful program running just as fast as it needs to is ok. But a beautiful program running 10,000x faster than it needs to is *exquisite.*
Let us not be like the engineers, who build bridges that barely stand. Let us be obsessed with over-engineering, to build bridges that will stand until the sun consumes the Earth.
BSP is very sensitive to geometry details. So it would be inefficient in modern games. Manually placed sectors, portals, occluders should prevail.
Modern games lack quality development. Nowadays you can see highpoly meshes with absurd polycount, so it's done with colliders too. And LODs are automatically generated without any manual fixing. You can see smallest hairs on character faces, but not detailed skin textures. You can see highpoly rocks, but not detailed wall corners, which are represented as geometrically perfect. And so on.
Now you're thinking with portals!
Oh man I really hope we can get fully functional ones allowing grenades and monsters as well. Could really make some trippy lovecraftian stuff and mess with players with infinite corridors and labyrinths.
I fist pumped when you got to the nested portal queue
Great video, programming, explanations, etc. Really hoping you expand on this concept in the future and turn it into a publicly available mod
Very cool video, reminds me of the guy doing portal on the n64!
I'll have to check that out, thanks!
thank you for doing the thing i've wanted to see and do
Awesome! Implementation as in Duke Nukem 3D ))) There where lot of custom levels in use with non-euclidean geometry, the most fun experience for multiplayer setups.
I don't think portals like this tend to use stencil buffers in modern games. I think they render the destination scene to a separate off-screen texture backed by another frame buffer and then place that in the portal location.
Stencils used to mask portal area
There are lots of ways to do it. Imo the best way to do something is the one that takes the least frame time and memory to do. Idk which one that is, but it's probably one that doesn't use very many extra buffers.
IMO, I would rather use a stencil and depth buffer to clip the destination geometry to the portal's surface in the source source geometry. That way, I could use a single deferred lighting/shading pipeline to light both sides of the portal with lights/shadows being able to pass through.
stencils are superior to rendertextures in pretty much every way
4:17 and 5:54 - aah, like the real life 'infinite mirror' effect when u place two of them facing each other.
Simply incredible
I really like how you laid everything out, and the portals look amazing.
Mindblowing! Looking incredible using old-school software rendering!
Very cool video! keep up the good work
Thanks Matt for another wonderful video! Unparalleled video editing and explanations!
Opening the doors (or dare I say, portals) for someone to remake MyHouse.wad in Quake running on period accurate hardware.
That's pretty unreal bruh
I get a feeling this is being developed to get a Quake version of myhouse.bsp.
It was certainly an inspiration...
What an amazing job! I just discovered your camapaign for Quake and after playing it for a couple of minutes it's really something good, thank you! Btw, do you think it could be possible to pre-render portals into a set of images or a compressed video, maybe even a couple of parallax cubemaps to save some performance?
Thanks for the kind words. To be clear, I had nothing to do with the development of the Alkaline mod, I merely used it in this project. It is a fantastic campaign though. To answer your question: I suppose that would be possible, although it'd only ever be an approximation since you'd want it to appear right from all angles. Thanks again.
@@MattsRamblings ok, yes, this is exactly why I say it should be a series of images, taken from multiple angles.
@@vadimtaranov3041Similar to a cubemap?
Would you be able to apply any effects (even very cheap ones like desaturation / palette changing) to stuff that's rendered through a portal, to make them a bit less transparent? Maybe just needs a stack of renderer parameters.
A bit of geometry wobble would be cooler, but probably not doable :)
What an absolute gift of a video! Thanks, Matt
God damn my man is a legend
awesome
Awesome! When I was a kid in 1999 I used to mess with QuakeC and the source files. I wanted to make rockets and grenades to jump the teleports too, which they didn't. It added an extra layer of fun. And I managed to do it without knowing anything about coding! The only problem that I encountered was that the rockets and grenades were choosing seemingly random trajectories when leaving the teleports on the other side. Couldn't beat that bug then due to lack of knowledge. Even played my mod at a lan party:)
Awesome work!
Really exciting work. Thanks for sharing this
Outstanding job!
Any news?
fascinating stuff!
Hope you keep trying to improve it. Would be really cool to have maps with these portals that run on oldish hardware.
Nice, I did something similar in Q3 many years ago, basically modifying the standard teleporter and combined that with the portal camera. A few of these videos are still scattered around, e.g. "roomillusion4".
PS: I like your technical approach.
Yeah, I did think about the Q3 see-through portals when I was doing this (eg. the one near the lava in q3dm7). I seem to remember there were some technical limitations, so the renderer couldn't handle portals looking at portals?
@@MattsRamblingscorrect. Portals couldn't look at other portals and if I remember correctly, things also broke down if the player could see two portals simultaneously as well.
That's pretty damn cool and indeed really wonder at the performance of running this and the original level on an old pentium
Id like to see this in a mod.
Amazing. I saw that other fellow (the one writing his own engine) did this recently.
Reminds me of when they got portals in vanilla Doom by exploiting the BSP.
Would love to see further work on this as you optimize this further in a future video :)
I wonder how this differs from the warpzone implementation in Darkplaces. I hope you look into how this might be done with a GPU OpenGL render path.
can... can you fire rockets through them?
🤠
It can't even render rockets correctly at the moment! That would be amazing though. 😅
Love your work 😀😃😄😁🤩😍
Wow I keep forgetting how fast software rendererers can get messy. Another youtuber, jdh, just gave up debugging his renderer for his game. (it makes for a good content I suppose...)
Though, I'm more interested how physics might interact with portals. The original Portal (2007) is a mess trying to deal with player AABB going through non-AA portals, collision etc (It makes for amazing speedruns though). I wonder if there are cleaner, more elegant solutions.
there's a guy porting portal to the N64, he discusses some techniques (which run well on a N64)
cool now we need someone to make Prey
very nice
Impressive work!
technically CPU can render everything that a GPU can because there is a fully complete and well-defined software implementation of OpenGL 4.5 called freedesktop mesa llvmpipe that enables any OpenGL code to run on any CPU even when there is no hardware OpenGL accelerator present. Slower result than most hardware GPU of course, but this GPU emulator is optimized to the greatest extent it is possible to optimize a CPU to render 3D, so its performance on very large modern CPUs like AMD Ryzen 9 5950X should not be underestimated
It's possible to clip triangle models by clearing depth buffer outside portal area. Yes, it is not cheap. But some optimizations are possible, like clearing it only around models that needs to be clipped.
love it
XashXT for Half-Life has this, it lets pushables through and I've managed to make env_shooter projectiles to pass as well.
My 486 and PII are ready. 😁
This video gives me DmRadicus (DmRadikus?) vibes.
It was a non-euclidean map from the first Unreal. (Not Unreal Tournament, regular Unreal.)
Next step: raytraced lighting through portals ;~)
95's Portal. Let make this.
Not clever enough to keep up with this. So to look clever I’ll quote someone:
“Huh?”
Quake Guy (or Ranger)
Mazing
Finally!!
Whoa!
I seem to remember that the original Unreal engine had support for portals like this?
What about mirrors? Aren't they similar?
Yes, you could implement mirrors like this, you just need to reflect the far side of the "portal" too.
@@MattsRamblings And probably also the player. But nice! Mirrors in games are way too seldom.
narbacular drop
Awesome! Now add a portal gun 😅
Am I the only one who thinks this video was quite dark and sometimes difficult to see what was going on?
Depends on your screen brightness.
I agree, I think his gamma must be lower than the game's default
has anyone ever tried an implementation of portals that _doesn't_ just consist of rendering another scene?
I've stumbled onto same issues when implementing the same thing onto Goldsource engine, thought its mostly hardware accelerated
Bro made Quake 1.5
Did you try using this technique to make reflective surfaces? I think this is how duke nukem and Unreal did mirrors, IIRC
How do you avoid the portal clipping the near plane as you pass through it? Also doesn't Quake use PVS, so are you doing PVS lookup for the viewpoint transformed into the portal destination space (which might be behind a wall) or from the portal itself somehow?
finally
I have a feeling my 20MB Pentium Overdrive @73MHz would be too just-barely-runs-Quake to handle this, eh? Heheh.
👌
would this be possible in the goldsrc engine or would that be difficult due to the engine overhauls that goldsrc has had?
something for Netflix
This is like ray casting, but for 1996... genious
how do you organize the tree of portal spaces if one leaf node of the three connects back to a trunk node?
Aren't portals already a thing in Quake? Is it something that was created this month?
They are in original Duke Nukem 3d and gzdoom.
But not seamless ones, only these using black textures, imitating some kind of cursed sky with stars.
@@charlieking7600 Well, as a mod obviously. I would be surprised if it was not done before.
Makes me think if there are other Quake engine games that have portals. I can't remember any.
If only we had real portals back then...
why dont you just render from the portal plane forward, in the new location
yep the portal is a screen surface
so that the portal is the camera surface and the origin is the player, any number of new cameras, portals, and the portal is the forward clipping plane
Recently i implemented portals myself in my experimental softwarte rendering engine. But my portals works differently - this is just a render into texture. And result portal looks not so smooth as yours (is blocky).
How different is this from how Build engine games handled portals? It seems similar, but my knowledge is very limited.
Somewhat, but build is still "2.5D", which simplifies the occlusion tracking, it only needs two integers per raster column to achieve zero overdraw.
However, build has its own sophistication to handle concave sectors (as opposed to doom's convex sectors and quake's convex leaves)
I used to play a mod for Q3 which had portals like this, and it was long before Valve's Portal
Does anyone know that? maybe?
I wondering what it would like to play that again!!!
You probably played Xonotic (previously Nexuiz), which is basically Unreal Tournament with bunnyhopping.
It's built upon Darkplaces and uses gameplay feature known as warp zones. These are seamless portals.
Hello Prey 1995
:-O
👋
Welp, time to make myhouse.bsp
Great stuff, it'd be interesting to see somebody attempt myhouse.wad in the Quake engine using this, the portal rendering would be perfect to pull off some of the tricks required.
I'd like to see that working on original hardware to some extend. Imagine how mind blowing it would be for people back then if this existed at the time? Pretty good video
i think i heard about a portal quake mod back then that was available, but it was so cpu intensive nobody dared use it.
awesome