Search Unity

SetTexture and Matrix

Discussion in 'Editor & General Support' started by lostpencil, Jul 22, 2006.

  1. lostpencil

    lostpencil

    Joined:
    May 2, 2006
    Posts:
    97
    Hi Folks,

    I've been looking at the source code for some of the standard and pro assets that come packaged with Unity and I have a question about 'SetTexture' and the keyword 'Matrix'.

    In the blob shadow projector there is this line of code:

    Code (csharp):
    1.  
    2.             SetTexture [_ShadowTex] {  
    3.                 combine texture, ONE - texture
    4.                 Matrix [_Projector]
    5.             }
    6.  
    I think I've figured out what this does, but I can't seem to find any reference in the documentation (perhaps this is an OpenGl construct?) regarding the Matrix command (where it can be legally used and it's description). If someone would point me to the documentation where this is discussed (or even explain what it does and where it can be legally used) it would be much appreciated.

    In the same regard, are there any more additional commands that can be used with SetTexture that are not listed in the docs? According to what I've read in the documentation that I've found, the only two valid parameters/commands in the SetTexture block appear to be 'combine' and 'ConstantColor'.

    Cheers,
    Paul Mikulecky
    Lost Pencil Animation Studios Inc.
    http://www.lostpencil.com
     
  2. Joachim_Ante

    Joachim_Ante

    Unity Technologies

    Joined:
    Mar 16, 2005
    Posts:
    5,203
    Matrix sets up a texture matrix which can be used for various effects, like scaling texture coordinates, rotating, moving texture coordinates. Or perspective orthographic projections.


    Matrix [_Projector]

    sets up the texture matrix so that it is a projection as set up by the projector settings. It is only set up from the projector.
     
  3. lostpencil

    lostpencil

    Joined:
    May 2, 2006
    Posts:
    97
    Thanks Joachim!

    So it appears that the _projector is a property associated with the current projector, right? Is it simply missing from the list in the Reference-Values manual page? Or am I missing where this information is found?

    Also, since there are other places this can be used do you have an example of it's use (like rotating texture coordinates)?

    Cheers,
    Paul Mikulecky
    Lost Pencil Animation Studios Inc.
    http://www.lostpencil.com