Josh Posted May 23 Share Posted May 23 This extension adds a menu item in the texture editor that will do the necessary channel swizzle to convert a unity "mask texture" into the standard occlusion / roughness / metal map that Khronos glTF and Ultra use. After the process finishes you can save the texture, probably in DDS format with BC7 compression, and start using it. Unity Mask Texture.lua Quote My job is to make tools you love, with the features you want, and performance you can't live without. Link to comment Share on other sites More sharing options...
Josh Posted May 23 Author Share Posted May 23 If you want to convert a lot of files in a batch process, you can do something like this: local dir = LoadDir("mask") for n = 1, #dir do collectgarbage() local pixmap = LoadPixmap("mask/"..dir[n]) if pixmap ~= nil then local x, y, r, g, b, a for x = 0, pixmap.size.x - 1 do for y = 0, pixmap.size.y - 1 do local rgba = pixmap:ReadPixel(x, y) r = Red(rgba) g = Green(rgba) b = Blue(rgba) a = Alpha(rgba) rgba = Rgba(g, 255 - a, r, 255) pixmap:WritePixel(x, y, rgba) end end pixmap:Save("mask/"..dir[n]) end end Quote My job is to make tools you love, with the features you want, and performance you can't live without. Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.