Home Unreal Engine

Transparent & Opaque Decal

I haven't had much luck in finding a tutorial (might be using wrong key words) on how to make a decal that is both transparent and opaque with desirable results, so I figured I'd post mine here.

Just figured this out yesterday as I was playing around with the material editor.

ligs.jpg

Here's the shader network. Set the Blend Mode to BLEND_AlphaComposite.

Without interpolating between black and the texture with the alpha map, you get this where parts of the texture aren't completely masked and appear transparent.
nzzq.jpg


Here's an example of the decal applied to a surface.
nwkv.jpg


Here's another example comparing between AlphaComposite and Masked

AlphaComposite:
whsi.jpg

Masked:
ohde.jpg

With AlphaComposite, you don't really get that sharp edge like the Masked blend mode.


Anyway, hope you all find this useful.

Replies

  • Harbinger
    Options
    Offline / Send Message
    Harbinger polycounter lvl 8
    I think you're over thinking this one a bit and technically using AlphaComposite improperly. The AlphaComposite blend mode I believe is used for textures with a pre-multiplied alpha.

    You should probably be comparing Blend_Masked vs. Blend_Translucent. In other game engine tech these could be called 1-bit alpha vs. 8-bit alpha. With Blend_Masked, texels are either fully opaque or fully transparent, with no blending, and thus the Opacity Mask input is activated on your material. With Blend_Translucent, you get the full 8-bit range of translucency and the material's Opacity input gets activated.

    There are different pro's and con's for using masked and translucent materials and it all depends on the circumstance. For what you're trying to achieve in the example you're showing I would simply use a Blend_Translucent material with the blend values stored in the alpha channel of your diffuse texture. Also, if you're not already, make sure you're using a Decal Material instead of a regular material.
  • Four6810
    Options
    Offline / Send Message
    *Mouth agape* Harbinger, you have just answered the question for something I've been looking all along. This is exactly what I am looking for.

    I can't remember the exact details, but a few years back, I was playing around with the blending modes and just not getting the end result I was looking for.

    Has the BLEND_Translucent always been this way? I'm really curious what I was doing back then because the solution you gave me was really simple.

    Anyway, BIG THANKS!
  • Harbinger
    Options
    Offline / Send Message
    Harbinger polycounter lvl 8
    No problem! I might be imagining things, but in older versions of Unreal they might not have greyed out material inputs based on the blend type like they do now, which made things a bit more confusing. Blend_Translucent has always worked this way though to my knowledge.
Sign In or Register to comment.