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:
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
LERP I think is just used to blend two textures together based on the alpha input.
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.
ooh 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.
by changing the values in the constant2 vector with 1,1 the x and y tiling can be changed.
Whoops missed the link :P
http://udn.epicgames.com/Three/MaterialsCompendium.html
I was watching it on the bus and my friend kept commenting on his hat 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:
http://udn.epicgames.com/Three/MaterialsTutorial.html
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.
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