Posted: 24th Jun 2007 22:22
Portals have always interested me, and I've wanted to make a mini game with them but can I be done in DBP as effectively as seen in recent games. The team that created Narbacular Drop that was hired by Valve to work on Portal made a game design document and here’s the portal bit:


Portal Effect
The creation of our portals takes place with some extremely simple trickery along with a lot of
tedious things to make it work well.
Essentially, a portal is just a textured quad. But the contents of the texture are dynamic and the
texture coordinates change based on how you're looking at the quad.
To create the contents of the texture:
1. Convert the current camera position and look vector into coordinates relative to the portal.
2. Find this position and rotation in relation to the portal's exit.
3. Move the camera to the point and rotation found in step 2.
4. Render the scene while culling all objects between the camera and the portal exit.
5. The render surface is now the source texture for the portal and the camera should be moved back
to where it was before step 1.
To render the quad with the proper texture coordinates:
1. Convert each coordinate into screen space.
2. Copy the normalized screen space x and y components into the u and v coordinates of each vertex.
3. Render the quad.


Can this be done in DBP? Awhile ago, Van B made a portal demo that was very effective and the thread was never continued, did anyone else catch this?
Posted: 24th Jun 2007 22:46
Sorry thats the technical design document. Anyway, if you haven't checked Narbcular Drop out to should have a play, it's good fun.

http://www.nuclearmonkeysoftware.com/narbaculardrop.html
Posted: 25th Jun 2007 2:03
Ruccus also did a really good portal demo
Posted: 25th Jun 2007 2:07
And I think Green Gandalf (or someone) made an awesome shader.
Posted: 25th Jun 2007 2:09
Yeah, I remember those videos, they were great. GG's Portal shader v3 I think it was, I couldn't get it working.
Posted: 25th Jun 2007 2:21
Would someone please post a link to their references?
Posted: 25th Jun 2007 2:27
I think this is the main one: Geek Culture / Half-Life 2 Portal Demonstration...
http://forum.thegamecreators.com/?m=forum_view&t=84337&b=2

Another: DarkBASIC Pro / Now arriving at Portal City...(very long tilte)
http://forum.thegamecreators.com/?m=forum_view&t=105114&b=1
Posted: 25th Jun 2007 20:29
IIRC my method was positioning a camera infront of each portal (infront as in, a few units past the portal, to avoid clipping the portal plane), and having the portal cameras rotate as the user's camera did, to allow the user to "look around" where the portal leads to without going through... Then just use the set camera to image commands and texture the opposite portals.
Posted: 25th Jun 2007 21:11
The only problem is the way in which the image is mapped on to the portal, so when you get up close the portal appears to be flat.

Here that demo that Van B made:
http://forumfiles.thegamecreators.com/?i=947934

How was that made? I think its a very good camera trick that simulates a portal but doesn't work like one, though I maybe wrong.
Posted: 26th Jun 2007 4:11
:/ they didnt seem flat to me... that was why I made the cameras rotate with the user..

But yes Van's is much better.
Posted: 28th Jun 2007 15:52
I would like to start a simple project or you could call it a challenage, to create a portal demo. Not moving portals or portals that you fire (for now), just static ones.

The project: Simple Portal Demo
- Two static portals in a room, one the enterace an the other the exit (and visa versa).
- Portals need to feel and look like a hole in 3d space not a visible image on an object (Green Gandalf's portal shader demo achieved this and Van B's one, so it can be done).
- The quote in my first post has intructions on how to achieved the this but I'm not that good of a programmer.

Just think if we made a community based portal game, where anyone could make a map and set challenages for everyone else (hope they do this for Valve's Portal, then again you could always mod a Valve game). Is anyone up for it?
Posted: 3rd Jul 2007 0:23
Take a look at this picture of Prey I took:


I looked at tutorials and 3d portal engines and they all say the same thing, its a textured quad plus there not using shaders. I can't understand how you could get an image on a quad to look as accurate as a camera and the transition between portals is amazing, how is this done without clipping the portal quads, I'm lost.
Posted: 28th Sep 2007 14:08
Oh yeah "Van B's" demo is awesome.
Posted: 24th Jan 2008 16:38
Hey, anyone with expiriance want to help me make a Portal Plug in for DBPro? using C++ and Aaron Miller's Plug in SDK? so instead of creating the portals in DBPro and have tons of code, you could make a plu in for it that did that with just a few simple portal commands. Anyone care to help me? Would be free of course unless we decide to make the plug in piced. all i know is that a plug in for DBPro that did portals internally would be better then writing your own code in DBPro to do the same.
Posted: 24th Jan 2008 17:03
Take it you made that Chris? - I remember the thread and the demo, but I didn't make them. It is a nice proof of concept, these days I think it's more likely to involve a shader, that was all pure DBPro code, memblocks?
I don't think we even had vertex manipulation back then. I suppose if someone based the shader on a refraction shader then it could have normal map ripples, could look incredible if done properly.

Funny how things come full circle, I think that thread started because of the portal demo, now the full games out, portals are flavor of the month again. Portal is one of the best games I've played in years, hope someone expands on the idea in DBPro.
Posted: 25th Jan 2008 12:09
I looked at tutorials and 3d portal engines and they all say the same thing, its a textured quad plus there not using shaders. I can't understand how you could get an image on a quad to look as accurate as a camera and the transition between portals is amazing, how is this done without clipping the portal quads, I'm lost.

Chris K's demo was perfect - the textured image was the same as the real room and there was no clipping.

@Chris K -
Did you ever post the source for that?
Posted: 26th Jan 2008 22:07
Never thought this would come up again, good to see an interest still.

All I can say is the same as Cash:

@Chris K -
Did you ever post the source for that?
Posted: 31st Mar 2008 16:45
Thought I would bring the topic back up again, portals have be bending my mind ever since the first Prey in the 90's(I think), then came Narbacular Drop, valve hire the creators of Narbacular Drop which gave birth to Portal. We've seen DBP can also make portal but we've never got the formula down.

So I've been studying abit and I think shaders are the way to go, but I have no clue where to start in creating a portal shader. I thought if I created a sort of post reflection shader that reflects from the opposite portal which is draw on to the other portal (not really a reflection, but I don't no what you call it).

Can anyone help?
Posted: 31st Mar 2008 20:39
This is alot harder than I thought. I've search the net and the forums for infomation on how reflections work and if there are any shaders out there, but can't find any, they're alway a reflection with another effect(normal mapping or water). Has anyone got any link's?
Posted: 31st Mar 2008 21:16
Is portal which you look for BSP?
Is it BSP and PVS to be included in in Quake-game?
I do not know it in detail.
There are a lot of English documents on a net.