Home Unreal Engine

Material Editor Questions!

greentooth
Offline / Send Message
fearian greentooth
So I've been spending the weekend getting to grips with the material editor and I'm finding it mind boggling how many expressions there are and all the cool things I can do with it.

Naturally I have some questions :)

For starters, how would I go about making a texture mirror repeat across an axis? eg:

IF5Us.png

Also, How would you create a parameter to control the intensity of a normal map?
Finally, what does a LERP actually do? What on earth is Linear Enterpo..lation..?


Also, I think it would be nice to have a general material editor thread* to liven up the forum a bit, so I'd love to hear any cool tips or setup's you guys found out!

*Rename thread, 'How u node dem mats':poly142:

Replies

  • Xendance
    Options
    Offline / Send Message
    Xendance polycounter lvl 7
    To increase normal maps' strength via a parameter, create a 3-vector parameter and then plug it into multiply node. Also plug the normal map into the multiply node. Then in the parameter (or edit the instance of the material) type numbers 2, 2, 0.5 (for example) into the RGB values. That should intensify it.

    LERP I think is just used to blend two textures together based on the alpha input.
  • moose
    Options
    Offline / Send Message
    moose polycount sponsor
    for your mirroring, will the texture tile?

    Within the texture properties (double click your texture), you can set it to CLAMP (edge pixels repeat for infinity), WRAP (default tiling), or MIRROR, which will flip the texture on every tile. You can set this on X and Y individually, so you can wrap Y and mirror X if need be.

    If you just want to flip it in the material itself, and only want to flip X, multiply a Texture Coordinate node by a 2 vector constant, and plug the multiply into the UV of the texture. Remember R = X, G = Y, if you put -1 in the R(x) slot, it should flip it.

    Linerar interpolate (LERP) nodes blend two textures based on an alpha. If you put a red color in A, and a blue color in B, you can blend between those two colors based on the value of the alpha slot. a single vector constant in the alpha set to .5 should look kinda purply i'd assume, and 1 & 0 would toggle between the values hooked into A and B.

    The alpha slot must be one dimensional, ie, it needs to either be a single vector constant, or a channel of an image - masked either by using a Component Mask node, or dragging a channel into the alpha.
  • divi
    Options
    Offline / Send Message
    divi polycounter lvl 12
    moose wrote: »
    for your mirroring, will the texture tile?

    Within the texture properties (double click your texture), you can set it to CLAMP (edge pixels repeat for infinity), WRAP (default tiling), or MIRROR, which will flip the texture on every tile. You can set this on X and Y individually, so you can wrap Y and mirror X if need be.

    ooh :D nice, didnt even think to it like that.

    messed around a bit to do it in the material itself but if he only wants to use the texture mirrored doing it in the properties is certainly preferable.

    2010-07-26_1603.png

    by changing the values in the constant2 vector with 1,1 the x and y tiling can be changed.
  • haiddasalami
    Options
    Offline / Send Message
    haiddasalami polycounter lvl 14
    This will become your friend or atleast I've been consulting it a lot. Now that I've been learning HLSL it's actually great to understand what the hell a dot product is, light vectors, eye vectors, matrixes and how to use them. Still more to learn, and been recently reading a lot of whitepapers on how games approach their shading.

    Whoops missed the link :P

    http://udn.epicgames.com/Three/MaterialsCompendium.html
  • r_fletch_r
    Options
    Offline / Send Message
    r_fletch_r polycounter lvl 9
    haiddasalami: how're you finding all the 'funky' math? :D (im still getting over mikes hat from the last lecture)
  • haiddasalami
    Options
    Offline / Send Message
    haiddasalami polycounter lvl 14
    r_fletch_r wrote: »
    haiddasalami: how're you finding all the 'funky' math? :D (im still getting over mikes hat from the last lecture)

    I was watching it on the bus and my friend kept commenting on his hat :D Liking it so far but definitely had to go back and review it. Which reminds me, there's probably a new class up. His hat better be twice as awesome :poly142:
  • moose
    Options
    Offline / Send Message
    moose polycount sponsor
    OT but, Divi: You can make the texture you using as a mask there in the material editor itself, no need to extra textures! Its a little more complex than adding a texture, but allows you do get clean masks without using a texture. The Append Vector stuff isn't really necessary, but I added it just to show it produces the same result :)

    udk_proceduralMaskexample.jpg
  • JordanW
    Options
    Offline / Send Message
    JordanW polycounter lvl 19
  • divi
    Options
    Offline / Send Message
    divi polycounter lvl 12
    ah, yes :D tried that at first too, but forgot the ceil and thus gave me very obvious errors in the center. thanks for sharing that, will keep it in mind for future stuff :)
  • ImSlightlyBored
    Options
    Offline / Send Message
    ImSlightlyBored polycounter lvl 13
    moose wrote: »
    OT but, Divi: You can make the texture you using as a mask there in the material editor itself, no need to extra textures! Its a little more complex than adding a texture, but allows you do get clean masks without using a texture. The Append Vector stuff isn't really necessary, but I added it just to show it produces the same result :)
    to expand on this just use

    custom float2
    return round(gradient.xy);

    where gradient is your gradient(s) for example texcoord node. If you were doing 3 gradients make it float 3 etc etc.

    this just keeps it real tidy

    edit: stupid me, didn't see that you also want to move it. oh well, maybe that will be helpful anyway. You can move it with a little pre-work on your gradients before round, and then saturate the entire result to get rid of nasty results.
  • JordanW
    Options
    Offline / Send Message
    JordanW polycounter lvl 19
    keep in mind Custom node isn't a good idea for production use, it prevents code side optimization of the material down stream from the node. Having said that it's a great prototyping/own time tool :)
  • Brice Vandemoortele
    Options
    Offline / Send Message
    Brice Vandemoortele polycounter lvl 19
    FYI: lerp(A,B, C) is basically

    A * (1-C) + B * C
    (which is pretty much alpha blending made into a function, where the background is A, the texture is B and its alpha is C)

    a more advanced version is smoothstep(), which gives a non-linear interpolation (lerp sands for linear interpolation) where the slope at 0 and 1 is 0:

    float smoothstep (float edge0, float edge1, float x)
    {
    x = saturate((x - edge0) / (edge1 - edge0));
    return x*x*(3-2*x);
    }

    http://en.wikipedia.org/wiki/Smoothstep
Sign In or Register to comment.