关于切线空间到世界空间的转换:Common.ush文件中:
/** Transforms a vector from tangent space to world space */ MaterialFloat3 TransformTangentVectorToWorld(MaterialFloat3x3 TangentToWorld, MaterialFloat3 InTangentVector) { // Transform directly to world space // The vector transform is optimized for this case, only one vector-matrix multiply is needed return mul(InTangentVector, TangentToWorld); }
在ShadingModelsMaterial.ush文件中:
#if MATERIAL_TANGENTSPACENORMAL float3 tempnormal = normalize(TransformTangentVectorToWorld( MaterialParameters.TangentToWorld, ClearCoatBottomNormal0(MaterialParameters) )); …… #endif