Search Unity

Sin and Cos matrix input?

Discussion in 'Shaders' started by ellis_talley, Jun 22, 2017.

  1. ellis_talley

    ellis_talley

    Joined:
    May 17, 2017
    Posts:
    3
    It seems HLSL and Cg can take a matrices as input to the sin and cos intrinsic functions, yet ShaderLab won't allow it? I've tried using a float3x3 as input to the sin function, but it keeps telling me it's an ambiguous overloaded function. Anybody know how to get sin and cos to take matrices?
     
  2. jvo3dc

    jvo3dc

    Joined:
    Oct 11, 2013
    Posts:
    1,520
    Can't really help with shaderlab, but HLSL does indeed support having a matrix as input for sin and cos. I do however wonder why you would want to calculate that many sines in a shader. If you really do need to, there is no advantage besides code clarity to do it directly on the entire float3x3. Just split it in to three float3's and your problem is solved.