BinomialLLC/crunch

xGxR sets R channel to 0 instead of 255.

fahickman opened this issue · 0 comments

DXT5nm probably isn't used much anymore, but setting the red channel to 255 instead of 0 lets you use it interchangeably with DXT1, or BC5, or whatever in the same shader. Like this:

normal.x = tex.x * tex.a;
normal.y = tex.y;
normal.z = sqrt(1 - normal.x * normal.x - normal.y * normal.y);

diff --git a/crnlib/crn_image_utils.cpp b/crnlib/crn_image_utils.cpp
index 409e675..d222a08 100644
--- a/crnlib/crn_image_utils.cpp
+++ b/crnlib/crn_image_utils.cpp
@@ -1075,7 +1075,7 @@ namespace crnlib
                   }
                   case image_utils::cConversion_To_xGxR:
                   {
-                     dst.r = 0;
+                     dst.r = 255;
                      dst.g = src.g;
                      dst.b = 0;
                      dst.a = src.r;