@@ -25,27 +25,23 @@ PackedVaryingsToPS Vert(AttributesMesh inputMesh)
2525{
2626 VaryingsToPS output;
2727
28- // OpenGL right now needs to actually use the incoming vertex position
29- // so we create a fake dependency on it here that haven't any impact.
30- output.vmesh.positionCS = float4 (0.0 , 0.0 , inputMesh.positionOS.z > 0 ? 1. 0e-4 : 0.0 , 1.0 );
31-
3228 // Output UV coordinate in vertex shader
29+ float2 uv;
30+
3331 if (unity_MetaVertexControl.x)
3432 {
35- output.vmesh.positionCS.xy = inputMesh.uv1 * unity_LightmapST.xy + unity_LightmapST.zw;
33+ uv = inputMesh.uv1 * unity_LightmapST.xy + unity_LightmapST.zw;
3634 }
3735 else if (unity_MetaVertexControl.y)
3836 {
39- output.vmesh.positionCS.xy = inputMesh.uv2 * unity_DynamicLightmapST.xy + unity_DynamicLightmapST.zw;
37+ uv = inputMesh.uv2 * unity_DynamicLightmapST.xy + unity_DynamicLightmapST.zw;
4038 }
4139
42- // TODO: Handle inversion ? See comment in albedoRender.cpp we maybe not have to flip here
43- #if UNITY_UV_STARTS_AT_TOP
44- // ?
45- #endif
46-
47- output.vmesh.texCoord0 = inputMesh.uv0;
48- output.vmesh.texCoord1 = inputMesh.uv1;
40+ // OpenGL right now needs to actually use the incoming vertex position
41+ // so we create a fake dependency on it here that haven't any impact.
42+ output.vmesh.positionCS = float4 (uv * 2.0 - 1.0 , inputMesh.positionOS.z > 0 ? 1. 0e-4 : 0.0 , 1.0 );
43+ output.vmesh.texCoord0 = inputMesh.uv0;
44+ output.vmesh.texCoord1 = inputMesh.uv1;
4945
5046#if defined (VARYINGS_NEED_COLOR)
5147 output.vmesh.color = inputMesh.color;
0 commit comments