Home Unreal Engine

Hard Light Blend

polycounter lvl 6
Offline / Send Message
Kligan polycounter lvl 6
In photoshop hard light blend treats neutral grey (128.128.128) as a tone that does not affect the layer under it.
But in ue4 the same neutral grey color value makes everything darker when blended through hard light blend.

I want to add some details to my material, but can't figure out how to blend it so that I have a color value that would be treated as "transparent" during the blend? Lerp, where alpha for blending can be specified, does not give me the desired result.

Edit: I sampled the color from the texture's channel I'm trying to use for hard light blend in ue4, and the grey value is much darker than in photoshop (93.93.93).
Must be something with working color profiles in photoshop, I guess? I'm not sure how it gets darger after exporting.

Replies

  • Obscura
    Options
    Offline / Send Message
    Obscura grand marshal polycounter
    Some image formats applies color correction. Try enabling/disabling srgb on the mentioned texture inside Unreal.
  • Kligan
    Options
    Offline / Send Message
    Kligan polycounter lvl 6
    Obscura said:
    Some image formats applies color correction. Try enabling/disabling srgb on the mentioned texture inside Unreal.
    SRGB in ue4 does not change anything. Howerver, it seems like if I enable "gamma 2.2" profile for greyscale image in photoshop, it does match the end result in ue4. 
  • Obscura
    Options
    Offline / Send Message
    Obscura grand marshal polycounter
    Well if it does not change anything you are doing something wrong because gamma 2.2 is literally srgb. You can put a power node after the texture and use 2.2 as power. or 0.4545. To remap to srgb or to linear.
  • Kligan
    Options
    Offline / Send Message
    Kligan polycounter lvl 6
    If I'm exporting the texture by itself in .tga 32 bits, then all the tones match in ue4. However, if I try to export it as a part of a combined texture mask where each channel is used for a separate texture, then it gets darker than corresponding channels in photoshop.
    I'm not sure how to fix this.
  • Obscura
    Options
    Offline / Send Message
    Obscura grand marshal polycounter
    Try putting power(0.4545) after the texture.
  • Kligan
    Options
    Offline / Send Message
    Kligan polycounter lvl 6
    Obscura said:
    Try putting power(0.4545) after the texture.
    You mean like so?


    It just makes the end result pale-grey.
  • Kligan
    Options
    Offline / Send Message
    Kligan polycounter lvl 6
    Allow me to explain what I am trying to do...

    I had this stupid idea to reduce the number of textures used on the scene by blending details on top of a high-resolution texture that is used for multiple objects and surfaces. That way I could have variations without the need to make a unique texture set for each object.

    So I made this in my shader:


    It gets the job done.
    Here's a detail with no blend:


    And this is blend enabled:


    End result:


    However, using Lerps is less than ideal, because that way I have to do lighter details and darker details as separate channels. I.e. edge highlights are in channel G, and occlusion around bolts and such is in channel B.
    In theory if I could use hard light blend with neutral grey as a "transparency", then I could combine both channels into one, save some texture memory and have more control over details that got blended into main texture.
    But unfortunately, as I've mentioned earlier in this thread, colors per channel in ue4 do not match the same channels in photoshop. So I couldn't make the hard light blend work correctly in the shader.
  • Kligan
    Options
    Offline / Send Message
    Kligan polycounter lvl 6
    Well, I figured out how to do it.
    If I make a texture in greyscale with grey gamma 2.2 color profile, and 126.126.126 grey background as neutral, and then put that into a channel and import to ue4, then hard light blend works correctly.
    Unfortunately though, because of the "Masks" compression settings on the texture the hard light blend does sub-par job in preserving details.
    So I guess I'll just stick with my lerps. :)
Sign In or Register to comment.