Unity Shader 获取模型空间坐标

Posted 酷熊

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Unity Shader 获取模型空间坐标相关的知识,希望对你有一定的参考价值。

CGPROGRAM
        // Physically based Standard lighting model, and enable shadows on all light types
        #pragma surface surf Standard fullforwardshadows vertex:vert
struct Input {
            float2 uv_MainTex;
            float3 worldPos;
            float4 modelPos_;
        };
void vert(inout appdata_full v, out Input o)
        {
            UNITY_INITIALIZE_OUTPUT(Input, o);
            o.modelPos_ = v.vertex;
        }

        ENDCG
float lat = degrees(acos(IN.modelPos_.y / _R));//[0,180]

 

以上是关于Unity Shader 获取模型空间坐标的主要内容,如果未能解决你的问题,请参考以下文章