浏览代码

Updating the human stencil shader to use the display rotation matrix rather than the texture rotation value.

/4.1
Todd Stinson 4 年前
当前提交
bfaf417b
共有 2 个文件被更改,包括 7 次插入15 次删除
  1. 2
      Assets/Shaders/DepthGradient.shader
  2. 20
      Assets/Shaders/HumanStencil.shader

2
Assets/Shaders/DepthGradient.shader


real4 color : SV_Target;
};
v2f vert (appdata v)
{

20
Assets/Shaders/HumanStencil.shader


Properties
{
_MainTex ("Main Texture", 2D) = "black" {}
_TextureRotation ("Texture Rotation (Degrees)", Float) = 0.0
}
SubShader
{

};
real _TextureRotation;
CBUFFER_START(DisplayRotationPerFrame)
float4x4 _DisplayRotationPerFrame;
CBUFFER_END
float angle = radians(_TextureRotation);
float cosrot = cos(angle);
float sinrot = sin(angle);
float3x3 textureXformMatrix = float3x3(
float3(cosrot, -sinrot, 0.5f),
float3(sinrot, cosrot, 0.5f),
float3(0.0f, 0.0f, 1.0f)
);
float3 tmp = float3(v.texcoord.x - 0.5f, 0.5f - v.texcoord.y, 1.0f);
o.texcoord = mul(textureXformMatrix, tmp).xy;
o.texcoord = mul(float3(v.texcoord, 1.0f), _DisplayRotationPerFrame).xy;
return o;
}

正在加载...
取消
保存