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

3d Stereoscopy anaglyph-izer Unity 3 and Unity 2.6

Discussion in 'Shaders' started by Checco-Esimple, Sep 21, 2010.

  1. Checco-Esimple

    Checco-Esimple

    Joined:
    Feb 14, 2008
    Posts:
    82
    Hi Guys

    following the "hype" around the "old-new" 3D anaglyph technology, we started working on that way...

    We took the script posted by aNTeNNa trEE of the Unity Demo Team.
    We added the modification posted by Monark implementing the projection matrix method, to simplify vision for the eyes.
    Monark also posted a modified shader from the original one, which we included by default.
    Then, we cooked all our modifications:

    * created 3 external shaders for the three anaglyph modes (Red/Cyan, Red/Blue, Red/Green) (latest 2 still need tweaks)
    * automatic linking of the shader to the camera
    * added automatic support for GUITexture and GUIText
    * converted the original JS script into C#
    * shader written in two different ways to be compatible with Unity 3 and Unity 2.x shaders.

    And we finally decided to release it under GPL for everyone to enjoy. Simply to import as a package, and simply to attach to camera through Components > Anaglyphizer menu

    We are sure this could be useful for all the "non-coders" around :)

    You can find the full post in our blog:

    http://blog.esimplestudios.com/2010/09/unity3d-anaglyph-construction-kit/

    And if you don’t care about all this bla bla bla?

    FINE, HERE YOU GO:

    http://github.com/EsimpleStudios/Unity3D-Anaglyph-izer <<– GET IT HEREE!!!
     
  2. lesfundi

    lesfundi

    Joined:
    Jan 10, 2009
    Posts:
    628
    is the red/blue working in this new script or not?



    [/code]
     
  3. Jacob-Williams

    Jacob-Williams

    Joined:
    Jan 30, 2009
    Posts:
    267
    This is really great and easy to use. I think this kind of thing is really starting to catch on.

    While this looks good for 3D scenes, it doesn't really work for 2D based games. I don't really understand much about this type of technology, but would it be possible to accomplish something like this?
     
  4. lesfundi

    lesfundi

    Joined:
    Jan 10, 2009
    Posts:
    628
    i works on my editor but not when i build the game, it all becomes yellow when i run on it on my macboo and also on bootcamp ..... any reason why?
     
  5. lesfundi

    lesfundi

    Joined:
    Jan 10, 2009
    Posts:
    628
    i ran it now on 5 computers and it works in the editor but when is compiled we get a yellow screen, nothing visuable....

    From who does this work when it build to a windows or mac project?
    it works in the editor. (but if you set the editor to free aspect doesn't work)

    Now, i went back to download it: http://github.com/EsimpleStudios/Unity3D-Anaglyph-izer
    And now the package give the errors: couldn't decompress package.

    i don't have much faith in this.
     
  6. ringhino

    ringhino

    Joined:
    Aug 31, 2010
    Posts:
    39
    bug fixed in the 1.1 version

    Strange behavior try to redownload the pack or download the source code if you continue to have this problems.

    Thanks

    Francesco
     
  7. lesfundi

    lesfundi

    Joined:
    Jan 10, 2009
    Posts:
    628
    when you download the new file and import the package in unity the error comes up the package can't be uncompressed.

    c
     
  8. ringhino

    ringhino

    Joined:
    Aug 31, 2010
    Posts:
    39
    At the moment we working at 1.2 version with fully customizable shader with the parameter suggest by Jacob Williams

    Bye

    Ring
     
  9. lesfundi

    lesfundi

    Joined:
    Jan 10, 2009
    Posts:
    628
    does the 1.1 work when the project is build?

    Is 1.1 now available for download?
     

    Attached Files:

  10. ringhino

    ringhino

    Joined:
    Aug 31, 2010
    Posts:
    39
  11. lesfundi

    lesfundi

    Joined:
    Jan 10, 2009
    Posts:
    628
    see my post here above.

    we try to download it on several computers and tried to import in unity on several computer, it simple doesn't import asset in unity.

    could you maybe zip up the file and pm me the file?
     
  12. Jacob-Williams

    Jacob-Williams

    Joined:
    Jan 30, 2009
    Posts:
    267
    Just downloaded the new version, and it seems to work fine for me.

    @lesfundi - Give this package a try and see if it imports correctly. (Right-Click Link, Save As).
     
  13. lesfundi

    lesfundi

    Joined:
    Jan 10, 2009
    Posts:
    628
    this downloads, however in the unity is now a red screen instead of yellow and code errors are popping up.
    And -> ONLY FOR 2.6.1: replace the shaders in the package with the ones included in the source/Shaders/2.6.1 folder
    -> thad folder is not the package included.

    Does somebody has this working on 2.6.1?
     

    Attached Files:

  14. lesfundi

    lesfundi

    Joined:
    Jan 10, 2009
    Posts:
    628
    now i used unity version 3 but same problem :-(
    When i import the package it give the error: decompression problem :-(
    see attachment
     

    Attached Files:

  15. ringhino

    ringhino

    Joined:
    Aug 31, 2010
    Posts:
    39
    UPDATE

    Released the 1.2 version of the package, same URL you can find up there.

    WHAT’S NEW (1.2)

    - there’s no need anymore to link the various shaders
    - included a single parametric shader
    - it’s now possible to create an infinite number of materials adjustable with parameters (see below) included configurations for Magenta/Green and Red/Blue modes
    - added a “Use Projection Matrix” flag to optimize the focal distance based on the camera’s Field of View

    Huge change in 1.2!

    So what’s this big change we talked about?
    Practically, we introduced one parametric shaders which allows you to create any kind of material optimized for any kind of anaglyph matrix, like you can see here.

    Here are the matrixes for the main anaglyph modes.

    True Anaglyphs



    Dark image
    No color reproduction
    Little ghosting


    Gray Anaglyphs



    No color reproduction
    More ghosting than true anaglyphs



    Half Color Anaglyphs



    Partial color reproduction (but not as good as color anaglyphs)
    Less retinal rivalry than color anaglyphs


    Optimized Anaglyphs



    Partial color reproduction (but not of red shades)
    Almost no retinal rivalry


    Matrix settings

    Balance Left Red = (r, g, b, not_used)
    Balance Left Green = (r, g, b, not_used)
    Balance Left Blue = (r, g, b, not_used)

    Balance Right Red = (r, g, b, not_used)
    Balance Right Green = (r, g, b, not_used)
    Balance Right Blue = (r, g, b, not_used)

    For example, if we want to obtain the Optimized Anaglyph material we have to setup the matrix like this:

    Balance Left Red (0.0, 0.7, 0.3, any)
    Balance Left Green (0.0, 0.0, 0.0, any)
    Balance Left Blue (0.0, 0.0, 0.0, any)

    Balance Right Red (0.0, 0.0, 0.0, any)
    Balance Right Green (0.0, 1.0, 0.0, any)
    Balance Right Blue (0.0, 0.0, 1.0, any)

    According to the diagram shown up there.

    You find more Information at

    http://blog.esimplestudios.com/unity3d-anaglyph-construction-kit/

    Or the direct repository links

    http://github.com/EsimpleStudios/Unity3D-Anaglyph-izer
     
  16. lesfundi

    lesfundi

    Joined:
    Jan 10, 2009
    Posts:
    628
    i downloaded the new unitypackage but again, it does not import in unity :-(
    Same errors pop up :-(

    Than i loaded each file by itself and when i bring them in unity all errors come on screen of the .js and c# file.

    So, again a dissapointment
     
  17. ringhino

    ringhino

    Joined:
    Aug 31, 2010
    Posts:
    39
    hi try to import the package in a new empty project, if this doesn't work give me your email and i send you directly a package.

    Bye

    Ring
     
  18. lesfundi

    lesfundi

    Joined:
    Jan 10, 2009
    Posts:
    628
    i tried it again in a empty project: it does not work.
    It is also better to zip the package.

    i will pm you with my email
     
  19. lesfundi

    lesfundi

    Joined:
    Jan 10, 2009
    Posts:
    628
    i installed the latest update and it also not working to import in unity 3.03 :-(

    1) why would this not work? you should put up a zipped version on the website, download yourself and test if it work to import in unity. Not one computer I have can import it :-(
     
  20. lesfundi

    lesfundi

    Joined:
    Jan 10, 2009
    Posts:
    628
    can somebody pm me the downloaded package and confirm they have it working on unity 3?

    Why would it not work in my unity? I am o OS Mac.
     
  21. warpy

    warpy

    Joined:
    Oct 29, 2009
    Posts:
    6
    you need to download the .package and EVERYTHING inside the ASSETS DIRECTORY for the import to work.

    but when i use JS/C# material parameter with any of the materials it doesnt show on game mode... just a blank screen.

    error says


    assert failed on camerautil.cpp >>> screenviewcoord[1] < 0 || screenviewcoord[3] < 0
     
  22. warpy

    warpy

    Joined:
    Oct 29, 2009
    Posts:
    6
    beside "free aspect" on every other setting you get a grayed out screen without any visibility in it.

    so at this point in time:
    1. i can import the package good.
    2.attach the component to the camera
    3.attach a material to the script
    4. play and see objects in the game view when in "free aspect"
    5. ERROR: assert failed on cameraUtil.cpp >>> screenviewcoord[1] < 0 || screenviewcoord[3] < 0

    so finally the last issue is not seeing the blue/red overlayed images. the camera shows the object as it was without the script changes. but in editor view i can see that the camera has 3 views instead of one... so its just a matter of figuring out how to show those overlayed layers.

    Will this work in unity 2.6.1 indie ??

    EDIT: error disappears when using unity 2.6.1 Pro.
     
    Last edited: Sep 27, 2010
  23. lesfundi

    lesfundi

    Joined:
    Jan 10, 2009
    Posts:
    628
    why can some people import the package and some not?
    It is clearly that a lot of users have problems with this package.

    The package is not doing the job, there are setup issue for others,...
    => The best solution would be zipped project file with everything setup that we can download it.
     
    Last edited: Sep 26, 2010
  24. warpy

    warpy

    Joined:
    Oct 29, 2009
    Posts:
    6
  25. warpy

    warpy

    Joined:
    Oct 29, 2009
    Posts:
    6
    a friend used this script on unity 2.6.1 pro, so it looks like this is only for unity pro and not indie..
    pictures attached, too bad for all of us poor folks :)
     

    Attached Files:

  26. ringhino

    ringhino

    Joined:
    Aug 31, 2010
    Posts:
    39
    Example for the Green/Magenta lens

    Balance Left Red (0.0, 0.0, 0.0, any)
    Balance Left Green (0.0, 0.7, 0.3, any)
    Balance Left Blue (0.0, 0.0, 0.0, any)

    Balance Right Red (0.0, 1.0, 0.0, any)
    Balance Right Green (0.0, 0.0, 0.0, any)
    Balance Right Blue (0.0, 0.0, 1.0, any)


    Ring
     
  27. lesfundi

    lesfundi

    Joined:
    Jan 10, 2009
    Posts:
    628
    thanks wrapy for that link! That did the job. That worked ;-)
    What do I need to set the settings to so it works with red/cyan glasses?
     
  28. warpy

    warpy

    Joined:
    Oct 29, 2009
    Posts:
    6
    you have a few materials , just pull one into the mat variable slot in the camera *in the inspector. the one named "full colored anaglyph" or something similar.
     
  29. lesfundi

    lesfundi

    Joined:
    Jan 10, 2009
    Posts:
    628
    I did this morning several hours of testing on it => It is very impressive and working very good!

    Just the L button doesn't seems to work
     
    Last edited: Sep 27, 2010
  30. Kourosh

    Kourosh

    Joined:
    Jul 18, 2010
    Posts:
    15
    Thanks, A LOT, for previous version i couldn't get it work on the built app, but the latest version is working awesome!
     
  31. Pulov

    Pulov

    Joined:
    Feb 20, 2010
    Posts:
    824
    Very interesting. Just curious. Where do you get glasses for this? I only do find bundles that come with 50 glasses or so. Too much stuff for a single person.
     
  32. mikevanman

    mikevanman

    Joined:
    Sep 30, 2009
    Posts:
    108
    this is awesome !, but I cant get it to work for iphone/ipad I just get a gray screen ?
     
  33. stevemachineHK

    stevemachineHK

    Joined:
    May 6, 2010
    Posts:
    18
    works here just fine on Unity 2.61, tho on the nvidia graphics card, not my ati one...
     
  34. phoberman

    phoberman

    Joined:
    Jan 16, 2008
    Posts:
    74
    Works for me, Mac OS X 10.6.4, Unity 3.

    One little bug in the js script: the line:
    Code (csharp):
    1. static var focalDistance = 10;
    should read:
    Code (csharp):
    1. static var focalDistance = 10.0;
    or else focalDistanceAdjust only changes in whole numbers.

    And after the line:
    Code (csharp):
    1. S3DV.eyeDistance -= eyeDistanceAdjust;
    I added:
    Code (csharp):
    1. S3DV.eyeDistance = Mathf.Max(0,S3DV.eyeDistance);
    so that the eyes don't get crossed.

    Otherwise, excellent, and thanks.
     
  35. Wolfram

    Wolfram

    Joined:
    Feb 16, 2010
    Posts:
    254
    Hm, I find it a bit strange that you claim a copyright on that code (no matter the license), especially without even mentioning the original author(s), who contributed about 95% of the actual functionality...
    Code (csharp):
    1. [...]
    2. |     Admin: Francesco Gallorini (project administrator)                    |
    3. |     Developers: Francesco Tozzi, Francesco Marcantoni                    |
    4. |     Packaging: Gabriele Maidecchi                                         |
    5. | Copyright (c) 2010, Esimple Studios All Rights Reserved.                  |
    6. [...]
    7.  
     
    Last edited: Oct 12, 2010
  36. Maido

    Maido

    Joined:
    Oct 14, 2010
    Posts:
    1
    Fair enough, I have updated the GitHub repo's README.txt and the script files to include an updated notice.
    Thanks for bringing it to my attention, I had just included due credits in the "brief story" part of the package and totally forgot about the initial part.
     
  37. hk1973

    hk1973

    Joined:
    Oct 14, 2008
    Posts:
    28
    It is really a great package!!! Thanks so much.
    It would be good if it also works on iPhone and iPad!
     
  38. lesfundi

    lesfundi

    Joined:
    Jan 10, 2009
    Posts:
    628
    i did some more testing and it seems when the camera comes close to object the red and blue flips.....:-(
     
    Last edited: Dec 23, 2010
  39. Kaya

    Kaya

    Joined:
    Dec 21, 2010
    Posts:
    50
    I've downloaded the Anaglyph-izer and sucessfully run in Unity3D 3.1 pro. That is fantastic!
    I've attached the AnaglyphizerC script to the Main Camera under a First Person Controller. It worked fine. However, when I enable/disable the AnaglyphizerC using following code, I observed a problem;

    Code (csharp):
    1. function Update () {
    2.    var myBehaviour : Behaviour;
    3.  
    4.   if (Input.GetKeyDown(KeyCode.C)) {
    5.      myBehaviour = gameObject.GetComponent("AnaglyphizerC");
    6.      
    7.      if (myBehaviour != null) {
    8.     myBehaviour.enabled = !myBehaviour.enabled ;
    9.      
    10.         if (myBehaviour.enabled)
    11.        print("AnaglyphizerC enabled");
    12.         else
    13.       print("AnaglyphizerC disabled");     
    14.     }
    15.        
    16.   }
    17. }
    in Game window the mouse look functionality (looking around using mouse) also enabled/disabled.
    Is there any expert advise on this issue?

    -Kaya
     
    Last edited: Jan 7, 2011
  40. mehware

    mehware

    Joined:
    Nov 19, 2007
    Posts:
    739
    This is great, I am using it in my next game. How do we make GUI.DrawTexture and GUI.Label 3D?, I see there is GUITexture and GUIText support but i need GUI.DrawTexture and GUI.Label,

    Thanks!
     
  41. Farfarer

    Farfarer

    Joined:
    Aug 17, 2010
    Posts:
    2,249
    Just tried this out (with a few modifications, of course, for focal distance based on camera raycast distance taking into account viewer distance to screen).

    Really nice stuff, thank you :)
     
  42. giancamati

    giancamati

    Joined:
    Aug 4, 2010
    Posts:
    518
    Hi, it's very interesting .. I tried it on my PC and it's cool, I was wondering if you tried on the iPad?

    Thanks,
    GC

     
  43. kt1117

    kt1117

    Joined:
    Jan 2, 2012
    Posts:
    6
    Do this work on Unity 3 Indie? I was read that this isn't work on Unity 2 Indie, but i don't know what is with it on latest version.
     
  44. Hummelwalker

    Hummelwalker

    Joined:
    Oct 28, 2010
    Posts:
    119
    @kt1117 yes, it should works with indie version.

    @checco77: Thanks for your really cool asset. I have a lot of fun with it. I tested it with the Bootcamp demo. Have a look at Bootcamp as anaglyph browsergame :)
     
  45. Luis1604

    Luis1604

    Joined:
    Dec 15, 2011
    Posts:
    7
    Some possibility of Anaglyph-izer works on Unty 3.5 Indie Version?It doens't work here.
     
  46. negative11

    negative11

    Joined:
    Jun 27, 2012
    Posts:
    9
    dloaded it but kinda stuck in this part
    "2) Link your material or one of those included in the prefab folder to the script Inspector variables to change script parameters"

    can any1 help?...im nw to this stuff...tqs...

    update: tried the optimize anaglyph but all i see is a transparent black/grey...do i need to change anything?...
     
    Last edited: Jul 9, 2012
  47. negative11

    negative11

    Joined:
    Jun 27, 2012
    Posts:
    9
    can someone help me...urgent
     
  48. lutet

    lutet

    Joined:
    Apr 14, 2016
    Posts:
    1
    If somebody wants to use it, anaglyph-izer still works with Unity5. Thanks a lot for this script, great job!
     
  49. michael554466OG

    michael554466OG

    Joined:
    Feb 28, 2015
    Posts:
    5
    Hi, How can I make it more sensitive? I want to turn up the X width per X distance for a deeper image.
     
  50. SuperDanOsbourne

    SuperDanOsbourne

    Joined:
    Oct 3, 2017
    Posts:
    46
    Thanks so much for this package. Works in Unity2017.