浏览代码

add some comments explaining the transform from normal map to decal space

/main
Paul Melamed 7 年前
当前提交
b5295e0e
共有 1 个文件被更改,包括 6 次插入2 次删除
  1. 8
      ScriptableRenderPipeline/HDRenderPipeline/HDRP/Decal/DecalProjectorComponent.cs

8
ScriptableRenderPipeline/HDRenderPipeline/HDRP/Decal/DecalProjectorComponent.cs


public const int kInvalidIndex = -1;
private int m_CullIndex = kInvalidIndex;
private static Matrix4x4 m_NormalToWorld = Matrix4x4.Scale(new Vector3(1.0f, 1.0f, -1.0f)) * Matrix4x4.Rotate(Quaternion.AngleAxis(-90.0f, new Vector3(1, 0, 0)));
// normal space __x to decal space __x
// |\ |\
// y z z y
//
private static Matrix4x4 m_NormalToDecal = Matrix4x4.Scale(new Vector3(1.0f, 1.0f, -1.0f)) * Matrix4x4.Rotate(Quaternion.AngleAxis(-90.0f, new Vector3(1, 0, 0)));
public int CullIndex
{

}
Matrix4x4 final = transform.localToWorldMatrix;
Matrix4x4 decalToWorldR = Matrix4x4.Rotate(transform.rotation) * m_NormalToWorld;
Matrix4x4 decalToWorldR = Matrix4x4.Rotate(transform.rotation) * m_NormalToDecal;
Matrix4x4 worldToDecal = Matrix4x4.Translate(new Vector3(0.5f, 0.0f, 0.5f)) * Matrix4x4.Scale(new Vector3(1.0f, -1.0f, 1.0f)) * final.inverse;
if (m_PropertyBlock == null)
{

正在加载...
取消
保存