Render Texture coordinates --UNITY_UV_STARTS_AT_TOP

https://docs.unity3d.com/550/Documentation/Manual/SL-PlatformDifferences.html

Render Texture coordinates

Vertical Texture coordinate conventions differ between two types of platforms: Direct3D-like and OpenGL-like.

  • Direct3D-like: The coordinate is 0 at the top and increases downward. This applies to Direct3D, Metal and consoles. UNITY_UV_STARTS_AT_TOP
  • OpenGL-like: The coordinate is 0 at the bottom and increases upward. This applies to OpenGL and OpenGL ES.

这个render texture之前做都是 把sample分两种 到backbuffer的和到中间rt的 不同平台 中间rt的 sample不同处理 用宏

cmd.DrawMesh(fullscreenTriangle, Matrix4x4.identity, propertySheet.material, 0, pass, propertySheet.properties);
用这个matrix 调换的话 会有正反面的问题 cullface那里会去掉的 不妥

nvn里面有个编译指令能统一设置upper down

unity的话 官方文档说  dxlike unity内部会自己flip

#ifdef UNITY_UV_STARTS_AT_TOP
float2 worldXZ = LD_0_UVToWorld(input.uv);
#else
float2 worldXZ = LD_0_UVToWorld(float2(input.uv.x, 1 - input.uv.y));
#endif

原文地址:https://www.cnblogs.com/minggoddess/p/8745695.html