Unity Shader Study10: Toggle and C# & Unity Matrix

https://gist.github.com/smkplus/2a5899bf415e2b6bf6a59726bb1ae2ec
 By multiplying can set toggle!

   void vert(inout appdata_full v) {
    float T = _Time * 40;
    float S = 1+ abs(sin(T)*0.3);
    v.vertex.x = v.vertex.x * _X*S*_isOn;
    v.vertex.y = v.vertex.y * _Y*_isOn;
    v.vertex.z = v.vertex.z * _Z*_isOn;
   }

https://docs.unity3d.com/ScriptReference/Material.SetFloat.html

Set float in the material shader in C#

https://github.com/UnityCommunity/UnityLibrary/wiki/Built-in-Shader-Variables

  • UNITY_MATRIX_MVP
    • This is the most important one, this single matrix does all the transforms from the initial mesh space position into projection space (aka clip space)
    • This matrix is the product of UNITY_MATRIX_M, UNITY_MATRIX_V, and UNITY_MATRIX_P together
  • UNITY_MATRIX_M
    • This is identical to unity_ObjectToWorld, also called the Model transform
  • UNITY_MATRIX_V
    • This is the transform from world space to local View space
    • This is similar to if you had an gameObject as a child of a camera gameObject, but without any scale applied
    • This means the positions are all in world space distances, but with the camera at 0,0,0 and rotated to match the camera's orientation
  • UNITY_MATRIX_P
    • This is the transform from view space to Projection space
    • Projection space, or clip space, can be thought of as the position on screen, with anything on the far left edge of the screen, regardless of how far away, has an x of "-1", and on the right "1". It's actually going to be negative and positive "w", but we'll skip that for now.
  • 댓글

    이 블로그의 인기 게시물

    About AActor!!! "UObject" has no member "BeginPlay"

    UNREAL Android build information

    C++ 생성자 위임 (delegating constructor)