lightmap

shadowmap

heightmap

它们有一个自己的camera 对应cameraMatrix

float3 TransfromToTextureCoord(float4 PositionWS, float4x4 CameraMatirx, float CameraOrthographicSize)
{
float3 heightUV;
float4 posVS = mul(CameraMatirx, PositionWS);
heightUV.x = posVS.x / CameraOrthographicSize;
heightUV.y = posVS.y / CameraOrthographicSize;
heightUV.z = posVS.z;
heightUV.x = clamp((1 + heightUV.x) * 0.5, 0.0, 1.0);
heightUV.y = clamp((heightUV.y + 1) * 0.5, 0.0, 1.0);
return heightUV;
}

 

采样这张map的uv

worldspace中那个posWS---viewSpace(生成时的camera的matrix)出现在那张rt里的位置映射到0-1

相关文章:

  • 2021-05-11
  • 2022-01-18
  • 2022-02-09
  • 2021-08-04
  • 2021-10-25
  • 2022-12-23
  • 2021-08-07
  • 2021-05-12
猜你喜欢
  • 2022-12-23
  • 2021-07-07
  • 2021-12-06
  • 2022-12-23
  • 2022-02-01
  • 2021-12-05
相关资源
相似解决方案