Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

[Slanted Interleave] I Need a Help on my Little Project

Discussion in 'Shaders' started by DoPie, Jan 5, 2015.

  1. DoPie

    DoPie

    Joined:
    Jun 20, 2013
    Posts:
    64
    Right now I'm working on Stereoscopic in Unity, Any body here familiar on Horizontal / Vertical Interleave like 3D effect on 3DS Nintendo. I'm just curios if it's impossible to Slanted that Horizontal / Vertical Interleave. For the EyeFly 3D i want to create a Game that to Support that Technology.

    Web Link : http://www.eyefly3d.com/installation-apps
     
  2. CountFrolic

    CountFrolic

    Joined:
    Mar 15, 2013
    Posts:
    20
    I don't think unity does this out of the box but it should be fairly straightforward to do this yourself with a shader.
    1) render the scene from each eyepos to its own texture
    2) Supply the two textures to a shader that interleaves them
    3) output the resulting texture to the screen
     
  3. DoPie

    DoPie

    Joined:
    Jun 20, 2013
    Posts:
    64
    Advance Thank you @CountFrolic !

    Maybe you are right at some part, i try to create a shader for slanting the interleave but the problem is did not match on the pixel mapping of the lens.
     
  4. jvo3dc

    jvo3dc

    Joined:
    Oct 11, 2013
    Posts:
    1,520
    This approach looks a bit imprecise compared to common approaches where this layer is already embedded in the screen. Meaning that you would need to supply the end user with some extra settings to try and counter any imprecision in the positioning of this top layer.

    Next I'm not sure how this is slanted. For what I can see, it's a pure horizontal/vertical interleave if the top layer is placed correctly.

    Normally you would render the two eyepos scenes to half sized textures. Then you would just alternate rows or columns for these two half textures to build a full texture. This does however assume a perfect match between the pixel lines and the top layer, which in this case might be a bit too good to be true.

    In a more generic approach, you could just render both eyes to a full texture and then blend them using a line pattern mapped on the screen. This could help with variations in position and rotation of the top layer, but it will probably introduce moire patterns very quickly when rotating.
     
  5. DoPie

    DoPie

    Joined:
    Jun 20, 2013
    Posts:
    64
    Yes, they use vertical and horizontal interleave on the iphone4s and other late version of iphone, but on their latest update they used slanted interleave for the iphone 5 and other new updates of the phone` to solve problem about orientation of the phone to see 3D effect once you rotate the device. "To moire patterns this is possible to rotate in Shader ? "
     
  6. jvo3dc

    jvo3dc

    Joined:
    Oct 11, 2013
    Posts:
    1,520
    It's easy to rotate a texture coords using a 2x2 rotation matrix.
    Code (csharp):
    1.  
    2. float angle = 0.78539816; // 45 degrees in radians
    3. float angle_sin = sin(angle);
    4. float angle_cos = cos(angle);
    5. float2x2 angle_matrix = float2x2(angle_cos, angle_sin, -angle_sin, angle_cos);
    6. float angle_uv = mul(angle_matrix, uv);
    7.  
    You don't have to calculate the sin and cos in the shader of course, you can just specify it directly to the shader.
     
    DoPie likes this.
  7. DoPie

    DoPie

    Joined:
    Jun 20, 2013
    Posts:
    64
    @jvo3dc thanks Current Out put inside of the 3D Game Engine.
     

    Attached Files:

    Last edited: Jan 14, 2015