Search Unity

Rotate CubeMap Matrix

Discussion in 'Shaders' started by BurningthumbStudios, Apr 27, 2011.

  1. BurningthumbStudios

    BurningthumbStudios

    Joined:
    Apr 28, 2008
    Posts:
    95
    I need to rotate a cube-map about the-Y axis 180° (x+,y+,z+)->(x-,y+,z-), but I don't know how.

    I believe I somehow need to manipulate the cube-map matrix from a script, by setting a matrix property, but my understanding ends there.

    This is what I have help me fill in the blanks please:

    Code (csharp):
    1. function MatrixRotate()
    2. {
    3.    
    4.     while(true)
    5.     {
    6.     yield WaitForSeconds(5.0F);
    7.     Debug.Log("Flip"); 
    8.     rotateMatrix=material.GetMatrix(____?____).inverse;
    9.     material.SetMatrix("_RotateMatrix", rotateMatrix);
    10.    
    11.     yield WaitForSeconds(5.0F);
    12.  
    13.     }
    14.    
    15. }
    Code (csharp):
    1. Pass
    2.     {    
    3.         SetTexture[_MainTex] { matrix [_RotateMatrix] }
    4.        
    5.     }
    6.  
     
  2. videep

    videep

    Joined:
    Jan 2, 2014
    Posts:
    5