Home Unreal Engine

Decals

polycounter lvl 15
Offline / Send Message
Swarm22 polycounter lvl 15
Is there a way to have a decal texture sheet full of decals and somehow have a mask for each one that the decal actor can switch between?

I'm currently trying to figure it out but thought i'd ask here to see if it were even possible or if i'd have to make a new material for each one.

Thanks

Replies

  • yaschan
    Options
    Offline / Send Message
    yaschan polycounter lvl 7
    Swarm22 wrote: »
    Is there a way to have a decal texture sheet full of decals and somehow have a mask for each one that the decal actor can switch between?

    I'm currently trying to figure it out but thought i'd ask here to see if it were even possible or if i'd have to make a new material for each one.

    Thanks

    I'd also like to know this
  • Finalhart
    Options
    Offline / Send Message
    Finalhart polycounter lvl 6
    You could put greyscale decals in RBG and Alpha channels to have 4 of them. Then is just a matter of making switches in the Material. But i guess you can't get away without creating Material Instances, or creating them inside the Blueprint of your Actor.

    As for a texture sheet with more than 4 decals...that could be tricky maybe someone how has done this before could help.
  • Fwap
    Options
    Offline / Send Message
    Fwap polycounter lvl 13
    https://answers.unrealengine.com/questions/14855/cropping-texture-atlases.html

    Someone worked out a way, but as he states there's a bit of bleed.
  • Obscura
    Options
    Offline / Send Message
    Obscura grand marshal polycounter
    The material example in Fwap's link would work fine.
  • Kbrom12
    Options
    Offline / Send Message
    Kbrom12 polycounter lvl 8
    Literally just did this today with an 2x2 sheet using 3 channels for 12 decals to a texture(grayscale), worked quite well. I had to combine the link Fwap posted with another one that I can't find right now but it basically got rid of the bleed that was caused...It had a custom node setup with the code - return Tex.SampleGrad(TexSampler,UV,ddx(UV1),ddy(UV1));

    I'll keep looking for that link
  • Der Hollander
    Options
    Offline / Send Message
    I once built a material to handle a set of decals that worked in multiples of 4 (you could concievably do it with any number but the math gets real tricky), I'd have to rebuild it for a screenshot, but the basic principle is that you essentially just use the tex coord, hook in 2 scalars with an append node to pull in your XY coordinates (.25 for a 4x4, .5 for a 2x2, etc.) to scale up the texture displayed so it fills the 0-1 space, and then you use panner nodes after the TexCoord node as the X and Y selector switches to move the texture up/down, left/right. Just make sure your scalars are parameterized and you can then use material instances to to dynamically switch between your decals. I believe with this setup, you can also use a tiling left/right texture by switching the X axis parameter to 1. I dunno how this handles overall with tilables and bleed, but it worked just fine with the decals. I was able to author a 4x4 (16 decals for one texture set call) and a 4x2 (8 decals for one texture set call) using the same master material. I think conceivably using a panner setup you could use any number decals on a sheet, but I would keep the decimals rational (no thirds) so you don't run into any issues with Unreals decimal precision causing seams.

    No idea if this is helpful, It's not specifically different than the link posted previously, but instead of using 2Vecs, everything's separated out, which I find a little easier to work with.
Sign In or Register to comment.