Indoors portal rendering

Announce new projects or updates of Irrlicht Engine related tools, games, and applications.
Also check the Wiki
Post Reply
TaviO!
Posts: 12
Joined: Sun Sep 20, 2009 6:53 pm

Indoors portal rendering

Post by TaviO! »

Me and a friend have started a project for rendering indoor portals in walls (like in the game Portal, by Valve) using Irrlicht.

We are still at a very crude stage but already have some nice things to show.

The code is not yet available because right now it's just a total mess. We are fixing it and it will be available as soon as possible.

As of now, 2 portals can be created and each one renders what the other is "seeing". The teleportation feature has not been done yet.

Please give us some feedback on suggestions to make it better and the performance obtained when running our program.

Instructions:
-Unpack everything in the same directory.
-Run the executable.
-WASD and mouse for movement.
-Left click creates one portal, right click creates the other.

By the way, we are now thinking about changing the camera angle inside the portal when the player moves relatively to the portal. That is, if the player is looking straight at the portal, the camera should show what the portal is seeing on the direction of its normal. However, if the player looks at the portal from a "crooked" direction, then the camera should pan to the side in order to set the view right. Any thoughts on this?

Below are some screenshots of the portals.

The first screen shows the 2 portals set on 2 different walls:

Image

Here I move closer to one of them:

Image

And now I move close to the other one:

Image

Here is the download link for the program:

http://rapidshare.com/files/297425093/Portal.rar

Any comments will be very appreciated. Thanks!

Edit: Here's a video of a demo stage we made:

http://www.youtube.com/watch?v=me2N9DdriNo

In this demo stage, the player must hit the button (small square) with the bouncing ball, in order to open the door (big rectangle) and reach the end of the level.
Last edited by TaviO! on Sun Nov 15, 2009 5:55 pm, edited 4 times in total.
Stratosphere
Posts: 20
Joined: Wed Sep 09, 2009 11:54 pm

Post by Stratosphere »

You have made my day. :D Get the teleportation ready, I want to use this in my game once your source code it out. Will give credits :)
shadowslair
Posts: 758
Joined: Mon Mar 31, 2008 3:32 pm
Location: Bulgaria

Post by shadowslair »

Hehe! The everlasting portal idea... Since this is done before, I recommend you to take a look at some similar Irrlicht projects, where sources are available.

And for your camera angle problem you may take a look at one mirror class in this forum- it works nice there.

Anyway, good luck! :wink:

@Stratosphere: What`s the problem coding it yourself? :D
"Although we walk on the ground and step in the mud... our dreams and endeavors reach the immense skies..."
Stratosphere
Posts: 20
Joined: Wed Sep 09, 2009 11:54 pm

Post by Stratosphere »

Nothing is wrong with coding stuff yourself, but if something is already being done, why reinvent the wheel? He's doing a good job and the other ones as far as i know are outdated.
Virion
Competition winner
Posts: 2148
Joined: Mon Dec 18, 2006 5:04 am

Post by Virion »

nice one 8)
shadowslair
Posts: 758
Joined: Mon Mar 31, 2008 3:32 pm
Location: Bulgaria

Post by shadowslair »

Before you start with the teleportation you`ll need to place your portals properly. Otherwise you`ll get many bugs.

1. Your portal size has to be bigger than your character`s one.
2. You`ll need to get not just one triangle, but a bunch of triangles, then check all their vertices and if they are on the same plane and you have enough space for your portal, then place it. Otherwise check some combinations and try placing it close to the "Willing position".
3. You may need to use the Portal Bounding box for those checks, you`ll need it for the teleportation too.

Here are some bad placements:
Image :wink:
"Although we walk on the ground and step in the mud... our dreams and endeavors reach the immense skies..."
TaviO!
Posts: 12
Joined: Sun Sep 20, 2009 6:53 pm

Post by TaviO! »

Thanks for the tips!

Our next step now is to find out how to check for triangles adjacent to the one picked by the player.

Having the portal's size be bigger than the character' height is a very good idea. That way, we can guarantee that if a portal has been created, than the player can teleport though it.

I'm planning on building a bigger map for the character on irrEdit though. Time to say goodbye to our friend from the tutorial.
Mel
Competition winner
Posts: 2292
Joined: Wed May 07, 2008 11:40 am
Location: Granada, Spain

Post by Mel »

What i see is that those portals aren't actually portals, They're textures with rendered images, but not portals at all. If it was a portal, then, it should not look like a plane.

In Valve's portals you can look through one and see exactly like you were watching through a window, not a flat screen.

Then, saving that point, the idea seems interesting.
"There is nothing truly useless, it always serves as a bad example". Arthur A. Schmitt
christianclavet
Posts: 1638
Joined: Mon Apr 30, 2007 3:24 am
Location: Montreal, CANADA
Contact:

Post by christianclavet »

Nice.

Portals are not used that much, and it's a nice idea that could be combined with lot of stuff.

Imagine a coop-deadmatch area with 4-16 players trying to trap others with portal guns. That could be interesting. The portal is just a game ingredient, that doesnt make it a game by itself. (Take PREY for example, they had fixed PORTALs), Valved only added a new twist as they now could be projected by the player...

Only need imagination to go further...

NOTE: Mel, I think they use that same technique on Valve, it just that their presentation is much cleaner (fade out the border and put an animated alpha) The idea is to match the perspective and It seem nicely done, just need some polishing. Also the texture of the level is very low. Pixels are big as planets! :)
DeM0nFiRe
Posts: 117
Joined: Thu Oct 16, 2008 11:59 pm

Post by DeM0nFiRe »

Actually, mel is talking about the projection. In Portal, it looks (to the eyes) like the portal may very well be just a whole in the wall, on this one here you can see clearly that it is something being drawn on the wall. I think you just need to change the projection so that it looks like it's a continuation of the same space.
christianclavet
Posts: 1638
Joined: Mon Apr 30, 2007 3:24 am
Location: Montreal, CANADA
Contact:

Post by christianclavet »

I think you're right. Seeing the pics again, for me it's seem the picture is stretched too much vertically. The proportions are not right, but the perspective depth seem ok.
DeM0nFiRe
Posts: 117
Joined: Thu Oct 16, 2008 11:59 pm

Post by DeM0nFiRe »

nah, to me the perspective depth is quite clearly off. If you look at the portal, the "infinity point" is clearly much closer to the camera than in the larger scene.
TaviO!
Posts: 12
Joined: Sun Sep 20, 2009 6:53 pm

Post by TaviO! »

Just a quick update:

We implemented an algorithm to determine if a portal fits on the wall the player clicked on. We decided to use line collision detection to search for adjacent triangles. This was a little troublesome, because there's no native way to detect collision between 3D lines in Irrlicht. We didn't really understand why, does anybody know about this?

The workaround was to use the shortest distance between two 3d lines.

If anyone is interested in this algorithm, I can post it here.

We are still working on the perspective thing, will post news here when we get something.

Thanks for all the suggestions!
TaviO!
Posts: 12
Joined: Sun Sep 20, 2009 6:53 pm

Post by TaviO! »

Updated the first post with a video of a demo stage.

In this demo stage, the player must hit the button (small square) with the bouncing ball, in order to open the door (big rectangle) and reach the end of the level.
Post Reply