Page 1 of 1

Fake Portal Effect

Posted: Fri Nov 14, 2008 11:41 am
by JonayaRiley
Playing around with some proof-of-concept stuff for my next project, I decided to mess around with a little fake portal effect using skyboxes and silent teleporters. I was actually able to get something pretty nice looking, albeit somewhat of a pain in the ass to implement.

The trick is a script that moves the skybox viewpoint around with the player. In this case, it simply takes the x, y, and z coordinates and adds a bit to y (the sectors are lined up on the x-axis) and z to give the proper depth effect when looking through the portal.

The only limitation is that the portal will display HOM or strange artifacts if the player's position would cause the translated values of the skybox viewer to be out of the map geometry (or inside the wrong piece of map geometry), so if you want to use this effect you'll have to set it up with care. Take a look at how I did the effect and you should get an idea of what the limitations are.

I'm sure I could do a more robust version of this with some generic ACS code along with some map spots to get the x,y, and z shift automatically. That way a bunch of portals could be set up using an array in ACS containing the TIDs of the marker spots and associated skybox things, kind of like how weatherFX tracks the weather zone markers and conditions.

Anyway, feel free to mess around with it. I have no idea if this has been done before, but I figured it'd be fun for some people to play with.

Re: Fake Portal Effect

Posted: Fri Nov 14, 2008 12:16 pm
by Remmirath
Neat! Just like Serious Sam portals. :D

Re: Fake Portal Effect

Posted: Fri Nov 14, 2008 1:53 pm
by Isle
heh, i've allready done this in more than a few test wads.
i also used something like it for the chopper in action doom 2.

Re: Fake Portal Effect

Posted: Fri Nov 14, 2008 1:56 pm
by JonayaRiley
Here's a more flexible version, which also shows the main limitations of the effect. First off, currently both portals must be parallel to each other. Also, because the viewpoint is free to move around in the destination sector, you have to be careful about what's in the area behind the destination portal or you might have the portal view clipping through sprites and such, which looks pretty weird.

Re: Fake Portal Effect

Posted: Fri Nov 14, 2008 1:58 pm
by JonayaRiley
Isle wrote:heh, i've allready done this in more than a few test wads.
i also used something like it for the chopper in action doom 2.
I figured someone else would've thought of it. :)

Ironically, I was also working on creating a chopper when I decided to mess around with this.

Re: Fake Portal Effect

Posted: Fri Nov 14, 2008 2:06 pm
by Isle
the main problem with this type of effect is theres no way to get the actual view height of the player. so the portal view dosen't bob along with the player's view.

Re: Fake Portal Effect

Posted: Fri Nov 14, 2008 2:11 pm
by JonayaRiley
Isle wrote:the main problem with this type of effect is theres no way to get the actual view height of the player. so the portal view dosen't bob along with the player's view.
Yeah, also it doesn't move when they crouch, which is pretty weird looking.

Also, since the view isn't actually rendering from the destination spot, what can be done with it is very restricted.

Re: Fake Portal Effect

Posted: Thu Dec 11, 2008 1:01 am
by Spleen
This is very neat! I'm sure it is possible to add crouching support through scripts if needed, if with nothing else then with the input-getting function.

But there's only one viewpoint for everyone, right? So I'm guessing this wouldn't work in multiplayer..

A less hacky way is to do this with cameras, although I'm sure it will not look as good. If the ZDoom engine can draw mirrors, why can't it do a linedef replace? Say, there was a linedef to be rendered... instead of going through that linedef to whatever's behind it, it could skip to an entirely different linedef specified by an action special. Or are stacked sectors used for this kind of thing (perhaps there might be a way to make a portal effect with stacked sectors?)? Sorry for the bump, but I registered after this post was made, and I find this portal effect very interesting. And stacked sectors confusing. =P

Re: Fake Portal Effect

Posted: Thu Dec 11, 2008 1:14 am
by Tormentor667
Someone in the old ZDoom forums already did something similar (yeah, the good old notgod times ;)) but the problem with this is the fact that it won't work in multiplayer games and therefore is by far too limited :(