Search Unity

stereo skybox

Discussion in 'Daydream' started by behram, Oct 12, 2016.

  1. behram

    behram

    Joined:
    Jun 21, 2016
    Posts:
    18
    Hello,
    I want to be able to apply separate skybox images to each camera eye but I am not able to access the camera Left / Right nodes at runtime.

    Have a look at the thread here:
    http://answers.unity3d.com/question...r-each-left-and-right-eye.html#answer-1255234

    Code (CSharp):
    1. using UnityEngine;
    2. using System.Collections;
    3.  
    4. public class runtimeAd : MonoBehaviour {
    5.  
    6.     Camera camLeft;
    7.     Camera camRight;
    8.  
    9.     // Use this for initialization
    10.  
    11.     void Awake()
    12.     {
    13.        
    14.     }
    15.     void Start()
    16.     {
    17.         if (GameObject.Find("Main Camera Left").AddComponent<Skybox>())
    18.             Debug.Log("skybox added");
    19.         camLeft = GameObject.Find("Main Camera Left").GetComponent<Camera>();
    20.         camLeft.clearFlags = CameraClearFlags.Skybox;
    21.         camLeft.GetComponent<Skybox>().material = Resources.Load("Material/leftEyeMat", typeof(Material)) as Material;
    22.        
    23.         //Debug.Log(camLeft.GetComponent<Skybox>().material.name);
    24.  
    25.         camRight = GameObject.Find("Main Camera Right").GetComponent<Camera>();
    26.         //camRight.clearFlags = CameraClearFlags.Skybox;
    27.         camRight.GetComponent<Skybox>().material = Resources.Load("Material/rightEyeMat", typeof(Material)) as Material;
    28.  
    29.         //Debug.Log(camRight.GetComponent<Skybox>().material.name);
    30.  
    31.     }
    32.  
    33.     // Update is called once per frame
    34.     void Update()
    35.     {
    36.  
    37.  
    38.     }
    I have also tried to use the "Update stereo camera's" option in the UI menu and make the modifications there.No luck !

    Thanks for any help.
    b
     
  2. SylafrsManza

    SylafrsManza

    Joined:
    Oct 26, 2016
    Posts:
    3
    Did you try RenderSettings.skybox ? (in UnityEngine)
    Manually, the option can be accessed via : Window > Lighting (Environment Lighting : skybox)
     
    behram likes this.
  3. thep3000

    thep3000

    Unity Technologies

    Joined:
    Aug 9, 2013
    Posts:
    400
  4. behram

    behram

    Joined:
    Jun 21, 2016
    Posts:
    18
    Update 1:
    @thep3000 the attached example file works fine without adding GvrManager to the scene.
    Once I add GvrManager things go back to the usual overwriting camera rig bs :/
    Man what a pain.

    b

    Thanks @thep3000 .
    The thread you linked to leads to another thread which provides a solution for OculusVR.

    Will this technique also work with Google VR or if I install the Daydream preview ( 5.4.2f2-GVR10 ) ?
    Thanks once again.
    b
     
    Last edited: Oct 27, 2016