Announcement

Collapse
No announcement yet.

Self made 6ch Mask

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Self made 6ch Mask

    Hello there,

    I got to a point where I have no idea how to describe my problem precicely enought for google search, so instead I gonna ask you guys what you think about that.

    I had build myself a ComponentMask with 6 channels. Red, blue, green, yellow, magenda and cyan can be separatet from each others.
    https://www.dropbox.com/s/mfqtj4ekw2...DK_6chmask.png

    Now I am trying to use the mask by separating each channel from each other and animating them.
    https://www.dropbox.com/s/m0v6mir2e0...tthemoment.png
    One channel goes with Panner speed 0.25, the other -0.25
    the problem is, I cannot connect them together throu a multiply, because when I do this, the whole image will be displayed instead of the mask, and this twice, as the Panner goes on.

    https://www.dropbox.com/s/linxdir3xc...sk_problem.png

    For more detail how I created my 6ch Mask, here is an another pic:
    https://www.dropbox.com/s/0cz1qwkj8w...ask_detail.png

    I hope for any explonation how I could connect 2 kinds of mask like you can do with diffuse (using multiply, or add) together.
    As I understand, if I use mask, only 1 Channel will be displayed in greyscale, but what I cannot understand is, how could I make out of them one piece of image "again".

    Greetings B

    #2
    I forgot to mention, for me its a challenge to make it work, not the result. I could use several images instead, each splitted from the sourceimage and use panner to achieve the result, but I would like to find a way for this.

    Comment


      #3
      Huh. I don't know if it's possible to use a six channel mask in one texture. I usually make a mask with the 3 channels and alpha if needed (when i need different effects for my texture). Then in the material editor you u connect each channel (red green or blue) to their respective nodes. I'd u are panning one channel, then duplicate the material.

      Comment


        #4
        Kudos for trying to do this but I would expect it to be a lot of work with very little return or success.
        This is not an answer to your posted question, rather some information on why the results may not be what is expected.

        You will most likely run into issues trying to create a 6 channel mask due to the way that DXT texture compression works.
        DXT compression is designed to work with standard color textures where color loss and compression artifacts are less noticeable, such as grass, dirt, metal, wood, paint, etc.

        Your source image that contains the 6 channel mask will be compressed using DXT1, or DXT5 if you use the A channel, and the result will end up with a large amount of color loss and color shift.

        In DXT compression, each 4x4 block of 16 pixels gets compressed down to only 4 colors.
        These colors are then reduced from the original RGB 8:8:8 (24-bits per pixel) down to RGB 5:6:5 (16 bits per pixel).
        Then two actual colors are stored in a palette, along with two interpolated colors that are forced to lie on a linear line in color space between the two actual colors.
        If the original colors that were used for the interpolated colors do not lie on a linear line in color space between the two actual colors, the resulting color shift on these can be very noticeable, and in the case of textures that are used in materials that rely on specific color values in the texture pixels, the material may often fail to produce the desired results.
        This is why DXT compression only works well with certain images and specific material setups.

        What this means when using an image as a mask is that you really should only ever try to get 3 masks into a DXT1 RGB texture and four masks into a DXT5 ARGB texture, by sticking to using only the RGB or ARGB channels themselves.
        In a DXT1 texture the G channel should contain the most important mask layer since it has the most bits after compression (6-bits).
        In a DXT5 texture the A channel should contain the most important mask layer since it has the most bits after compression (8-bits per pixel with 8 gray levels per 4x4 block) and is not interpolated into the RGB channels, followed by the green channel (6-bits).

        And even when limiting the masks to just the RGB channels, the resulting masks often get pretty messed up compared to the original mask images.
        For example, if the source mask image used 256 gray levels, and then was placed into the R or B channel, after DXT compression it will only have 32 gray levels. The G channel will only have 64 gray levels.

        Comment


          #5
          Ok, so far I understand it cannot work due to the compression rate within a png/jpg texture. But if i would use a .bmp texture, would be that more precise with the color?
          Assumed I make shure that i have no antialasing and only precisely the color rgb-ymc in the texture then it could work?
          Only for a "static" picture.

          Comment


            #6
            The DXT Compression I am referring to is how the texture is converted to a new format by UDK after you import it.

            The source image file format does not make any difference, whether it is BMP, PNG, TGA, etc.
            All source image formats are converted to DXT Compressed texture format for use in the game engine.
            This is typical for all 3D engines, the 3D API uses DXT Compressed texture format by default, so all source image formats get automatically converted.

            There are some texture options for each texture file, but it is best not to mess with those unless you are aware of what each does and the consequences.

            Attempting to put too much differing data on adjacent color planes usually results in a badly blurred or artifacted texture because of the limit of 4 colors per 4x4 pixel block in DXT Compression. There is no way to get around this limitation with DXT Compression.

            If I required 6 masks I would just use two image files with 3 masks each in their RGB channels.
            It will make very little difference whether 1 or 2 textures are used, the additional amount of texture memory used will be minimal, and the material shader will be significantly less complex and faster to render.

            There is more than likely a hack method to pack more masks by using blended colors, but the gamma correction and DXT Compression will make it exceedingly difficult to successfully extract each mask and keep it fully intact, and I wouldn't spend the time trying to wire up a working material shader just for this.
            The final result will more than likely be significantly worse looking than using two textures with 3 masks each.

            Comment


              #7
              I thought TGA imported uncompressed RGBA.

              Comment


                #8
                It will get compressed.

                When importing an image file the DXT Compression can be delayed if the Defer Compression option is enabled on the Import dialog.
                The imported texture will then be compressed when the package is saved, or if you choose the Compress Now option.
                This is for all imported texture files regardless of their source image file formats. They will all get DXT Compressed with UE3.


                There are a couple of texture options and special cases where the DXT Compression can be changed or does not occur:

                - If a texture is smaller than 4x4 it will not be compressed.
                DXT Compression requires at minimum one 4x4 block.

                - If a texture has a width or height that is less than 4 it will not be compressed.
                This is a good usage for gradient strips that control various material functions since for example a 2x256 image will not get compressed.

                - Setting a NormalMap texture to TC_NormalmapUncompressed gives an uncompressed-like normalmap texture, but this has a side-effect where the resolution is reduced by one mip-map, so the largest mip resolution used in-game is 1/4 the size of the source normalmap.

                - Setting TC_DisplacementMap will use the bitmap Alpha channel data as a grayscale.

                - Setting TC_Grayscale assumes that the image content is one grayscale plane and stores the pixel data accordingly for best grayscale quality.
                This is good for single grayscale plane masks.


                FYI: UE2 had a Texture No Compression option, but Epic removed that feature for UE3.
                Unless Epic has recently added some undocumented option that I am unaware of, all textures are DXT Compressed except as noted above.

                Comment

                Working...
                X