Search Unity

[Released] Channel Mixer

Discussion in 'Assets and Asset Store' started by VisualTech48, Nov 26, 2018.

  1. VisualTech48

    VisualTech48

    Joined:
    Aug 23, 2013
    Posts:
    247
    IMG_04.jpg

    Channel Mixer is a free solution to mix 4 textures into one, in order to save memory. This technique is long being used, but it was always a hassle of going into either Photoshop or GIMP and combining shaders which take valuable time. This was quite annoying to me, especially when I was testing HDRP, which uses a Mask map.

    So I've decided to put my time and effort to make a semi GPU and CPU converter in order to maximize on both performance and time to compile these images. The plugin utilizes RenderTexture to render the image with the GPU and uses the CPU to copy it towards a location you want. I'll be sure to work on it the more I go but for now, I want to share it with all of you good folk.

    I've made it free as throughout the years I've worked a lot of people gave me their time and helped me with numerous issues and selflessly helped me, way long before since 2012 when I first grabbed Unity so what better way to thank everyone.

    Regarding my code, I'm sure that it is not the most optimized but I'll be sure to do as much optimization with the next release where I'll add more fidelity towards the design, and make it more "user-friendly" in sorts that it shows and logs everything, add more options, and possible even batch exporting.

    How does it work?
    It works on a simple principle that the GPU renders and makes images a lot faster than the CPU does. It's a known fact, and the GPU is specifically made for it.

    When you press "Generate" the RenderTextures updates and makes the Camera (GPU) renders the actual image. This is extremely fast due to, again, the GPU is designed to do that. The shader itself combines the 4 images prior to that, and what is left is for the CPU to actually get the GPU (RenderTexture) image and copy it to the disk (something that the GPU cannot do).

    What does the shader do?
    Untitled-1.png


    This semi GPU-CPU solution is what I thought to be a good approach due to the nature of the components.


    Thank you all, and enjoy!