Home Technical Talk

Channel shuffle - Shuffle color channels

polycounter lvl 10
Offline / Send Message
lukors polycounter lvl 10
Channel Shuffle was inspired by the channel shuffle node in Substance Designer and does the same thing plus some extra stuff. It takes in two images and lets you select four channels from those two images that will form a new image. You can also choose to invert a channel and if you use the CLI version you can resize the output image using nearest neighbor.

There is a CLI (command line interface) version and a GUI (graphical user interface) version.

The CLI version can be useful if you want to implement some channel shuffling straight into some pipeline step. I for instance plan to use this application to automatically take five textures (albedo, normal, roughness, metallic and ao) and automatically shuffle them into two textures (roughness in the albedos alpha channel, and metallic and ao with the normal), without our artists having to care about what textures to put into what channels.
4U4bWdggif

The GUI version is useful for those who might want to do that shuffling manually, or if you want to shuffle or flip some channels in a normal map that might be wrong, or quickly put something into the alpha channel of some texture, or if you want to invert one or more channels and so on.

I did my best making the application light, fast, easy to use and portable. And it really is all of those things (except Qt I guess, not very light :P ). It's written in C++, the GUI uses drag and drop, it has hotkeys and previews for everything. In the background the GUI uses the CLI version which is 200kB in size and can be removed and used on its own, without the 38MB added by Qt when unzipped.

It can be downloaded from my website at http://orsvarn.com/entry/channel-shuffle/ 
The application and its source is public domain, so you can do whatever you want with it. The source can be found here: https://github.com/lukors/channel_shuffle

Feel free to ask questions, give feedback and discuss the tool in this thread.

Replies

  • Eric Chadwick
    Options
    Offline / Send Message
    Very cool! Thanks for sharing this.

    Added to the wiki, here
    http://wiki.polycount.com/wiki/ChannelPacking
  • kodde
    Options
    Offline / Send Message
    kodde polycounter lvl 18
    Looks mighty useful Lukors thumb-up.png


    I tried it on my end and had some issues. During first startup directly from my windows downloads folder it would it would take some while, then a cmd-window showed up, no gui though. Used task managed to close the channel_shuffle.exe(I think it was?). Then it reappeared along with the GUI interface. I tried closing it a few times but reappeared a few more times. Finally got it closed.

    Moved the whole extracted folder to c:\ and it worked better. Moving it back to the downloads folder reproduces this weird behaviour. It doesn't show the GUI but rather just the CMD-window and keeps closing and reopening itself? Two instances of "channel_shuffle.exe" seem to show up in my task manager.

    Anyways, when running it from C:\ it shows up fine. Loads images fine and lets me swizzle them around with preview windows working correctly. However the drag-drop to save doesn't seem to work properly for me. It creates an "untitled.tga", but it's all black. Disabled both my AV and FW software and made sure to run the application as admin but to no success. I'm running Win7 64bit.

    GfXnGn.jpg
    When running from Downloads-folder. Keeps opening and closing that CMD-window by itself. Had to quickly close down both "channel_shuffle.exe" instances to get it to stop.
  • lukors
    Options
    Offline / Send Message
    lukors polycounter lvl 10
    I'm running the same system and I am unable to reproduce the bugs you are experiencing, kodde. Thanks a lot for the detailed bug report, I will keep investigating these issues to see if I can find what causes them!

    Thank you Eric for adding the application to the Wiki!
  • kodde
    Options
    Offline / Send Message
    kodde polycounter lvl 18
    Finally figured out with the help of lukors that it was Avast Antivirus screwing with me when running the application from within c:\users\<userprofile>\. Might be useful if anyone else runs into this issue.
  • lukors
    Options
    Offline / Send Message
    lukors polycounter lvl 10
    kodde had also figured out that the images were actually not black. The problem came from that the application defaults missing channels to black. He had used jpg images and left the alpha channel unshuffled (it defaults to the alpha channel of the top image), and so when he exported it his image preview software used the alpha to show the black background instead of the RGB channels.

    This is fixed in the latest version where the alpha channel defaults to white instead. This next version should hopefully be out within a week.

    Thanks a lot for the deugging help kodde! :)
Sign In or Register to comment.