Home Unreal Engine

Please help solve mat function problem

Tzur_H
polycounter lvl 9
Offline / Send Message
Tzur_H polycounter lvl 9
Hey guys,

I'm a very newbie programmer, started messing with the material editor yesterday :P
I'm trying to write a material function to blend 2/3/4 textures by vertex color painting, just to make it easy for me when I'll need to use it (and also for the practice of writing these shaders, it's fun!)
I've successfully blended up to 3 textures, thing is, I can't get the UV tiling input to work :[

Here's my function for blending 3 textures, and my shader setup. Could you please take a look and tell me what I've done wrong? :P

Is this error that I'm getting the reason for it? I don't even know why I'm getting it to be honest, it happens when I preview one of the last function outputs.
EE6aaK6.jpg

JT5yNPj.jpg

Now, I've tried to plug a TextCoord node to my texture files in the shader, and then tile it, it will work fine. I just don't understand why it won't work with my function since it has a TextCoord output that is plugged into the inputs of the textures... I'm lost :poly142:

Replies

  • Der Hollander
    Unreal doesn't tend to like it when you try to plug in vector nodes that don't match up, and won't compile the material. I think in this case, you're attempting to make a 2Vector (X,Y) work with a 3Vector (X,Y,Z) but since there's no Z in the previous operator, it doesn't know what to do with it. You need to replace your 3Vectors as your normal input with a TextureSample or TextureSampleParameter in order for your material to compile.

    Now, I wrote that before I realized what you were really shooting for, which is a material function rather than a material itself. What I would do is break up the function into 2, one UV tiling function that will hook into your TextureParameter (Because TextureObjects are the worst thing ever) and then hook the TextureParameters into your VertexBlend Function. You'll have the added benefit of the flexibility of TextureParameters, and it won't make a Function monster that only works for this specific purpose.
  • Tzur_H
    Offline / Send Message
    Tzur_H polycounter lvl 9
    I've separated the UV tiling functionality by using a TextCoord and multiply that by a ScalarParam for each 'material' texture parameters, now I can also control the tiling of each element in the vertex painting :]

    Thanks for your help
Sign In or Register to comment.