Home Unreal Engine

UDK- additive vertex colour blends

polycounter lvl 12
Offline / Send Message
nathdevlin polycounter lvl 12
Hi all,

This may have been asked before but I'm not finding the solution for my problem anywhere so far. I'm fairly new to UDK and working my way through a few projects.

I have a shader setup that uses the R, G, B vertex colours to paint the following details over the base diffuse:

R- Rust
G- Scratches
B- Discolouration

All three work fine independently. My problem is getting multiple vertex colour assignments working together for example painting yellow and resulting in rust + scratches but I get just scratches.

UDK seems to not like adding vertex colours. I've tried using 'ADD' nodes etc. to try and sort it but it does not just add the vertex colours it also adds the diffuse maps.

I'm sure the solution will be simple or it's a fact UDK does not allow this. Hope someone can offer some assistance.

Thanks

Replies

  • passerby
    Options
    Offline / Send Message
    passerby polycounter lvl 12
    have to layer things, you got your 1 blend, that feeds into a lerp for the 3rd blend
  • nathdevlin
    Options
    Offline / Send Message
    nathdevlin polycounter lvl 12
    Heh passerby, If you mean running the Lerp through other Lerps as layering then this I have done. I've tried many combinations but always end up with the same problems. I'll keep working on it :)
  • passerby
    Options
    Offline / Send Message
    passerby polycounter lvl 12
    ya get what you mean, since 1 blend is always in the front of the chain and overrides anything else.

    try playing with the "IF" node, there might be some possibilities there, i just don't know how.
  • Ace-Angel
    Options
    Offline / Send Message
    Ace-Angel polycounter lvl 12
    Mind posting a SS of the Network of the shader and what you're trying to do?

    You can very easily clamp the values of the RGB Vertex Colors so they stop the textures running into each other, and use CMYK value to 'mix' the textures into each other, controlled by you, and use a AO/Cavity/Displacement Map in your Normal Map Alpha slot to create the transitions effect as you see fit.
  • nathdevlin
    Options
    Offline / Send Message
    nathdevlin polycounter lvl 12
    Hi Ace-Angel,

    I'll post up whatever version I have when I get in later. I've been through a few I did see a post regarding the CMY method. My RGB is set up like that just without the CMY controlled lerps.

    My problem is that the vertex colours don't run into each other or mix they just replace each other.

    TBH I presumed UDK would mix the materials into each other automatically this is what I want to happen. If I paint yellow I'd expect to get red and green combined. Using the CMY option to force the mix sounds good. Just need to find that reply on these boards again.
  • tharle
    Options
    Offline / Send Message
    tharle polycounter lvl 9
    this should be relatively straight forward - use the 3 vertex colours to create 3 masks then run the base texture and the rust into a lerp with the first mask, the result of that lerp into another lerp with the second mask and the result of that into a third lerp with the third mask.
  • Ace-Angel
    Options
    Offline / Send Message
    Ace-Angel polycounter lvl 12
    Strange, Yellow and Red for example should do that automatically, are you using Material functions by any chance?
  • nathdevlin
    Options
    Offline / Send Message
    nathdevlin polycounter lvl 12
    Hi Ace,

    Here are the materials setups I have been working through.

    http://www.antodonnell.com/udk_materials_wip.jpg

    udk_materials_wip.jpg


    Attempt 3 now allows me to blend red and green as expected. Blue still "erases" red and green when I paint.

    For attempts 1 and 2 I think it was the fact I was using LERPS to create my texture before adding that to another LERP that may have confused UDK. Also each LERP had the base diffuse and the additional details. In attempt 3 the base only appeared once then everything else was adding by layering up 3 LERPS.

    In attempt 3 I have reduced the number of LERPS and also used masks in conjunction with the vertex colours to get the same results as 1 and 2.

    I'm a few steps closer and can continue my project with this level of functionality. Once the RED and GREENS mix I'm happy. I'll figure out why the BLUE does not someday.
  • Ace-Angel
    Options
    Offline / Send Message
    Ace-Angel polycounter lvl 12
    It seems like you're doing everything right, odd that you're having issues.

    Can you try just putting a different texture in each lerp? Don't use masks or anything, just connect 4 different textures in the Lerps and just use the Vertex Color as they are in the Alpha's.

    Also, before connecting the Vertex Color node, Constant clamp it.
  • nathdevlin
    Options
    Offline / Send Message
    nathdevlin polycounter lvl 12
    Heh,

    I think my first attempt created an issue where the original masks and the base being assigned to the "A" slot of every LERP caused each colour to revert to the base when painted over.

    My recent attempt now allows me to paint yellow and get the red and green blends together. I'll try the clamp on the blue later. There's already a clamp on the Red and Green LERPS. I think it may be that UDK does not like many LERPS together.

    I'm new to UDK but familiar with other engines. I just need to rewire my brain to work the UDK way.

    What UDK could do with is a LERP node that allows triple blends and instead of an ALPHA slot to blend between them an A,B,C slot would be great, one for each map.

    Could look like this:

    Base texture

    Texture 1
    Texture 2
    Texture 3
    A = RED ( paints texture 1)
    B = GREEN ( paints texture 2 )
    C = BLUE ( paints texture 3 )
  • nathdevlin
    Options
    Offline / Send Message
    nathdevlin polycounter lvl 12
    Got this sorted in the end. A wise co worker had the same issue. On attempt 3 I had to run the first two lerps through the mulitply and then into Lerp 3.
Sign In or Register to comment.