Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Prey style portals!

Discussion in 'Made With Unity' started by NathanWarden, Nov 3, 2009.

  1. NathanWarden

    NathanWarden

    Joined:
    Oct 4, 2005
    Posts:
    663
    Here's something I wanted to try and accomplish, Prey-like portals. So, I worked on it a little last night, this morning and tonight :)

    Here are some links :)

    Web player:... mouse didn't seam to work in IE
    http://web.mac.com/nathanwardenlee/Unity/Players/Samples/Portals.html

    Web player download:
    http://web.mac.com/nathanwardenlee/Unity/Players/Samples/Portals_WebPlayer.zip

    Mac:
    http://web.mac.com/nathanwardenlee/Unity/Players/Samples/Portals_Mac.zip

    Win:
    http://web.mac.com/nathanwardenlee/Unity/Players/Samples/Portals_Win.zip
     
  2. jaxas

    jaxas

    Joined:
    Mar 22, 2009
    Posts:
    59
    Something is wrong with mouse x axis movement in Win compilation :?
     
  3. VoxelBoy

    VoxelBoy

    Joined:
    Nov 7, 2008
    Posts:
    240
    Very nice work! There's still room for improvement, especially in making the movement into and out of the portals seamless (no jump should be felt) however I can say that this is one of the best attempts I've seen in a while. Are you going to build upon this or is it a one-time experiment?
     
  4. MikeHergaarden

    MikeHergaarden

    Joined:
    Mar 9, 2008
    Posts:
    1,027
    The moving "donut portal" was awesome. I hope you can reduce the "jump/lag", should be possible.
     
  5. psychicparrot

    psychicparrot

    Joined:
    Dec 10, 2007
    Posts:
    884
    Awesome portals!

    I know that there is the slightest little jump, but you could probably hide that with a particle effect!

    Just a little flash as you go through would totally hide it.

    Great work!
     
  6. JAMiller

    JAMiller

    Joined:
    Apr 2, 2009
    Posts:
    78
    Wow! Amazing work!

    I was wondering if this was possible the other day, and you answered it for me!

    Hey, also, hows Modo + Unity? I'm interesting in learning Modo but want to test it in Unity before I go too far.
     
  7. NathanWarden

    NathanWarden

    Joined:
    Oct 4, 2005
    Posts:
    663
    Hey Everyone,

    Thanks for the kind words :)

    As for the bugs, I don't really have time to fix any of them since I really need to focus on my "Real Job" which I really enjoy anyway, but, that's why I'm just giving you all the project for free! :)

    I tried to upload it to the forum, but, it kept timing out...
    http://web.mac.com/nathanwardenlee/Unity/Players/Samples/PortalsProject.zip

    The only thing I ask is... if you can fix the bugs, please post up the fixes for everyone to be able to get to.

    @VoxelBoy: Yeah, I just wanted to see if it could be done and it is, so, I'm bored now, haha :)

    @JAMiller: If you don't need character animation, I personally find the Modo to Unity pipeline to be great!!!

    There's a UV bug as of 302 (the version I have), but, just PM me if you run into it as there's a pretty simple solution for it.

    Thanks,
    God Bless,
    Enjoy,
    Nathan
     
  8. HiggyB

    HiggyB

    Unity Product Evangelist

    Joined:
    Dec 8, 2006
    Posts:
    6,183
  9. Discord

    Discord

    Joined:
    Mar 19, 2009
    Posts:
    1,008
    I saw that the other day. Those are some awesome graphics for the iphone.
     
  10. psychicparrot

    psychicparrot

    Joined:
    Dec 10, 2007
    Posts:
    884
    Wow that Portal vid is awesome! Unity really does rock, doesn't it? :)

    Nathan - thank you SO MUCH for sharing your code with the community. That's an awesome thing you did and great for people to learn from.
     
  11. makaleth

    makaleth

    Joined:
    Aug 12, 2009
    Posts:
    56
    I love the how open this community is. Good work Nathan.

    Wow at the iphone demo of portal. How do they do the portals without render texture?

    or do they use it, i didnt think it was available on iphone? :roll:
     
  12. JAMiller

    JAMiller

    Joined:
    Apr 2, 2009
    Posts:
    78
    Now you got me wondering... It's possible based on what I see in this video it's just duplicating rooms and making doorways into them. Notice its just a big cube and he only puts the portals on the outer walls... You could theoretically just duplicate and mirror the room and it's objects to fake a portal this way.

    I'm just speculating really, I actually have no idea if render to texture is available on iPhone.
     
  13. NathanWarden

    NathanWarden

    Joined:
    Oct 4, 2005
    Posts:
    663
    Wow! I love Portal! Great game!



    @Higgy: Thanks Higgy! Sweet video too :) I love that game! Didn't play it on the iPhone, but played the one bundled in the Orange Box and it's super addicting!

    @psychicparrot: No problem, I just hope someone is willing to track down the couple of bugs in it (I may do it one of these days) and share it with others :) I'm really excited to see if anyone will make something with this :)

    @makaleth: Thanks makaleth! The thing is that these portals don't have to use a render texture. It's a 2 camera setup with a depth mask shader on the portal. I don't write for the iPhone, but, I'm assuming it can have a two cam setup too. Doing this is actually a lot less complex than it may look at first glance :)
     
  14. NathanWarden

    NathanWarden

    Joined:
    Oct 4, 2005
    Posts:
    663
  15. jtbentley

    jtbentley

    Joined:
    Jun 30, 2009
    Posts:
    1,397
    I thought the visuals in the portal demo were extremely average (that being said, portal itself wasn't exactly a 'stunner' in terms of looks).

    But, much like the game it was based on, it looks like it could be made into a great game :)
     
  16. bloodtiger10

    bloodtiger10

    Joined:
    Nov 9, 2008
    Posts:
    619
    lol ummm... are you supposed to fall through the floor when you go through a portal?
     
  17. MikeHergaarden

    MikeHergaarden

    Joined:
    Mar 9, 2008
    Posts:
    1,027
    For a multimedia master course I'm creating a "House of the future" application which features several media integrations (twitter messages, augmented reality, etc.).

    To make it somewhat of a Unity showcase too, I'm integrating several "cool" things as well, including this.

    So if you could post your latest build/fixes, please do so :).

    See the status/concept of my project here: http://www.few.vu.nl/~mhn212/mt/
     
  18. psychicparrot

    psychicparrot

    Joined:
    Dec 10, 2007
    Posts:
    884
    Hey Leepo, I went to your house and trashed it. Stuff was everywhere, man. I even threw your laptop!

    THEN I went to the bathroom - man, the house of the future really needs a cleaner. There is some serious limescale build up in the sink, toilet and bath. I would recommend bleach ;)

    Nice demo - not sure why it would need portals, but hey if it's a house of the future then in the future I know I want some portals around the place so ... cool!

    :D
     
  19. MikeHergaarden

    MikeHergaarden

    Joined:
    Mar 9, 2008
    Posts:
    1,027
    @psychicparrot
    Thanks..but was this really necessary?


    The current demo was made only to fix the walker, interaction and physics. It uses the shadow demo assets&apartment, these assets will be replaced. The real house will feature 2 floors and 9 rooms. The portals will make a bit more sense there ;).

    Anyway, I won't hijack this thread any further, once it's next to finished I'll create a showcase topic.
     
  20. horus5

    horus5

    Joined:
    Nov 26, 2009
    Posts:
    14
    Wow great work , especially the portal cameras. Nicely done :D
     
  21. Dragon Rider

    Dragon Rider

    Joined:
    Jan 17, 2008
    Posts:
    280
    Very nice effect! Quite awesome.

    The Webplayer Demo has lots of collision glitches though. I fell through just about everything I touched, and while I could climb back onto them I eventually ended up outside the box and falling to nowhere.
     
  22. defmech

    defmech

    Joined:
    Feb 24, 2007
    Posts:
    506
    Any chance of getting the updated project file for this? I've got something I want to try :)
     
  23. gamenut30111

    gamenut30111

    Joined:
    Nov 7, 2009
    Posts:
    399
    i dont think he meant for the game to be graphically stunning, it was more of a test with portals, and a succesful one.
     
  24. NathanWarden

    NathanWarden

    Joined:
    Oct 4, 2005
    Posts:
    663
    Hey guys,

    I know I just dug up an old thread, but hey, it's my old thread to dig up!!! :)

    Anyway, at one point I think I said that I would possibly share the source to this project. So, without further ado (and without many improvements since the last post) here's the whole mini-project... Hope you enjoy and can do something with it :)

    http://web.mac.com/nathanwardenlee/Unity/Projects/Portals/Portals.zip

    Nathan
     
    Last edited: May 7, 2011
  25. Artimese

    Artimese

    Joined:
    Nov 22, 2009
    Posts:
    794
    I didn't even know someone made something like this in unity... like 2 years ago, it'll be awesome to play around with this to see how you managed this, awesome stuff
     
  26. zine92

    zine92

    Joined:
    Nov 13, 2010
    Posts:
    1,347
    Cool. It is nice..
     
  27. macdude2

    macdude2

    Joined:
    Sep 22, 2010
    Posts:
    686
    I really can't figure out how you did them. I have heard of people creating portals using render textures and I have heard of people making portals by duplicating the scene. It does not look like you have used either of these methods. How were you able to do this??
     
  28. maart

    maart

    Joined:
    Aug 3, 2010
    Posts:
    82
    cool, it's bigger on the inside then on the outside!
     
  29. rumblemonkey

    rumblemonkey

    Joined:
    Mar 25, 2011
    Posts:
    280
    That is really classy! Mix in some good art and lighting, a scary feel to the audio, and you could make a really super Creepy Castle experience with this :)
     
  30. jeffro11

    jeffro11

    Joined:
    Jan 7, 2010
    Posts:
    185
    I just finished my own system last night! I will have to see how he made this as mine is a bit buggy! Good work, really nice.
     
  31. spinaljack

    spinaljack

    Joined:
    Mar 18, 2010
    Posts:
    992
    Thanks for sharing the code, very generous
     
  32. NathanWarden

    NathanWarden

    Joined:
    Oct 4, 2005
    Posts:
    663
    Thanks Zine and Maart, I appreciate it.

    Yeah, I suppose you can do many cool things with Portal games. This was more of a tech test than anything with no real plans for use in the future.

    Sounds good to me, it's very easy for bugs to creep into something like this.

    No problem... anytime :)
     
  33. NathanWarden

    NathanWarden

    Joined:
    Oct 4, 2005
    Posts:
    663
    Hi MacDude,

    Once you get the concept down it's pretty simple. What this particular system uses is a "Depth" shader on each portal which cuts a hole in the top camera. Then, I match the local position and rotation onto the backside of the portal exit which fills in that hole with its' render.

    If you don't understand what I said above, but are familiar with cutting a hole into a Unity terrain, it has a lot of similar concepts (and is actually where I got the idea of how to do this).
     
  34. macdude2

    macdude2

    Joined:
    Sep 22, 2010
    Posts:
    686
    I didn't realize it was that easy. I wanted to see if it would work on the iphone and it works perfectly. Very nice job.
     
  35. NathanWarden

    NathanWarden

    Joined:
    Oct 4, 2005
    Posts:
    663
    Cool, thanks for sharing, I didn't ever really consider whether it would work for the iPhone or not.

    Thanks :)
     
  36. CkSned

    CkSned

    Joined:
    Nov 26, 2010
    Posts:
    175
    Dam that was awesome.
     
  37. macdude2

    macdude2

    Joined:
    Sep 22, 2010
    Posts:
    686
    the only problem with this setup is if something gets between the portal rendering camera and the portal, this object is still rendered. Some how you need to be able to rotate the the near clipping pane so that everything between the camera and the portal is clipped. Is this possible though? I was also thinking you could set up some system that detected whether or not an object in the scene was between the camera and the portal, but this would only work if all the walls were made up of separate objects. Does anyone else have any other ideas to solve this problem? It would be cool to have a no bugs portal setup to use in unity.
     
  38. Rush-Rage-Games

    Rush-Rage-Games

    Joined:
    Sep 9, 2010
    Posts:
    1,997
  39. knowledgehammer

    knowledgehammer

    Joined:
    May 11, 2007
    Posts:
    12
    None of the current files are downloadable, and i was praying you had an updated link for downloads...
     
  40. skigoddard

    skigoddard

    Joined:
    Sep 2, 2012
    Posts:
    4
    Any chance you could fix the links?
     
  41. NathanWarden_old

    NathanWarden_old

    Joined:
    Oct 4, 2005
    Posts:
    37
  42. skigoddard

    skigoddard

    Joined:
    Sep 2, 2012
    Posts:
    4
    Thank you!

    Do you think you could make a prefab of just the portals for people to use? Or a tutorial on how to use your scripts? I'm trying to make a TARDIS, but I'm having some trouble. I can't figure out how the system works!

    Thank you!
     
  43. V

    V

    Joined:
    Oct 26, 2012
    Posts:
    1
    Hi Nathan. Thanks for sharing your portal system with the community. I've been dinking around with it for a while, and I got a few questions. First, It's definitely possible to make the depthmask completely transparent, as the guy who made "Portalizer" has shown by using "ColorMask 0". I'm trying to figure out the FadeDistances. I noticed if i keep them 2.5 apart, it stays consistent but once i get into the 20's there's problems with the portal rendering (if i walk too far left and look at the portal it renders it from "entrance camera" which seems to follow the player". Also, I'm wondering if it would be possible to support third person player and animations through portals. How much extra work would it be to implement this? Thanks.
     
    Last edited: Oct 26, 2012
  44. ChuckB

    ChuckB

    Joined:
    May 3, 2013
    Posts:
    2
    Hey Nathan this is a cool project you've handed out to the community. I'd like to second skigoddard and say it would be great to have a prefab for this. I'd love to play with the portals in some of my foolings around as well. I've tried to use the portals by bringing in the scripts and tinkering with this and that, but as a simple game artist I'm not advanced enough to understand everything I need to get it working. A write up would go a long way too!

    Really cool, and thanks for sharing it. Back to tinkering. :)