Home Technical Talk

Photoshop Blend Modes - UDK Equivalents?

polycounter lvl 10
Offline / Send Message
SirCalalot polycounter lvl 10
Hi Polycounters!


Are there any particular ways in which to recreate some Photoshop blend modes within UDK's Material Editor?
(Blending between two textures instead of blending between layers.)

I know the simple ones:

Photoshop's Multiply = UDK's Multiply
Photoshop's Linear Dodge = UDK's Add

But are there any relatively simple ways to achieve Soft Light, Overlay and Screen blends etc. in UDK?


Thanks!

Replies

  • Pampers
    Options
    Offline / Send Message
    you can use material functions to simulate photoshop blend modes :)
  • LoTekK
    Options
    Offline / Send Message
    LoTekK polycounter lvl 17
    I put together a package with a bunch of material functions that do quite a number of the blend modes a while ago. I'll have to hunt around for it; I'll put it up when I get a hold of it.
  • haiddasalami
    Options
    Offline / Send Message
    haiddasalami polycounter lvl 14
    UDK has those blend modes packaged I believe as material functions.
  • SirCalalot
    Options
    Offline / Send Message
    SirCalalot polycounter lvl 10
    Ah, thank you very much, guys!

    I had no idea that UDK had it's own set of pre-created Material Functions.

    @LoTekK that would be great, thanks :)

    Tonight, I shall have a blast at combining the Multiply and Screen blend functions in UDK to achieve the Soft Light blend effect for some nice grunge.
  • Xoliul
  • SirCalalot
    Options
    Offline / Send Message
    SirCalalot polycounter lvl 10
    Cheers @Xoliul, I was looking for a similar page to that first link :)
  • Esther58
    Options
    Offline / Send Message
    Thanks for your postwww.hdmitodvid.com
  • tuxmask75
    Options
    Offline / Send Message
    tuxmask75 polycounter lvl 10
    What would the Photoshop normal overlay blend mode be if constructed with nods?
  • Money
    Options
    Offline / Send Message
    Money polycounter lvl 8
    Check material functions, you have blend modes examples there.
  • tuxmask75
    Options
    Offline / Send Message
    tuxmask75 polycounter lvl 10
    Yes, except this one is not exactly in there.
    Looking for the default blending from photoshop.
  • Money
    Options
    Offline / Send Message
    Money polycounter lvl 8
    Do you mean blending between two layers like having a mask on the top layer?
  • tuxmask75
    Options
    Offline / Send Message
    tuxmask75 polycounter lvl 10
    blending a color like black into a texture.
    or 2 textures togeather.
  • Money
    Options
    Offline / Send Message
    Money polycounter lvl 8
    That would be Lerp (linear interpolate) node based on the Alpha value.
    So Texture 1 goes to slot A (this corresponds 0 value or black), Texture 2 goes to B slot (1 value or white), and Alpha can be a constant 0-1 range that controls amount of the blend. For example 0.3, blend 30% Texture 1 and 70% of Texture 2. This is the same thing as opacity blend where you drag the slider of the top layer. Also, like in PS you can use some greyscale texture mask for it.
    Is this what you wanted or something else?
    LinInterpExample.jpg
  • System
  • tuxmask75
    Options
    Offline / Send Message
    tuxmask75 polycounter lvl 10
    Hmm that linear interpolate may be what I'm looking for.
    Basically here is my situation, i have 1 texture that needs to stay static, and another texture that can change color on the fly to match the other texture's colors.( basically darken it)
    I can match the colors pretty close in photoshop, but not in UDK.

    Here is what I'm doing in photoshop.
    step 1: copy a strip of the darker color so that i can visually match the subject texture to it.

    Step 2: copy the subject texture to a new layer than multiply it by 100

    step 3: make a new layer than use a black texture, and blend its layer on Normal to 44%
    (if u notice the textures now match with exception to bottom because of the gradient on the static texture)
    step1o.png

    step2c.png

    step3wy.png

    Here is the Result





    result.pngcrapk.png
  • Money
    Options
    Offline / Send Message
    Money polycounter lvl 8
    Probably gamma affecting it so most likely that's the reason why your setup isn't giving proper result. In the texture properties window SRGB should control if it gets corrected or no, so have you tried checking/unchecking that on your textures and testing it then.

    Also Lerping is one way to do it, however when one of your slots is pure black, its really the same as multiplying to a 1 vector constant. Even better, use Scalar parameter for it and make Material Instance so you can iterate more quickly without recompiling the shader every time you make a change.
    Step 2 I really think you should do in photoshop and contrast it there, because multiplying texture onto itself in shader makes math needlessly more complicated (except 0 and 1 everything else gets squared, so 0.5 becomes 0.25 etc. add 3 channel composite to that and it's a mess to track the result). You can do some brightness/contrast control though by multiplying to a constant then passing it to the Power node and do exponent of some other 1 vector constant.

    But if you want to over complicate things and have some reference to match the color, here's the setup without that step 2 (you can add that too if you want). In the end when you've found the value you need, just leave texture with multiply part and delete everything else.

    Bottom part is Solid right gradient from link here: http://udn.epicgames.com/Three/MaterialMasks.html
    Since you used 16x16 grid here that 0.0625 will mask out on the left side 1/16 of the reference dark texture 15/16 to the other texture so you can compare them both. Add with TexCoord and 1.06 and 1, will offset the texture by 6% to the right, again just for easier color matching. Multiply part is self explanatory. Make Material Instance, find "Darken texture" value you need, delete parts of the material you don't need when you're done. Once more I really think this is over complicated, but if you really need to match colors, this should do the job.

    http://www.abload.de/img/matsetupoxuj5.jpg
  • Bigjohn
    Options
    Offline / Send Message
    Bigjohn polycounter lvl 11
    ChrisPerr wrote: »

    That seems pretty interesting, but is there a way to see the actual materials? I can't make anything out from those small shots.
  • Ace-Angel
    Options
    Offline / Send Message
    Ace-Angel polycounter lvl 12
    ChrisPerr wrote: »
    Maybe the small pictures are an upload mistake sometimes sites tend to fart out due to HTTP errors with image formats? If not, I hate it when people do this in their portfolio's (EI: putting up the material and the looks of it, with a really tiny, pointless node setup).
  • tuxmask75
    Options
    Offline / Send Message
    tuxmask75 polycounter lvl 10
    Thanks for the suggestions Money,
    I wish that i could do step 2 in photoshop,as it would ruin the other use for the texture when its in its in its unchanged color state.

    I had attempted the power nod setup to try and build step 2 with that but it seems to lose some color data on a few pixels.
    Yeah I could get better color matching with SRGB off although the overall shade of the textures were really desaturated feeling.

    EDIT: here is the link to the UPK, if anyone would like to take a shot.
    http://depositfiles.com/files/shjwxxnoz
  • SirCalalot
    Options
    Offline / Send Message
    SirCalalot polycounter lvl 10
    Quick question, moderately related to this:

    Does anyone know if the performance hit is more severe adding an overlay image to a texture in UDK or just doing it in Photoshop and importing as a separate image?

    Or is this a 'how long is a piece of string' question?
  • Macattackk
    Options
    Offline / Send Message
    Macattackk polycounter lvl 7
    SirCalalot wrote: »
    Quick question, moderately related to this:

    Does anyone know if the performance hit is more severe adding an overlay image to a texture in UDK or just doing it in Photoshop and importing as a separate image?

    Or is this a 'how long is a piece of string' question?

    any extra stuff done in UDK will cost more. if you do it in photoshop its just one image. if you do it in UDK its atleast 2 images plus the shader nodes to do it
  • SirCalalot
    Options
    Offline / Send Message
    SirCalalot polycounter lvl 10
    So I gather that if you want to create two materials - one dirty and one clean - then you may as well make a clean diffuse and dirty diffuse in Photoshop and import them into UDK.
    Rather than making a clean texture and grunge texture in PS and combining them in UDK.

    Thanking you kindly.
  • WarrenM
    Options
    Offline / Send Message
    It all depends ... as always. With 2 textures instead of a blend you trade video card memory for shader performance.
  • SirCalalot
    Options
    Offline / Send Message
    SirCalalot polycounter lvl 10
    I suppose if you want to have a great deal of clean textures with grunged up variants, then it would make sense to do it in-shader and cut down on texture usage considerably.
    But if only a few textures needed dirty versions, then maybe an extra couple of textures would be fine.

    Ain't figuring out optimization grand?
Sign In or Register to comment.