您最多选择25个主题 主题必须以中文或者字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
 
 
 
 

75 行
2.0 KiB

#ifndef UNITY_STANDARD_INPUT_INCLUDED
#define UNITY_STANDARD_INPUT_INCLUDED
#include "UnityCG.cginc"
#include "UnityStandardConfig.cginc"
#include "UnityPBSLighting.cginc" // TBD: remove
#include "UnityStandardUtils.cginc"
//---------------------------------------
// Directional lightmaps & Parallax require tangent space too
#if (_NORMALMAP || DIRLIGHTMAP_COMBINED || _PARALLAXMAP)
#define _TANGENT_TO_WORLD 1
#endif
#if defined(_NORMALMAP0) || defined(_NORMALMAP1) || defined(_NORMALMAP2) || defined(_NORMALMAP3)
#define _TANGENT_TO_WORLD 1
#endif
#if (_DETAIL_MULX2 || _DETAIL_MUL || _DETAIL_ADD || _DETAIL_LERP)
#define _DETAIL 1
#endif
// ref http://blog.selfshadow.com/publications/blending-in-detail/
// ref https://gist.github.com/selfshadow/8048308
// Reoriented Normal Mapping
// Blending when n1 and n2 are already 'unpacked' and normalised
// assume compositing in tangent space
float3 BlendNormalRNM(float3 n1, float3 n2)
{
float3 t = n1.xyz + float3(0.0, 0.0, 1.0);
float3 u = n2.xyz * float3(-1.0, -1.0, 1.0);
float3 r = (t / t.z) * dot(t, u) - u;
return r;
}
//-------------------------------------------------------------------------------------
// Input functions
struct VertexInput
{
float4 vertex : POSITION;
half3 normal : NORMAL;
float2 uv0 : TEXCOORD0;
float2 uv1 : TEXCOORD1;
//#if defined(DYNAMICLIGHTMAP_ON) || defined(UNITY_PASS_META)
float2 uv2 : TEXCOORD2;
//#endif
// BEGIN LAYERED_PHOTOGRAMMETRY
half4 color : COLOR;
float2 uv3 : TEXCOORD3;
// END LAYERED_PHOTOGRAMMETRY
#ifdef _TANGENT_TO_WORLD
half4 tangent : TANGENT;
#endif
UNITY_VERTEX_INPUT_INSTANCE_ID
};
float4 TexCoords(VertexInput v)
{
//float4 texcoord;
//texcoord.xy = TRANSFORM_TEX(v.uv0, _MainTex); // Always source from uv0
//texcoord.zw = TRANSFORM_TEX(((_UVSec == 0) ? v.uv0 : v.uv1), _DetailAlbedoMap);
//return texcoord;
float4 texcoord;
texcoord.xy = v.uv0;
texcoord.zw = v.uv1;
return texcoord;
}
#endif // UNITY_STANDARD_INPUT_INCLUDED