فهرست منبع

Bugfix: Fixing OpenGL so it renders omni-directional shadows as backfacing, same as other backends

BearishSun 8 سال پیش
والد
کامیت
9557c20d89
2فایلهای تغییر یافته به همراه7 افزوده شده و 1 حذف شده
  1. BIN
      Data/Engine/Shaders/ShadowDepthCube.bsl.asset
  2. 7 1
      Data/Raw/Engine/Shaders/ShadowDepthCube.bsl

BIN
Data/Engine/Shaders/ShadowDepthCube.bsl.asset


+ 7 - 1
Data/Raw/Engine/Shaders/ShadowDepthCube.bsl

@@ -53,13 +53,19 @@ technique ShadowDepth
 						output.targetIdx = faceIdx;
 
 						// Note: I'm reversing the order here because otherwise the triangle order is reversed
-						// (not sure why, but GS seems like it could be the only culprit)
+						// (not sure why, but GS seems like it could be the only culprit). This doesn't happen in
+						// OpenGL, because we flip the projection matrix Y axis due to upside-down UV coordinates
 						[unroll]
+						#ifdef OPENGL
+						for (int vertIdx = 0; vertIdx < 3; vertIdx++)
+						#else
 						for (int vertIdx = 2; vertIdx >= 0; vertIdx--)
+						#endif
 						{
 							output.position = clipPos[vertIdx];
 							outStream.Append(output);
 						}
+						
 						outStream.RestartStrip();
 					}
 				}