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

Portal And Forced Perspective Mechanics

Discussion in 'Made With Unity' started by Hamdi Chaker, Mar 16, 2014.

  1. Hamdi Chaker

    Hamdi Chaker

    Joined:
    Mar 16, 2014
    Posts:
    12
    Hi,

    Here's something i did in two weeks. I still need to make small improvements and add some documentation before I can share this on the asset store.

    Tech demo:




    Screenshots:

    $1.png
    $3.png
    $5.png
    $8.png
    $15.png


    Stencil buffer and render textures were NOT used in this project.
    It does not require Unity Pro.

    I'll make a tutorial for the portal effect, you'll find it here:
    http://chakerhamdi.wordpress.com

    Let me know what you guys think.
     
    Last edited: Mar 25, 2014
    REV-FX likes this.
  2. LaneFox

    LaneFox

    Joined:
    Jun 29, 2011
    Posts:
    7,462
    Thats.. Uhm.. Really cool.

    You should spend more time doing ... anything.. And posting it here. =)
     
  3. TheRaider

    TheRaider

    Joined:
    Dec 5, 2010
    Posts:
    2,249
    Will this be a free or paid asset?

    how does it run on mobile?
     
  4. Hamdi Chaker

    Hamdi Chaker

    Joined:
    Mar 16, 2014
    Posts:
    12
    It runs smoothly on mobile, and it'll be a free asset.

    Thanks, I'll do.
     
  5. TheRaider

    TheRaider

    Joined:
    Dec 5, 2010
    Posts:
    2,249
    can't wait!
     
  6. Nyt0x

    Nyt0x

    Joined:
    Feb 3, 2014
    Posts:
    18
    Nice!
    The forced perspective effect is funy!
     
  7. Hamdi Chaker

    Hamdi Chaker

    Joined:
    Mar 16, 2014
    Posts:
    12
    Thanks
     
  8. TheNorthridge

    TheNorthridge

    Joined:
    Jan 4, 2012
    Posts:
    193
    Could you make a Webplayer demo so we can play around with it?

    Looks really good so far!

    -Sean
     
  9. Hamdi Chaker

    Hamdi Chaker

    Joined:
    Mar 16, 2014
    Posts:
    12
    Thanks, the webplayer demo will be online as soon as the asset is ready.
     
  10. Mauri

    Mauri

    Joined:
    Dec 9, 2010
    Posts:
    2,663
    It indeed looks great :) Can't wait for the webplayer demo.
     
  11. imaginaryhuman

    imaginaryhuman

    Joined:
    Mar 21, 2010
    Posts:
    5,834
    Hmm clever.
     
  12. I am da bawss

    I am da bawss

    Joined:
    Jun 2, 2011
    Posts:
    2,574
    LOL, looks pretty awesome!
    Love that forced perspective mechanics. I think that's very clever! I don't think I have seen something like that in any game yet.
     
  13. SubZeroGaming

    SubZeroGaming

    Joined:
    Mar 4, 2013
    Posts:
    1,008
    This is excellent! Keep up the good work. Will be following!
     
  14. gl33mer

    gl33mer

    Joined:
    May 24, 2010
    Posts:
    281
    Extra sweet. Thank you Hamdi.

    Awaiting the tutorial.
     
  15. Dabeh

    Dabeh

    Joined:
    Oct 26, 2011
    Posts:
    1,614
    Very nice, how'd you do the reflections on the floor?

    The camera could use a bit of smoothing, but other than that it looks great. Good work.
    https://www.youtube.com/watch?v=HOfll06X16c
     
  16. MD_Reptile

    MD_Reptile

    Joined:
    Jan 19, 2012
    Posts:
    2,664
    Impressive, I am looking forward to seeing it on the asset store!

    Oh and I am curious what happens when there is not enough space to project the object? Does that ever happen, and if so is the player just blocked from dropping it there? Can it become infinitely smaller or larger to meet any collision distance?
     
    Last edited: Mar 30, 2014
  17. Hamdi Chaker

    Hamdi Chaker

    Joined:
    Mar 16, 2014
    Posts:
    12
    I've been very busy lately.. The player is simply blocked from dropping the object when there is not enough space, the minimun required distance varies according to the taken perspective. Becoming infinitely smaller or larger depends on certain conditions, but it is possible.
     
  18. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    nice, but I do wish some people wouldn't have such twitchy horrible mouse look code.
     
  19. Hamdi Chaker

    Hamdi Chaker

    Joined:
    Mar 16, 2014
    Posts:
    12

    Thank you guys for the feedback.
     
  20. Hamdi Chaker

    Hamdi Chaker

    Joined:
    Mar 16, 2014
    Posts:
    12
    I couldn't agree more
     
  21. ProjectCryken

    ProjectCryken

    Joined:
    Jul 25, 2012
    Posts:
    41
    Do you have an ETA on the tutorial?
     
  22. calmcarrots

    calmcarrots

    Joined:
    Mar 7, 2014
    Posts:
    654
    *Sees turrets*
    *Pulls out pistol* lol

    Looks amazing and I can't believe someone hasnt done this already. Great, great job!!
     
  23. Hamdi Chaker

    Hamdi Chaker

    Joined:
    Mar 16, 2014
    Posts:
    12
  24. Novoga

    Novoga

    Joined:
    Apr 21, 2013
    Posts:
    3
    when ist this finish for the assets store?
    that is really cool can not wait :D
     
  25. Hamdi Chaker

    Hamdi Chaker

    Joined:
    Mar 16, 2014
    Posts:
    12
    Thanks for your interest. I really don't have an exact date as I am extremely busy these days, but I'll try to finish it asap.
     
  26. TomPK7

    TomPK7

    Joined:
    May 15, 2014
    Posts:
    6
    Awesome! I'm looking forward to the tutorial and/or asset.
     
  27. Banksy

    Banksy

    Joined:
    Mar 31, 2013
    Posts:
    376
    Just got your message regarding the invite to enter your portal ;)
    Well here I am .. so far it's looking great... but looks aren't everything as Iearnt after purchasing a portal asset approx. one year ago... support was terrible after I made the purchase... that was the only negativity I felt towards the asset. Your Portal system will shine with some half decent documentation.

    Will this system work in a 3rd person perspective ?

    Can't wait to put it to the test.
     
    Last edited: Aug 4, 2014
  28. Madeck

    Madeck

    Joined:
    Apr 14, 2014
    Posts:
    3
    This is very interesting, I’m wondering how you get the proper render texture for your portal. How can you make sure what is projected actually matches the view?

    EDIT: I had to go back read a bit about Transformation Matrices, and basically instead of calculating a “Reflection Matrix” I make it a “Portal Matrix”. Seems to work fine, except for a strange backfacing bug when the two portals are not parallel.

    Code (CSharp):
    1.  
    2. // 'org' is the original portal transform, and 'dest' the destination.
    3. private static void CalculatePortalMatrix (ref Matrix4x4 portalMat, Transform org, Transform dest) {
    4.   Vector3 translation = dest.position - org.position;
    5.   Quaternion rotation = rotation = dest.rotation * Quaternion.Inverse(org.rotation); // I though it would be the opposite, but trial and error made it look otherwise
    6.   Vector3 scale = new Vector3(1f,1f,-1f); // the last negative scale makes it point in the right direction
    7.  
    8.   portalMat = Matrix4x4.TRS(translation, rotation, scale).inverse;
    9. }
    10.  
     
    Last edited: Dec 4, 2014
  29. sbsimosb

    sbsimosb

    Joined:
    Dec 13, 2014
    Posts:
    12
    wow, tutorial or download please, in your website there isn't
     
  30. Studio_Akiba

    Studio_Akiba

    Joined:
    Mar 3, 2014
    Posts:
    1,421
    We are very interested in this mechanic, the transition between the two is much smoother than others, and does not simply teleport the player to the other one, the movement between the two is much more like portal.

    We would be very interested in working with you to improve this and use this in our future projects, as primarily a graphics and visual physics studio, we always find mechanics like this VERY interesting.

    We are also very interested in a tutorial or release in source code or project files if you are willing to release either publicly or with us, in return we can help you graphically improve this, and hopefully get it looking almost exactly like portal, which would make it very noticeable in whatever you want to use this for in the future.

    Feel free to message us any time on Unity, or just mention us in a reply to this.