Electric Turnip
  • Blog
  • Stories
    • Story 000
    • Story 001
    • Story 002
    • Story 004
    • Story 007 - Unfinished
    • Story 008
    • Story 010 - BattleWagon
    • Story 012
  • Images
    • Adventure Caddie concept gallery
    • Page Design Gallery
    • Older Work
  • 5FEAT Video
  • Videos
  • Game Experiments
    • Climb
    • Super Shapetoy
    • TurboGarbageTruck
    • 031 - Best Games - Enchanter
    • 033 - Shader Test
  • Contact

500

5/30/2022

0 Comments

 
This will be a short one. I’m really just here to praise the graphical Swiss army knife that is Blender.
So, a little bit ago, I was working on some textures. The task was to pack a non-alpha grayscale image into the alpha channel. Non-alpha, in that it wouldn’t be used as transparency data for the image. I figured that a channel was a channel so how hard could it be. 
I’ll back up slightly.
Sometimes, when working with textures, especially for realtime 3d applications like games, you want to pack as much information as you can into each texture. Standard image files are made up of three or four channels. The Red, Green, Blue, and sometimes Alpha channels. Usually, each channel is a grayscale image that represents  steps from black to white, the contribution of each channel's pixels to the final image. If one pixel of the green channel is one hundred percent white, then the green contribution to that pixel will be turned up as high as it can be. 
Now there are a lot of perceptual issues that mean that some images have higher contributions from some channels, or they apply different falloff curves to different parts of the color spectrum, for simplicity’s sake, let's just say that each channel has a full range of 128 or 256 steps between black and white for each pixel.
There is nothing saying that you need to use those grayscale channels to build up parts of the same image. What if you have three, entirely different, grayscale images. Rather than using up all three channels of one texture, why not pack all of those into a single texture file using the R, G, and B channels. If you have a fourth one, you can pack that into the alpha channel. At least that’s what I thought.
Channel packing using the R, G, and B channels is pretty trivial, and pretty much any image editor will let you do that. Packing stuff into the Alpha channel proved to be a bit more difficult. 
The Alpha channel is usually used for transparency. Same rules apply, though. It is a grayscale image that controls how transparent or opaque each pixel is. The problems happen when you make a pixel 100% transparent.
Most image editors are pretty smart. They will try to infer what you are trying to do. If you convert an image from say, RGB color format to CMYK for printers, there is a set of steps and conversions that the image editor will go through to try to keep the colors as accurate to what you intended as possible. The same thing happens when you set a pixel in the alpha channel all the way to transparent. Most image editors will set that same pixel in the R, G, and B channels to zero as well. It makes sense when you think about it. If you are saving that image out with a bunch of zeros, data compression schemes can shrink the file quite a bit. Only problem is, when you are trying to do channel packing, you don’t want to lose that information.
Now, not all image editors did this. Some kept all the info, but had other issues. They couldn’t read the input images properly, or they couldn’t create an output image properly. They didn’t work with the formats I needed, or they lacked support for linear color space (sort of a must for some texture work).
After trying all the standard image editing tools I have, and it’s not an exaggeration to say that I have an awful lot, I found that only Blender did everything that I needed. Not only that, but it did it better and easier than any of the others. 
I will qualify that ‘easier’. Blender can look like the control panel of a 747 and it has functions buried under its function, but if you happen to know how it works, you can mix and match and mess with images in a truly unrestrained way.
I used the compositing part of Blender. It’s intended to be used to layer rendered or filmed images, blending them and adjusting them until they look seamless. It’s the sort of software used to piece together visual effects sequences in movies. Because of that raw image manipulating power, it’s also uniquely suited to ripping apart and reassembling textures in the most amazing ways.
I created a pipeline that split all of the channels and then recombined them in any way that I liked, and any set of images that I used as the input could be run through the system and recombined. Not only that, but Blender works with damn near any image format that you could imagine, and it’s all hardware accelerated. I could rip apart massive 5K textures and put them back together into uncompromising .EXR files (without a doubt, the best image format that people have come up with), in literal seconds.
I don’t know that a tutorial on how to do it is exactly warranted here, but this is a picture of the node tree that the textures run through.
Blender is really one of the best things to happen to graphics in a very long time.
Picture
0 Comments



Leave a Reply.

    Archives

    December 2022
    November 2022
    October 2022
    September 2022
    August 2022
    July 2022
    June 2022
    May 2022
    April 2022
    March 2022
    February 2022
    January 2022
    December 2021
    November 2021
    October 2021
    September 2021
    August 2021
    July 2021
    June 2021
    May 2021
    April 2021
    March 2021
    February 2021
    January 2021
    December 2020
    November 2020
    October 2020
    September 2020
    August 2020
    July 2020
    June 2020
    May 2020
    April 2020
    March 2020
    February 2020
    January 2020
    December 2019
    November 2019
    October 2019
    September 2019
    August 2019
    July 2019
    June 2019
    May 2019
    April 2019
    March 2019
    February 2019
    January 2019
    December 2018
    November 2018
    October 2018
    September 2018
    August 2018
    July 2018
    June 2018
    May 2018
    April 2018
    March 2018
    February 2018
    January 2018
    December 2017
    November 2017
    October 2017
    September 2017
    August 2017
    July 2017
    June 2017
    May 2017
    April 2017
    March 2017
    February 2017
    January 2017
    December 2016
    November 2016
    October 2016
    September 2016
    August 2016
    July 2016
    June 2016
    May 2016
    April 2016
    March 2016
    February 2016
    January 2016
    December 2015
    November 2015
    October 2015
    September 2015
    August 2015
    July 2015
    June 2015
    May 2015
    April 2015
    March 2015
    February 2015
    January 2015
    December 2014
    November 2014
    October 2014
    September 2014
    August 2014
    July 2014
    June 2014
    May 2014
    April 2014
    March 2014
    February 2014
    January 2014
    December 2013
    November 2013
    October 2013
    September 2013
    August 2013
    July 2013
    June 2013
    May 2013
    April 2013
    March 2013
    February 2013
    January 2013
    December 2012
    November 2012
    June 2012
    October 2011
    July 2011
    June 2011
    May 2011
    April 2011
    March 2011
    November 2010
    October 2010
    August 2010
    July 2010
    June 2010
    May 2010
    April 2010

    Categories

    All
    Adventure Caddie
    Best Games

    RSS Feed

Owen McManus
  • Blog
  • Stories
    • Story 000
    • Story 001
    • Story 002
    • Story 004
    • Story 007 - Unfinished
    • Story 008
    • Story 010 - BattleWagon
    • Story 012
  • Images
    • Adventure Caddie concept gallery
    • Page Design Gallery
    • Older Work
  • 5FEAT Video
  • Videos
  • Game Experiments
    • Climb
    • Super Shapetoy
    • TurboGarbageTruck
    • 031 - Best Games - Enchanter
    • 033 - Shader Test
  • Contact