Home Technical Talk

UDK Vertex Blending limitation question

synergy11
polycounter lvl 6
Offline / Send Message
synergy11 polycounter lvl 6
Hello folks.

How many sets of diffuse/normal maps can you blend on the same mesh using vertex painting in UDK?

Replies

  • passerby
    Offline / Send Message
    passerby polycounter lvl 12
    not sure what the limit is since you can just chain a bunch of lerps up togeahter.

    bit there is a limit of olny 4 colour channels to use with vertex paint.
  • synergy11
    Offline / Send Message
    synergy11 polycounter lvl 6
    So If i wanted to use vertex paint. I could only either use 4 diffuse or 2 diffuse and 2 normal or any combination of 4 texture samples?

    Is this correct?
  • m4dcow
    Offline / Send Message
    m4dcow interpolator
    I think you could probably do 4 different masks, so that would mean a base texture plus 4 "layers" so 5 sets of textures in total.
    Each mask could have a corresponding, diffuse, normal, spec, emmissive etc... but to do all of those with 5 sets of textures you would have to pack channels so you don't run into the texture sample limit.

    I recently did a material with a base texture and 3 "layers" of other textures because it was easier to pack my blending alphas into a single dxt1.
  • synergy11
    Offline / Send Message
    synergy11 polycounter lvl 6
    Thanks for the info!

    Would you be able to vertex paint those different textures with the method you mentioned?

    I know the landscape materials can handle 4 sets of diffuse with normals and spec.

    But what about a basic static mesh?


    By packing channels you mean adding say 3 diffuse textures into each channel R.G.B of your targa?

    I thought those channels only contained the spedific color information? So the Red channel only has red color in it? Atleast that is what it is like in Photoshop.
  • m4dcow
    Offline / Send Message
    m4dcow interpolator
    Well each channel is grayscale, and what I'm packing into those channels is blend maps so the texture doesn't blend simply with the blurry vertex information.

    Then blending is like in this free eat3d vid http://eat3d.com/free/vertex_painting
  • synergy11
    Offline / Send Message
    synergy11 polycounter lvl 6
    Ya that's the video I was going by!

    I got it set up so I can blend two sets of textures with diffuse and normal. Now I want to try to blend more with that same method.

    Is this possible?
  • ZacD
    Online / Send Message
    ZacD ngon master
    Yes, you can blend 5 sets of textures (diffuse, normal, spec, etc) by using the R-G-B and A channels of the vertex coloring, plus the base.
  • m4dcow
    Offline / Send Message
    m4dcow interpolator
    Yeh you just need to LERP them together like you did your 2 first sets of textures.

    So you take the output of the 1st LERP you have and plug that into the A channel of a new LERP, and for the alpha of that LERP you duplicate the blending function, except now you use a different vertex colour, and then you plug in whatever diffuse you want to blend on that channel.

    You need to remember it sort of works like layers though, so the 1st LERP will be the bottom layer, and if you paint a different channel it will be above it and cover up that portion of the blend.

    I would show you my material but it is like spaghetti sine I am blending 4 sets of diffuse, normal and specular.
  • synergy11
    Offline / Send Message
    synergy11 polycounter lvl 6
    Totally awesome!

    Thanks so much for the pointers.
  • Gestalt
    Offline / Send Message
    Gestalt polycounter lvl 11
    You could also look into gradient mapping if you are going to have lots of textures, that way each diffuse texture could be stored as one channel. You could have 3 diffuse textures using one dxt1 texture and a relatively small 256 holding your gradients. You could also store the height map as the blue channel (-1 to 1) of your normal maps and derivenormalz.

    There are only 5 separate functions you can do with vert painting (including black), although I'd imagine you could work with the gradient of your vert colors to do even more if you really wanted to (like 0-.5 would do one thing and .5 to 1 something else). This is probably a bad idea unless each thing along the gradient is related. As far as variation to break up tiling, you can often do a decent amount of that without vert colors by lerping tiling textures with a mixmap alpha.
  • synergy11
    Offline / Send Message
    synergy11 polycounter lvl 6
    Thanks for the info Gestalt

    That sounds way over my head at this point!

    Lol
  • Ace-Angel
    Offline / Send Message
    Ace-Angel polycounter lvl 12
    5 Vertex Channels (Black, Alpha, Red, Green, Blue) with Black being the base.

    Maximum number of textures in a material (DX9) is 15, 12 if you check static mesh as it's only function.

    Maximum number of instructions (DX9) is 512.
  • tharle
    Offline / Send Message
    tharle polycounter lvl 9
    pretty sure you could blend as many textures as you want by using if nodes. ie if red is 0-50 then use texture 1 51-100 use texture 2. you get less range of colour information to blend with but as many textures as you want. realistically there's no reason you couldnt put 100 textures in each colour channel if you were being really exact with your vertex painting. obviously other limits would become relevant but theoretically it would work.
  • Ace-Angel
    Offline / Send Message
    Ace-Angel polycounter lvl 12
    Eh? UDK has a limit call of 15 textures in DX9, you can't override that. Just like Lerp, you can use a If node and Blend between the textures in a certain number/way but it will actually 'add' the texture number towards the limit.

    I would say the biggest challenge in UDK is getting a nice Vertex Blend going on with more then 3 texture groups (3 diffuse, 3 specular, 3 normal, that's already 9 textures) since anything more will quickly kill your budget, especially if you plan on adding Transmission, CubeMap, etc...
  • synergy11
    Offline / Send Message
    synergy11 polycounter lvl 6
    Thanks a lot Ace for that good info.

    I've been finding that 3 vertex sets for painting is more then plenty now that I test it out and plan my base diffuse a bit better.

    Also decals could always be added if needed.
  • tharle
    Offline / Send Message
    tharle polycounter lvl 9
    yeah of course udk has a texture sample limit but in theory there's no limit to the number of textures you could blend. assuming you put specular in the alpha channel of your diffuse and use b/w maps in single channels you could in theory use the vertex colour channels like i mentioned. i didnt say it was a good idea, just that it was possible....
  • Chase
    Offline / Send Message
    Chase polycounter lvl 9
    Watching the Eat3d tutorial, I'm wondering is there much of a benefit to using vertex paint if you have unwrapped objects? If you have an object unwrapped you could just as easily put in the details you want using the UVW template, right? I can see the benefit when the object is a flat plane or just requires one texture. I might be missing something here
  • Justin Meisse
    Offline / Send Message
    Justin Meisse polycounter lvl 18
    Chaserm2 wrote: »
    Watching the Eat3d tutorial, I'm wondering is there much of a benefit to using vertex paint if you have unwrapped objects? If you have an object unwrapped you could just as easily put in the details you want using the UVW template, right? I can see the benefit when the object is a flat plane or just requires one texture. I might be missing something here

    For uniquely unwrapped objects you can create variation - for instance, take a statue that you are lining a temple path with - you could blend in moss and damaged textures to make them all look unique.

    Texture blending is very helpful, the majority of environment art involves tiling textures - you can't uniquely unwrap a whole building.
  • Norman3D
    Offline / Send Message
    Norman3D polycounter lvl 14
    Ace-Angel wrote: »
    Eh? UDK has a limit call of 15 textures in DX9, you can't override that. Just like Lerp, you can use a If node and Blend between the textures in a certain number/way but it will actually 'add' the texture number towards the limit.

    I would say the biggest challenge in UDK is getting a nice Vertex Blend going on with more then 3 texture groups (3 diffuse, 3 specular, 3 normal, that's already 9 textures) since anything more will quickly kill your budget, especially if you plan on adding Transmission, CubeMap, etc...

    what tharle meant was that theoretically there isn't a limit of vertex paint channels. I mean, of course there is, but as he said, you could for example use the red vertex paint channel and split it into two. Instead of having values of 0 - 255 deciding which 2 textures to blend, you could use 0 to 127 in order to blend two textures, and 128 to 255 to blend 2 extra textures ones.
    It's essentially a way of sacrificing "steps" in the mask, for an entirely extra mask.
    I'm also using this technique to "store" multiple 3d shapes in a single object's vertex paint for my 3d vector displacement stuff.
  • Ace-Angel
    Offline / Send Message
    Ace-Angel polycounter lvl 12
    Hmm, I still don't follow.

    I mean I get the idea, but how would that be possible in UDK? I already get issues where a high-clamped masks in UDK, will make my Red Vertex Color Textures, 'run' away from my 'Blue' and 'Green' colors, so I have to use Yellow, which in turn makes the CMYK values run away from each other.

    Mind showing me how you 'clamp' the textures from value to value as you mentioned?
  • Norman3D
    Offline / Send Message
    Norman3D polycounter lvl 14
    Here you go!

    EDIT: just to sum up whats happening here. I'm taking the red channel and splitting it into 4. Values go from 0-63, 64-127, 128-191, 192-255.
    Then I do an "add" and a "multiply" to offset the values and scale them up so that they go up to a full 0-255 range, or to be more precise a 0.0 to 1.0 range.
    This allows you to blend more stuff and you still have 64 "steps", which is more than enough! (probably)

    You can use a similar technique to create a 16-bit texture in UDK with just two 8-bit textures. I explained this also in one of the vector map threads somewhere in the forum.

    udk_split_red.jpg
    udk_split_red_mat.jpg
  • passerby
    Offline / Send Message
    passerby polycounter lvl 12
    Norman3D wrote: »
    Here you go!

    udk_split_red.jpg
    udk_split_red_mat.jpg

    thats pretty cool, i was trying to figure out how to do that a few months agao
  • Ace-Angel
    Offline / Send Message
    Ace-Angel polycounter lvl 12
    Sorry Norman, cannot seem to view the images (my ISP provider is extremely stingy with certain things), mind using a more common site for dirty peasants like me?
  • Norman3D
    Offline / Send Message
    Norman3D polycounter lvl 14
    Ace-Angel wrote: »
    Sorry Normand, cannot seem to view the images (my ISP provider is extremely stingy with certain things), mind using a more common site for dirty peasants like me?

    what the... they are hosted at my site!
    anyway, here are some mirrors:
    http://i.imgur.com/f9ZL4.jpg
    http://i.imgur.com/TLRoo.jpg
  • Ace-Angel
    Offline / Send Message
    Ace-Angel polycounter lvl 12
    ^Yeah, it's not your sites fault, just my current ISP provider end up blocking from week to week certain variables for some odd reason.

    But seriously, you're awesome thanks!
  • Chase
    Offline / Send Message
    Chase polycounter lvl 9
    For uniquely unwrapped objects you can create variation - for instance, take a statue that you are lining a temple path with - you could blend in moss and damaged textures to make them all look unique.

    Texture blending is very helpful, the majority of environment art involves tiling textures - you can't uniquely unwrap a whole building.

    I see what you're getting at. It certainly seems like an useful method :)
  • RSEAArt
    Offline / Send Message
    RSEAArt polycounter lvl 4
    Hey guys, very interesting posts. I was wondering if it's possible to show vertex alpha information in UDK... by that I mean showing a vert as 0% opaque all the way to 100%.
  • MagnificentMicrowave
    You mean, hook up vertex color to opacity and set material as translucent? I don't see any problems with that.
  • RSEAArt
    Offline / Send Message
    RSEAArt polycounter lvl 4
    MM: Thanks :P I'll try that when I get home!
  • Dav118
    Hi Norman,
    Ive also been looking for something exactly like this to paint a mountain terrain! I was just wondering if you could tell me what the nodes are called underneath the Clamp and Multiple? They just have a value for their names 0,1,4
    Cheers

    Dave
  • synergy11
    Offline / Send Message
    synergy11 polycounter lvl 6
    Hi Norman. Can you explain a little bit about your material setup for newer UDK users.
    I've checked out your screen shot and rather then just copy your work, I would like to know a bit about the "why's" of what's going on with your method.

    Thanks to all the contributors of this thread.
Sign In or Register to comment.