Announcement

Collapse
No announcement yet.

Extrude Texture intensity in Different masks

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

    Extrude Texture intensity in Different masks

    Hello!

    I am trying to extrack different color intensity in a texture.

    For exemple:
    I output de Red channel of a texture where there are 3 value of red, 1, 0.5 and 0.25.
    I would like to be able to take each of them seperatly so that I can apply a different color for each.
    I know that using the substract math function can help me get the intensity of 1 but I can't seem to figure out how to only get the 0.5 and the 0.25.
    Would anyone know of a way to seperate them all?
    Thanks in advance for the help I really appreciated it!

    Click image for larger version

Name:	test_Intensity.jpg
Views:	1
Size:	31.8 KB
ID:	1181126

    #2
    This is what I've been able to find within about 10 minutes of experimenting...

    Click image for larger version

Name:	19655b5956.jpg
Views:	1
Size:	211.5 KB
ID:	1105340
    Click image for larger version

Name:	8ae6e19756.jpg
Views:	1
Size:	187.9 KB
ID:	1105341
    Click image for larger version

Name:	f207f26487.jpg
Views:	1
Size:	99.5 KB
ID:	1105342

    There are Artifacts with the IF method, as you can see in the earlier screenshots, so I'm still working on it. If I decrease the threshold, the artifacts start to vanish for the far ends but the quality of the goal start is get pretty rough.
    See the much lower threshold below for the 0.5
    Click image for larger version

Name:	c6f51475c3.jpg
Views:	1
Size:	42.7 KB
ID:	1105343

    Comment


      #3
      You would have to use an uncompressed texture and not use mipmaps if you want to avoid artifacts like that, but performance wise you would be better off using 2 compressed textures instead of trying to clamp out different intensities.

      Comment


        #4
        What is the use case?

        Comment


          #5
          The use of that is that every channel RGB would have a motif and each motif would have these intensity. Each intensity would have a color so that I can create multiple motif with different color without having to load more texture. If basically for more variaty.
          I just tried what LMP3D posted but I dont get the same result at all. When I try the 0.25 value I only see the 0.5 an when I try the 0.5 value they all get black. I tried the two threshold value of 0.1 and 0.01 but still no luck in getting the same result.

          Comment


            #6
            Using textures like that will lead multiple problems. You need to disable compression, srgb, texture filtering and mipmaps. Also you need more complex material to extract those 1-bit patterns from your textures. So you are throwing all the build in hardware performance optimizations for small to non existant memory savings.

            Comment


              #7
              Honestly I would encode a fattened alpha or just surround each text block in an alpha color rectangle. Then by multiplying the alpha mask result with the emissive font mask and it should hide the artifact since they will not line up with any edges in the font.
              Ryan Brucks
              Principal Technical Artist, Epic Games

              Comment


                #8
                Well the alpha could maybe work with my image right now, but that image was just for testing. So I could have ovelay of intensity inside the material. My main goal is to have a motif in each channel and since each motif will not have the same look then they can't use the same alpha.

                Comment


                  #9
                  ah I see, yes my idea only works if the elements do not overlap on top of eachother. If you are going to have them spaced apart then it should work fine. but the fact that you are not channel packing seems to me to indicate they cannot overlap anyways.

                  This is probably excessive in your case but you could solve it with manual texture filtering. Somebody mentioned disabling texture filtering and that is probably the best option. You can write your own manual texture filtering. But then you will be in a weird place where you can't really get nice aniso mips since you will have to do it manually. if its just for a UI element its not a big deal. You may be able to find some guides on manual texture filtering. a tutorial on that is a bit too lengthy to come up with on the spot though.

                  either that or you simply use a different channel for each mask. that solves it entirely but then you only get 4 elements per texture. if you channel pack you dont have the luminosity problem since the channels are independent (except for some leaking compression artifacts, go uncompressed if it matters).
                  Last edited by RyanB; 04-26-2016, 12:47 PM.
                  Ryan Brucks
                  Principal Technical Artist, Epic Games

                  Comment


                    #10
                    I find it strange that the Clamp does not do what I am trying to achieve since the clamp only let a value pass if it's between the min and max value. I am not sure what you mean by manual texturing filtering. I dont know if that needs programming, I am not a programmer

                    I am sure there is a math way of achieving of only getting one intensity out of the red channel.

                    Maybe the problem is in my image.

                    Here are my red color values in photoshop (black and white layer in a group with only red channel activated):
                    1 = 255,255,255 (RGB)
                    0.5 = 128,128,128 (RGB)
                    0.25 = 64,64,64 (RGB)
                    Last edited by teckcloud; 04-26-2016, 09:05 PM.

                    Comment


                      #11
                      When textures get compressed and processed by any game engine, you're going to lose your perfectly clean values. Because they get compressed which adds compression artifacts and values outside of 1 .5 and .25. Also when a texture gets further away, the game engine wants to switch to a lower resolution version of the texture, which blurs the texture and dirties those values even more. You can disable those features by finding the right options and check boxes, but this approach in general is not optimal and there's probably other ways of achieving what you want to do in the end.

                      Comment


                        #12
                        I am not sure what you mean about clamp not doing what you are trying to achieve. It does exactly what it says it should do. It doesn't select a range, it clamps the output to be within the specified min/max.


                        If you have a black pixel next to a white pixel, when texture filtering is applied that means you actually have a gradient going from 0 to 1.0 that happens across the width of 1 pixel. So the borders of your white pixels have all other values surrounding them automatically. So that edge contains your 0.25 as well as your 0.5 value. The only way to disable that is to disable texture filtering which means your pixels will be hard squares.

                        Manual filtering doesn't require programming but does require advanced material usage. I don't want to go through the crazy long steps to suggest how to do it when you haven't replied to my other much easier suggestions like channel packing.

                        To disable texture filtering you go into the texture properties in UE4 and change it from "default" to "Nearest".

                        You did not respond on my channel packing suggestion. Is there some reason you have to do it this way rather than using a different color channel for each image? Again I do not see the point in using color textures that have all grey values and not leverage channel packing which solves all your problems. The only limitation would be 4 stamps per texture.

                        "I am sure there is a math way of achieving of only getting one intensity out of the red channel."

                        Yes but with texture filtering, ALL the values are actually there, just in a small border.
                        Last edited by RyanB; 04-26-2016, 10:21 PM.
                        Ryan Brucks
                        Principal Technical Artist, Epic Games

                        Comment


                          #13
                          Here is an example of why this happens. Lets say you have a 2x1 mask that has one white and one black pixel. With nearest filtering (aka filtering disabled) it would look like this zoomed in:

                          Click image for larger version

Name:	1.jpg
Views:	1
Size:	2.7 KB
ID:	1105412

                          But once texture filtering is applied, it is actually this you will get:

                          Click image for larger version

Name:	2.jpg
Views:	1
Size:	13.3 KB
ID:	1105414

                          So if you were to try to extract a mask for say 0.5.... it would show up here because the value exists. It would show up as a thin aliasing line right in the center here. But if you did it without filtering, the value wouldn't exist.

                          What you have is the above situation surrounding all your font edges.
                          Last edited by RyanB; 04-26-2016, 11:06 PM.
                          Ryan Brucks
                          Principal Technical Artist, Epic Games

                          Comment


                            #14
                            Originally posted by RyanB View Post

                            You did not respond on my channel packing suggestion. Is there some reason you have to do it this way rather than using a different color channel for each image? Again I do not see the point in using color textures that have all grey values and not leverage channel packing which solves all your problems. The only limitation would be 4 stamps per texture.
                            The reason I dont want the 4 colors to be one in the Red channel, one in the green, one in the blue and one in the alpha, is that each channel would have it's own motif inside.
                            I would only use one channel or mix the result of 2 to get more variations without having to load more texture. This technique qould be very useful for furniture, wallpaper and clothing motif on them.
                            Ex:
                            Red channel = Horizontal lines
                            Green channel = Vertical lines
                            Blue channel = Dots (Tiling)
                            Alpha channel = Opacity


                            I can't seem to view you 2 attachents. It say's ''Invalid Attachment specified. If you followed a valid link, please notify the administrator''

                            Comment


                              #15
                              Fixed attachments.

                              Ok, so what I think you are really saying is this:

                              You do intend to channel pack already and you want the range-based masking to work even within the individual channels.
                              Ryan Brucks
                              Principal Technical Artist, Epic Games

                              Comment

                              Working...
                              X