浏览代码

Remove the quaternion code

/feature-ReflectionProbeFit
Evgenii Golubev 7 年前
当前提交
99b83826
共有 2 个文件被更改,包括 0 次插入40 次删除
  1. 8
      ScriptableRenderPipeline/Core/CoreRP/ShaderLibrary/QuaternionMath.hlsl.meta
  2. 32
      ScriptableRenderPipeline/Core/CoreRP/ShaderLibrary/QuaternionMath.hlsl

8
ScriptableRenderPipeline/Core/CoreRP/ShaderLibrary/QuaternionMath.hlsl.meta


fileFormatVersion: 2
guid: 28991169f6e68314ab20d6a0e4aeccec
timeCreated: 1472140530
licenseType: Pro
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:

32
ScriptableRenderPipeline/Core/CoreRP/ShaderLibrary/QuaternionMath.hlsl


#ifndef UNITY_QUATERNIONMATH_INCLUDED
#define UNITY_QUATERNIONMATH_INCLUDED
// Ref: https://cedec.cesa.or.jp/2015/session/ENG/14698.html The Rendering Materials of Far Cry 4
real4 TangentSpaceToQuat(real3 tagent, real3 bitangent, real3 normal)
{
real4 quat;
quat.x = normal.y - bitangent.z;
quat.y = tangent.z - normal.x;
quat.z = bitangent.x - tangent.y;
quat.w = 1.0 + tangent.x + bitangent.y + normal.z;
return normalize(quat);
}
void QuatToTangentSpace(real4 quaterion, out real3 tangent, out real3 bitangent, out real3 normal)
{
tangent = real3(1.0, 0.0, 0.0)
+ real3(-2.0, 2.0, 2.0) * quat.y * quat.yxw
+ real3(-2.0, -2.0, 2.0) * quat.z * quaternion.zwx;
bitangent = real3(0.0, 1.0, 0.0)
+ real3(2.0, -2.0, 2.0) * quat.z * quat.wzy
+ real3(2.0, -2.0, -2.0) * quat.x * quaternion.yxw;
normal = real3(0.0, 0.0, 1.0)
+ real3(2.0, 2.0, -2.0) * quat.x * quat.zwx
+ real3(-2.0, 2.0, -2.0) * quat.y * quaternion.wzy;
}
#endif // UNITY_QUATERNIONMATH_INCLUDED
正在加载...
取消
保存