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

[RELEASED] Gater (Portals System)

Discussion in 'Assets and Asset Store' started by Deleted User, Apr 5, 2016.

  1. keffertjuh

    keffertjuh

    Joined:
    Oct 14, 2015
    Posts:
    7
    Just for your information; that particular problem occurs even outside of VR by enabling the option.
    I'll look into the things you said, though :)

    EDIT: turns out you actually need to have a VR headset connected for the issue to occur, my bad
     
    Last edited: Aug 12, 2016
    Deleted User likes this.
  2. Deleted User

    Deleted User

    Guest

    Mhh...seems more a Unity bug that others.

    Anyway what are the passages that have you followed for adapting Gater to VR, and, this method work for every type of VR?
     
  3. keffertjuh

    keffertjuh

    Joined:
    Oct 14, 2015
    Posts:
    7
    I'm not that deep into this sort of stuff, I just understand things as I look through them.
    I only know how to work with the SteamVR plugin, haven't bothered with anything else yet.
    My approach is pretty much to turn 1 camera into 2 right now, which is just doubling the workload, nothing too special about that.

    I first replaced any references to the FPS script within the PortalManager script by a Player script I placed similarly, to remove the need to use that particular package (the Player script is empty, so I could've used a tag, but I was lazy about that) . Any FPS specific stuff I commented out since it was just aimed at making that particular usage work. This worked fine.

    The only thing I achieved so far VR-wise is being able to distinguish each eye, thus allowing me to (potentially) create a separate view for each, but since the other-side-camera transform relation appears to get messed up in VR mode even using the base package on a flat screen there's no point in diving further until I get that sorted, since I need the proper perspective (the image seems to move different from my perspective; sadly I couldnt use scene view to check this out since the portal doesn't work right with that open)

    Another few issues I encountered:
    - The script only worked properly if I kept the name 'PortalManager' for some reason (might've been other factors involved)
    - The VR cameras don't teleport at pass-through, nor does the image get split in while passing through sideways (This is probably a hierarchy thing, but I've yet to figure that out)

    EDIT: Since the pass-through effect is fine, it must indeed be the projection.
    Sadly my shader knowledge doesn't go beyond being able to read and somewhat understand shader scripts.
    EDIT2: The SteamVR script seems to enforce a certain positioning for the cameras that I cannot override, which would mean I wouldnt be able to pass through 1 eye at a time, thus requiring a redo of that setup as well.

    I think this has outgrown my capabilities a good while ago :(
    Quite a shame, since it was something I really wanted to use as trippy yet seamless way to pass from one scene setup into another.
     
    Last edited: Aug 12, 2016
  4. Deleted User

    Deleted User

    Guest

    Thanks :)

    And regards the two issues, the first if I not wrong it's caused by some references needed to the script (or simply from entire class name that include the various functions start, update ecc...), and the second it's caused by technique used for teleporting camera, that it's still based on transition of one camera. A thing that require only a few changes.
     
    Last edited by a moderator: Aug 12, 2016
  5. AndersMalmgren

    AndersMalmgren

    Joined:
    Aug 31, 2014
    Posts:
    5,358
    Hey there.
    If you want to support VR you can look into this thread.

    http://forum.unity3d.com/threads/5-...wrong-in-openvr-htc-vive.398756/#post-2623563

    Basicly you render the rendertexture twice and change the perspective between renders, to determin which eye is being rendererd you do

    Code (CSharp):
    1. #ifdef UNITY_SINGLE_PASS_STEREO
    2.                 leftEye = unity_StereoEyeIndex == 0;
    3. #else
    4.                 leftEye = (unity_CameraProjection[0][2] <= 0);
    5. #endif
    6.                 if (leftEye)
    7.                 {
    8.                     refl = tex2Dproj(_LeftReflectionTex, UNITY_PROJ_COORD(i.refl));
    9.                 }
    10.                 else
    11.                 {
    12.                     refl = tex2Dproj(_RightReflectionTex, UNITY_PROJ_COORD(i.refl));
    13.                 }
    14.                 return tex * refl;
     
    Deleted User likes this.
  6. Deleted User

    Deleted User

    Guest

    Thanks, I will work on this in the next days. :)
     
    AndersMalmgren likes this.
  7. Deleted User

    Deleted User

    Guest

    Hi everyone.

    Version 1.1.8 has been submitted. Changelog:

    - VR support (read Note**).
    - Fixed a bug where rendering on Android devices was black.
    - VR scene has been added.

    Note**: Based on comment of @keffertjuh I have added VR support (still untested, because unfortunately I haven't one), then I ask you to help me pointing to the appropriate changes to be implement (in case will be necessary). :)

    RELEASED!
     
    Last edited by a moderator: Oct 20, 2016
  8. AndersMalmgren

    AndersMalmgren

    Joined:
    Aug 31, 2014
    Posts:
    5,358
    Its still the 1.1.6 version on the store?
     
  9. Deleted User

    Deleted User

    Guest

    Yes, I'm still wait a status update email.
     
  10. mirt

    mirt

    Joined:
    Jan 10, 2013
    Posts:
    5
    I used your asset previously in a non VR way, but I also own an HTC Vive. So I thought I would try and be helpful, just in case you wanted to see what your example looked like in VR. :)

    http://imgur.com/a/uZ79C
     
    Deleted User likes this.
  11. AndersMalmgren

    AndersMalmgren

    Joined:
    Aug 31, 2014
    Posts:
    5,358
    Yeah its not working, tried both with SIngel pass and not
     
    Deleted User likes this.
  12. Deleted User

    Deleted User

    Guest

    Maybe you can try your method (twice and change perspective of rendertexture).
     
  13. keffertjuh

    keffertjuh

    Joined:
    Oct 14, 2015
    Posts:
    7
    Ah shame, thought you got the gear and figured it out.
    Hope you didn't think what I had was a solution yet, but good on you for trying :)
    The visual offset thing was an issue I had as well, and had me stuck. It might be caused by the way the cameras are set up for VR, but I honestly have no clue. Never bothered to dive into things any further myself.

    Did some basic googling and maybe you can hack together something that works on your phone with a Google Cardboard using a 'solution' like https://riftcat.com/vridge to playtest with if you feel like it. If you get something that might be on the dot, there's bound to be people willing to help you tweak it by doing proper playtesting with a full-on headset.

    I'd also recommend not pushing a build to the store until you know it's solid because reviews, but that's up to you :)
     
  14. Deleted User

    Deleted User

    Guest

    I know, but unfortunately its not a something that I can test or (in case) fix in a simply way, and always for the same situation, also because my goal is to achieve the maximum compatibility with more used headsets.

    Anyway I will equally try to find a way to fix this.

    P.S = Don't forgot that this latest version that I released, its primarily useful to correct the rendering bug on Android devices. :D
     
    Last edited by a moderator: Sep 27, 2016
  15. Deleted User

    Deleted User

    Guest

    It's recursive!



    Yes folks, at the end it's happened, and a new version it's coming soon :D
     
    FreakForFreedom and hopeful like this.
  16. Deleted User

    Deleted User

    Guest

    Hi everyone.

    Version 1.2.0 has been submitted. Changelog:

    - Recursion effect (portal in portal) has been added with customized steps amount.
    - Scene "Object fall with recursion" has been added.
    - Partial VR support has been removed due to further researching.
    - Scene "VR" has been removed.

    RELEASED!
     
    Last edited by a moderator: Oct 20, 2016
  17. keffertjuh

    keffertjuh

    Joined:
    Oct 14, 2015
    Posts:
    7
    HTC has provided a stereoscopic rendering solution (https://www.assetstore.unity3d.com/en/#!/content/71255), but I don't know if you can do anything with it.
    They provide a way to repurpose flat surfaces as VR mirrors or projections you can use for portals, but it doesn't provide functionalities you do, such as standing halfway through the portal, which is immersion breaking to me personally.

    In any case, someone else lurking here might have a use for it and you might wanna have a look yourself just for good measure :)
     
    Deleted User likes this.
  18. Deleted User

    Deleted User

    Guest

    At this point I can't do anything without externals testers, but with latest 1.20 version find a solution could be more simply (rendering of camera happen directly from script).
     
  19. Deleted User

    Deleted User

    Guest

    Hi everyone.

    Version 1.2.1 has been submitted. Changelog:

    - Fixed a bug where clippings of objects inside portal don't appear correct during recursions.

    RELEASED
     
    Last edited by a moderator: Apr 10, 2017
  20. RkSanders

    RkSanders

    Joined:
    Jun 28, 2011
    Posts:
    26
    Just trying out this package for the first time. fyi ver1.2.1. has a null ref and won't compile for a standalone build. If any users looking for fix, change line to 'LocMetdCurrentCam = InGameCam;'

    Assets/Gater/Scripts/PortalManager.cs(152,45): error CS0103: The name `MetdMainCam' does not exist in the current context
     
    Last edited: Nov 6, 2016
    hopeful and Deleted User like this.
  21. Deleted User

    Deleted User

    Guest

    I Will check tomorrow.

    Edit: I have resend the same version with fix.
     
    Last edited by a moderator: Nov 8, 2016
  22. FreakForFreedom

    FreakForFreedom

    Joined:
    Jan 22, 2013
    Posts:
    156
    It's so amazing that you keep updating this great asset! Thanks a bunch, awesome Sir! :)
     
    hopeful likes this.
  23. Knightwing

    Knightwing

    Joined:
    Aug 21, 2015
    Posts:
    15
    Hey H92.
    First off, a big thanks for this asset and making it free!
    I have been trying to test it out and the demo scenes work great, but when I try using my character (a vehicle) to go through a portal, the scene crashes and throws up an error message:

    NullReferenceException: Object reference not set to an instance of an object
    PortalManager.OnTriggerStay (UnityEngine.Collider collision) (at Assets/Gater/Scripts/PortalManager.cs:455)

    I assume it's some kind of error with the vehicles colliders? Is there a way to let the vehicle through?

    Also, you mention some notes in a previous post, but the asset doesn't have any notes (or do you mean the notes in the code?).
     
  24. Deleted User

    Deleted User

    Guest

    Strange, have you tried to understand which line generate this error? Maybe the vehicle controller creates a problem on the second portal clone.

    P.S = Yes, i'm refer to comments lines into portals script.
     
  25. Knightwing

    Knightwing

    Joined:
    Aug 21, 2015
    Posts:
    15
    I turned off any scripts attached to the vehicle and put it as an object in the ping pong demo (so it just drops into the portals)... but still the same problem, the scene crashes when the vehicle touches a portal.

    The line in the portals script is this one:

    Code (CSharp):
    1. CloneCollidedObjs [i].GetComponent<MeshRenderer> ().sharedMaterial.CopyPropertiesFromMaterial (CollidedObjsInitMaterials [i].Materials [0]);
    from here:

    Code (CSharp):
    1. if (CloneCollidedObjs [i].GetComponent<MeshRenderer> ()) {
    2.                                 if (EnableClipPlaneObjs) {
    3.                                     CloneCollidedObjs [i].GetComponent<MeshRenderer> ().sharedMaterial = CloneClipPlaneMaterial;
    4.                                     CloneCollidedObjs [i].GetComponent<MeshRenderer> ().sharedMaterial.CopyPropertiesFromMaterial (CollidedObjsInitMaterials [i].Materials [0]);
    5.                                 }
    6.                                 if (!EnableClipPlaneObjs) {
    7.                                     CollidedObjs [i].GetComponent<MeshRenderer> ().sharedMaterials = CollidedObjsInitMaterials [i].Materials;
    8.                                     CloneCollidedObjs [i].GetComponent<MeshRenderer> ().sharedMaterials = CollidedObjsInitMaterials [i].Materials;
    9.                                 }
    10.                             }
    But my coding skills are noob level so I don't really understand the problem.

    EDIT: the vehicle is this one from the asset store:
    https://www.assetstore.unity3d.com/en/#!/content/68558
     
    Last edited: Nov 9, 2016
  26. Deleted User

    Deleted User

    Guest

    Ok now the question is more clear.

    in practice when the clone is generated, the script makes sure that the new material receive the same settings of the original, but in this case incur in an error.

    Anyway I will check this problem tomorrow.
     
    Last edited by a moderator: Dec 28, 2016
    Knightwing likes this.
  27. Knightwing

    Knightwing

    Joined:
    Aug 21, 2015
    Posts:
    15
    Thanks. I appreciate the help
     
  28. Deleted User

    Deleted User

    Guest

    Hi everyone.

    Version 1.2.3 has been submitted. Changelog:

    - Fixed a bug where objects with different type shader generate an exception during clipping plane enabling.
    - Fixed a bug where camera acquiring generate an exception during project compiling

    RELEASED!
     
    Last edited by a moderator: Nov 16, 2016
  29. Knightwing

    Knightwing

    Joined:
    Aug 21, 2015
    Posts:
    15
    Thanks for the update. Unity doesn't crash any more when my vehicle goes through the portal, but now what happens is that it just comes out the back of the portal it went through (if it goes through the blue portal, it just comes out the back of the blue portal, not from the red one) and then it's controls stop responding properly and it gets thrown into the air.

    The error message I am getting is:

    The shader of object material is not 'Standard', the object clippping will not be possible
    UnityEngine.Debug:LogError(Object)
    PortalManager:OnTriggerEnter(Collider) (at Assets/Gater/Scripts/PortalManager.cs:376)

    I checked the shaders and it seems the colliders had legacy shaders, so I removed them which then brought up another error that said:

    NullReferenceException: Object reference not set to an instance of an object
    PortalManager.OnTriggerEnter (UnityEngine.Collider collision) (at Assets/Gater/Scripts/PortalManager.cs:375)

    The vehicle would go through the portals smoothly (but the portal system didn't work, the car would just go through a portal without appearing through the 2nd one).

    I then tried adding a default standard shader to the colliders. I didn't get any error messages this time, but the vehicle got thrown into the air again when going through a portal (and didn't come out of the 2nd portal)

    Should I post the code that is referenced in the error messages (lines 375 and 376)?
     
  30. Deleted User

    Deleted User

    Guest

    Ok, I will check tomorrow.

    Anyway yes, you can post whatever you want, my code it's open.
     
    Last edited by a moderator: Nov 16, 2016
  31. Deleted User

    Deleted User

    Guest

    Hi everyone.

    Version 1.2.5 has been submitted. Changelog:

    - Improved 'FPS Controller' responsivity.
    - Various bugfix and code cleaning.
    - Variable "Scene Terrain" has been deprecated to uselessness.
    - Some variable has been renamed to improve the comprehensibility.

    RELEASED!
     
    Last edited by a moderator: Dec 1, 2016
  32. Hein_G

    Hein_G

    Joined:
    Dec 17, 2016
    Posts:
    1
    Hey, loving the asset so far but im having an issue in 1.2.5 where the FPScontroller fails to jump unless the jump key is pressed 4-6 times.
     
  33. Deleted User

    Deleted User

    Guest

    Hi.

    I will check this issue soon as possible.

    Edit: This bug was fixed on version 1.26.
     
    Last edited by a moderator: Dec 21, 2016
  34. Deleted User

    Deleted User

    Guest

    Hi everyone.

    Version 1.2.6 has been submitted. Changelog:

    - Fixed a bug where jump of FPS Controller not working properly.

    RELEASED!
     
    Last edited by a moderator: Dec 21, 2016
  35. AndersMalmgren

    AndersMalmgren

    Joined:
    Aug 31, 2014
    Posts:
    5,358
    Hey man just wanted to give you a heads up that we got this working in VR on our own, we use a combination of stencile buffers and render texture using the single pass detection we discussed above, works very well, but the render texture is very demanding in VR since it doubles the draw calls :)

     
    Deleted User and hopeful like this.
  36. Deleted User

    Deleted User

    Guest

    Good for now, and I have also found your code:

    Code (CSharp):
    1. #ifdef UNITY_SINGLE_PASS_STEREO
    2.                 leftEye = unity_StereoEyeIndex == 0;
    3. #else
    4.                 leftEye = (unity_CameraProjection[0][2] <= 0);
    5. #endif
    6.                 if (leftEye)
    7.                 {
    8.                     refl = tex2Dproj(_LeftReflectionTex, UNITY_PROJ_COORD(i.refl));
    9.                 }
    10.                 else
    11.                 {
    12.                     refl = tex2Dproj(_RightReflectionTex, UNITY_PROJ_COORD(i.refl));
    13.                 }
    14.                 return tex * refl;
    But can you explain in detail your procedure? Thanks.
     
  37. AndersMalmgren

    AndersMalmgren

    Joined:
    Aug 31, 2014
    Posts:
    5,358
    In our case we only draw the parallax effect of the cross hair in stereo to save draw calls, in the case of a portal you need to draw separate render texture with slightly different perspective to accomodate for the stereo effect, please look at the mirror example also mentioned above, it's alot of code to cover here :) let me know if you have any specific questions
     
  38. Deleted User

    Deleted User

    Guest

    Hi everyone.

    Version 1.2.7 has been submitted. Changelog:

    - It's now possible to render splitted sceneview and gameview without issues.

    RELEASED!

     
    Last edited by a moderator: Jan 4, 2017
    hopeful likes this.
  39. Deleted User

    Deleted User

    Guest

    Hi everyone.

    Version 1.2.8 has been submitted. Changelog:

    - Various bugfix and code improvements.
    - It's now possible to enable asyncronous loading of another scene after character teleport.
    - It's now possible to change the quality of depth of portal projection (useful to improve distance during render of recursion).
    - Package components has been moved to "Gater (Portal System)" folder.

    RELEASED!
     
    Last edited by a moderator: Jan 13, 2017
  40. Gebodal

    Gebodal

    Joined:
    May 30, 2016
    Posts:
    2
    Hello,
    I've just downloaded the latest version of this asset (1.2.8), and am having trouble with rendering in game mode when maximised. If I run the game with both scene view and game view visible, everything works fine. But if I have "Maximise on play" selected, the portals just show black - although they still work. Am I missing something here?

    When it doesn't work, it produces:

    IndexOutOfRangeException: Array index is out of range.
    PortalManager.GateCamRepos () (at Assets/Gater/Scripts/PortalManager.cs:291)
    PortalManager.LateUpdate () (at Assets/Gater/Scripts/PortalManager.cs:123)

    in the console, which seems to be relating to,
    #if UNITY_EDITOR
    SceneCamera = SceneView.GetAllSceneCameras () [0];
    #endif
    but I have no idea what's wrong.

    Any ideas?

    Many thanks in advance.
     
  41. Deleted User

    Deleted User

    Guest

    Hi.

    I will check soon or tomorrow.

    Edit: Ok, I have checked and fixed the bug, now I'm submitting again 1.28 version and the corrected script to you in PM.
     
    Last edited by a moderator: Jan 14, 2017
  42. f3w1n

    f3w1n

    Joined:
    Jan 14, 2017
    Posts:
    9
    Is there a way to make a pair of portals render other portals recursion?
     

    Attached Files:

  43. Deleted User

    Deleted User

    Guest

    I think you need more cameras to achieve this effect, but I'm not sure.
     
  44. Deleted User

    Deleted User

    Guest

    Hi everyone.

    Version 1.2.8-2 has been submitted. Changelog:

    - Further code improvements.

    RELEASED!
     
    Last edited by a moderator: Feb 3, 2017
  45. jethrogillgren

    jethrogillgren

    Joined:
    Jan 11, 2017
    Posts:
    28
    Hi! In Unity 5.5.0f3 on mac I get System running out of memory after about 2 minutes of having any of the example scenes loaded, or playing. Has anyone else had this? Or is anyone else successful on 5.5.0f3, or a recent version?

    I have closed all other opened programs, rebooted mac, etc.. The problem only happens when viewing one of these scenes


    Love the project, it's amazing that such a quality bit of code is available and maintained so well!

    EDIT: I have 1.2.8 (not 1.2.8-2) .... Might be bugfixes in there I might be hitting.. will wait for it to get approved...
     
  46. Deleted User

    Deleted User

    Guest

    Try to reimport entire package from scratch, and check if there is a gameobject insider gater that is always cloned. After this post a screen of scene stats (included profiler), before and while this begin to incur in a crash.

    Edit: Maybe I have found your bug (has happened to me, but without crash): https://forum.unity3d.com/threads/u...eadsafelinearallocator-error-messages.447800/
     
  47. jethrogillgren

    jethrogillgren

    Joined:
    Jan 11, 2017
    Posts:
    28
    Here is a screen of the profiler running in Editor Mode, after the crash: http://imgur.com/a/P3hM7 . And one a minute or so before the crash http://imgur.com/a/kLp5W

    Sorry i'm not sure how to check if there is a gameobject inside gater that is always cloned. In my hierarchy for the scene, I do not have anything with (clone) appended to the names - I have made no changes to the scene - just re-imported the code (1.2.8) and pointed the camera around a bit and opened the debug panels.

    EDIT: I see Unity 5.5.1 was released a couple days ago - just downloading and trying that...
     
  48. Deleted User

    Deleted User

    Guest

    Ok, so there is any cloned object in hierarchy, good. In which scene happen this problem? And happen with both scene and game tabs opened, or also with one of two?
     
  49. jethrogillgren

    jethrogillgren

    Joined:
    Jan 11, 2017
    Posts:
    28
    It happened in multiple scenes, FPS Skybox, Fall, FPS tested so far. Can go through others if needed.
    I upgraded to 5.5.1 and still have same symptoms.

    With Only Scene tab open: Crashes.
    With neither open: Crashes.
    Only Game tab open: Not tried - assuming it will fail.
    (I started Unity so the given tabs were already hidden - I didn't start with them showing and then just close them.)

    Those tests were with the "FPS" scene
     
  50. Deleted User

    Deleted User

    Guest

    I will check if there is a memory leak somewhere. But just for curiosity, try to remove the code that generate local render texture and doing the graphic.blit, and see if the problem still happen.

    Edit: This bug was fixed on version 1.28-3.
     
    Last edited by a moderator: Apr 10, 2017