The Snow and Ice of Uncharted2?

2

Replies

  • shadows
    Yea in those shots it is still using the same mask texture I posted earlier.
    Ill test it with a heightmap instead and see how that looks like.
  • shadows
    Holy hell, yea with a height map it looks a ton better. Cheers.
    And it allows for much more variations in the final look, then using a pure black and white mask.

    vertexBlending_test3_ue3.jpg

    I just to need to figure out how to get a normal map out of this so that the top textures get some normal info around the edges. If that's possible..
  • MoP
    Offline / Send Message
    MoP polycounter lvl 14
    Cool stuff Shadows, this was exactly the kind of stuff I knew this type of thing would be good for :)

    Here's a video of my .fx shader in action, I sorted out the vertexcolour trashing tonight, I still need to double-check my maths on the mask method because it's not quite what I think it should be.

    http://www.greveson.co.uk/dump/blend_mask_2.avi (1.6mb, XVid codec)

    Video shows initially starting off with black vertex colour, then painting white where I want the snow. I then change the "global falloff" value from 0.01 in steps up to 1.0 (the shader has a checkbox for using vertex alpha or not), and after that I change it to use the vertex alpha as the falloff (defaults to 1.0, very soft blend), and I paint it down to black in places for a really sharp blend.

    Edit: OK, for people wanting to mess around with the shader, here's a beta version. I can't guarantee the maths for the blending is right, but it works visually for the most part.
    Hell, I don't even think the maths for the lighting is correct. Try it on a sphere, it looks broken to me :D

    Definitely not perfect yet, but fun to mess around with. I'd be very interested to see screenshots of what people try with it.


    Max 2008 .fx shader BETA download:
    http://www.greveson.co.uk/shaders/MoP_TextureBlender.fx



    Disclaimer: .fx file only tested as a DirectX Shader on 3dsmax 2008, I have no idea about compatibility with other Max versions. I don't think it will run on other software. I take no responsibility for anything bad that should happen from using this shader (although I can't imagine what it could possibly do!).
  • Joao Sapiro
    Offline / Send Message
    Joao Sapiro polycounter
    this is all kinds of awesome guys, thanks for sharing this ! Mop , that kicks ass man.
  • shadows
    Awesome mop, the shader seems to be looking fine for me in max.
    The blending is a tiny bit different than the results I am getting inside UE with the same mesh, I think it;s handling the vertex color info differently. But really cool to see the results right away.
  • hijak
    To get a normal map that will add an edge to the transition, you can do a few things. What i ended up doing was making a network that converts your mask texture into a normal map then blends the other normal maps on top of it. only issue with that is creating the map as a shader function, by offsetting each channel in a diff direction, can be sort of intensive if the source has a high res. But what also worked was after finalizing the mask, just creating a normal map from that using a filter, or CB or whatever, then mixing it the same way. Also forgot to mention using masks like this also works great when using multiple uv sets.
  • shadows
    Yea I think offsetting each channel might be to expensive in the shader instructions. So probably going to use an extra texture map. Just wish epic could add support for bump maps instead. I could just use one of the channel from another texture instead and save a texture call. Unless it's already supported and I am just blind?! :S
  • CrazyButcher
    Offline / Send Message
    CrazyButcher polycounter lvl 15
    shading is based on normals, old school "bumpmaps" were simply converted to normal maps, or used "directly" in "emboss bump mapping", which was a different type of shading hack (not suitable for a unified shading pipeline)
  • Peris
    Offline / Send Message
    Peris polycounter lvl 13
    Apparently you can vertexpaint on meshes straight in unrealeditor now: http://udn.epicgames.com/Three/MeshPaintReference.html

    Using this + this blend shader = awesomeness!
  • Ben Apuna
    I just wanted to pop in here to say thanks to everyone for sharing all the great blending techniques :) I had been trying to figure out this same problem for some time now. It had never dawned on me to use a height map as part of the blend equation with vertex colors, pure genius thanks again.
  • shadows
    shading is based on normals, old school "bumpmaps" were simply converted to normal maps, or used "directly" in "emboss bump mapping", which was a different type of shading hack (not suitable for a unified shading pipeline)

    Ok thank you for the clarification.
    Apparently you can vertexpaint on meshes straight in unrealeditor now: http://udn.epicgames.com/Three/MeshPaintReference.html

    Using this + this blend shader = awesomeness!

    Indeed, although it seems not to be as responsive as doing it in max. But final touch ups, it's going to be great tool to have.
  • gamedev
    Offline / Send Message
    gamedev polycounter lvl 12
    Indeed, although it seems not to be as responsive as doing it in max. But final touch ups, it's going to be great tool to have.
    Hmm, I have not experienced any sluggishness with it. It's pretty cool though that you can now store unique vertex color for the same meshes. So using the same wall over and over w/ unique material blending via vertex color rocks!
  • shadows
    gamedev wrote: »
    Hmm, I have not experienced any sluggishness with it. It's pretty cool though that you can now store unique vertex color for the same meshes. So using the same wall over and over w/ unique material blending via vertex color rocks!

    I just tried it again and it's working fine, not sure why because I used the default settings both times. Unless I clicked on something and did not notice it, so never mind on my previous comment.
  • warby
    Offline / Send Message
    warby polycounter lvl 13
    ok i have to add my 2 cents to this epic thread:

    first of this is not something new in uncharted 2 the first uncharted was already using these kind of shaders on .... well .... practically everything.
    i was thrilled by it back than (still am) and tired to recreate that sort of shader in ut3 with little success i called up hourances to help me out with this task ( since he is my ue3 guru ^^ ) and he got a proof of concept implementation working and he described it in his tutorial after ward:

    http://www.hourences.com/book/tutorialsue3mated3.htm

    i intended to use that shader all over my diablo map but it never looked quit as good as it did in uncharted so i dropped it:

    now uncharted 2 is out and OMFG does it look awesome so i said to myself this time ill do it for real and find out how they do it ... how foolish of me to think that i am the only person that noticed the pure awesomeness of this technique. and sure enough you guys already have it up and running :D:D:D but i think you guys are on the wrong path if you want to auto generate the snowy areas i am sure the guys at naughty dog are such control freaks that they hand color each vertex also i think they blend more than 2 textures i wouldn't be surprised if they had up to 5 materials in these shaders to blend between that way you could make really large batchable/drawcall-conservative objects. basically 1 base material and than use the R G B and A channel to push the opacity of another layer over it .

    @ mop if this is an *.FX shader shouldnt it also work in maya ?
  • MoP
    Offline / Send Message
    MoP polycounter lvl 14
    warby, not sure, i think the UI semantics are different. Feel free to give it a try though :)

    And yeah, for the Uncharted 2 snow and ice, I totally agree, they're using way more than just this. Although I am fairly convinced that for the snow blending into the stone they only use 2 maps - a setup like I did here (stone as base, stone as heightmap with snow as upper texture) and just vertexcolour (of course by hand, not sure how else you'd do it!) for the large-scale blending.

    Then maybe a different stone texture and mask image for the vertical walls.

    And on top of that, modelled snow with a single snow texture tiling on it, and for the edges they've done ice and icicles hanging off things with a custom shader there too.
  • Jesse Moody
    Offline / Send Message
    Jesse Moody polycounter lvl 13
    Very cool thread.

    Yeah there are several ways this effect could be achieved in unreal. Either hand done or procedurally.

    A few examples would be just with textures and masks and the lerp function or you can do a formula function that will actually detect where the snow should or should fall, or you could hand paint it with the vertex mesh paint tools mentioned earlier. Which uses lerp in the material set up anyways just stores it via vertex i believe. I haven't messed with that stuff yet.
  • Minos
    Offline / Send Message
    Minos polycounter lvl 12
    Bump!

    Found another tackle on this subject. Looks pretty awesome and simple to do:
    http://www.chrisalbeluhn.com/UDK_Advanced_Vertex_Painting.html
  • G3L
    Offline / Send Message
    G3L polycounter lvl 9
    wow this stuff is amazing! great RnD in here, i'm definitely going to try what Minotaru0 posted up though because thus far, that's looking pretty amazing! I need to mess with shaders more to get this kind of detail and unique-ness going.
  • GoSsS
    Offline / Send Message
    GoSsS polycounter lvl 12
    Thanks a lot Minotaur0.
    I didn't achieve to do that in Unreal but now it seems it'll be easy to do with this tutorial ;)
  • Snipergen
    This thread made me take a break from AC2, controller is on my lap.

    But what I'd like to see is mop his node setup for shader FX, since we're learning this at school, and I think this technique is awesomeness, I'd like to take a look at it.
  • rasmus
    Very sweet texture blending, MoP - thanks for sharing! Very nice to see a blending that is halfways between "test" and "blend", and controllable!
  • Xoliul
    Offline / Send Message
    Xoliul polycounter lvl 10
    I made MoP's material in Unreal, also remade my world-space directional snow blend (mat on the tank tracks):

    2menxw1.jpg
    The blending isn't perfect yet, but it meets all technical requirements.
  • JordanW
    Offline / Send Message
    JordanW sublime tool
    Awesome thread, I like your material mop, it looks like the "hardness" of the fade is a constant value, you could make one of the vertex colors be the hardness so that could be painted as well which would be really sick (If it's already like this I'm sorry!:) )
  • Xoliul
    Offline / Send Message
    Xoliul polycounter lvl 10
    Yeah it is in his video, I replicated it as well. In my Unreal material it's the green channel, Red controls snow or no snow.
  • MoP
    Offline / Send Message
    MoP polycounter lvl 14
    Yeah I put the "hardness" control (I call it the ramp or falloff) into the vertex alpha just because it's easier to paint in 3dsmax since per-channel painting seems a bit tricky. Or maybe I just don't know Max's vertex colour tools very well :)

    I also have an "override" checkbox so you can use a constant if you can't be bothered setting up any vertex alpha for that control.
  • Rhinokey
    Offline / Send Message
    Rhinokey polycounter lvl 11
    someone figure out how to make snow like that work in terrain textures!
  • MoP
    Offline / Send Message
    MoP polycounter lvl 14
    Rhinokey, we already did, but it requires megatexture :)

    (my shader was basically an attempt to recreate in real-time, the method of blending that we used for the megatextures in ETQW, the only difference is mine is controlled with vertex colour instead of a very large image)
  • Bal
    Offline / Send Message
    Bal polycounter lvl 12
    What is stopping people from using a shader like this for terrain? Isn't that what is already being done in Uncharted and even some of Valve's stuff?
  • Xoliul
    Offline / Send Message
    Xoliul polycounter lvl 10
    Unreal's terrain works differently and not by vertexcolor I think. That's what Rhinokey is asking.
  • MoP
    Offline / Send Message
    MoP polycounter lvl 14
    Also, to do good terrain, you really need to be blending at least 4+ different tiling textures in layers using this method, which is rapidly going to become prohibitively expensive for a single shader in this fashion.

    Two textures blending together is nice for many uses (like plaster/brick on walls or snow/stones as demonstrated in Uncharted) and for smaller areas of terrain (eg. grass blending with cobblestones or something for an old street scene) but to do a full-on terrain with rock, stones, mud, grass, sand and whatever other material types you need on there, you're never going to get that out of one shader if you're using normals/spec/gloss/diffuse like this one does. Far too complex.
    Plus you'd run out of vertex colour channels to blend with (4 if you're doing RGBA on one channel), you'd either have to allow more VCol channels (which I dunno if many engines support) or start using large unique greyscale images as masks.
  • Xoliul
    Offline / Send Message
    Xoliul polycounter lvl 10
    But isn't that what Unreal's standard terrain material system does? I always understood it just sort of stacked together every material you use on the terrain, into one big-ass material. Hence why the terrain goes super-funky colors if you use too many different materials.
    And my two-way blend material came out at 60 instructions, I guess making it 4 way would end up somewhere around 100-120, which is still semi acceptable? Not sure how that compares to the Unreal terrain material, since you never get to see the instruction count.

    Edit; my node setup, posted for Snipergen, sharing it for anyone:
    http://www.laurenscorijn.com/vertex-blending-snow.html
  • JasonLavoie
    Offline / Send Message
    JasonLavoie polycounter lvl 12
    Maaannn... absolutely love this thread, sooo much information.

    You guys simply rock... so talented.
  • Ryan Smith
    Offline / Send Message
    Ryan Smith polycounter lvl 11
    I have been working on vertex blending for a while now, and this thread has helped me alot.

    I have taken the techniques discussed and added a bit more functionality to the shader that MoP was working on. I was thinking to myself, why not use the other 3 channels of the vertex color constant as inputs for other functionality for the shader? I got the idea after reading that MoP was using another channel to control the falloff of the vertex blend transition mask.


    So here's what i did.

    First i subtracted the red channel of the vertex color node by the height map, then divided it by the alpha channel of the vertex color node. Then i clamped that input to a value between .01 and 1. That's it. That little set of instructions is all you'll need for your linear interpretation. That little bit of math came from MoP. So credit goes there

    After that i used the blue channel of the vertex color and multiplied it by 10 on the Blue channela constant 3 vector, Then i plugged that node into the World Position Offset input at the bottom of the material's master node


    here's a demo

    [ame]
  • MoP
    Offline / Send Message
    MoP polycounter lvl 14
    Great video Virtuosic, looks like it's working very well :)
  • divi
    Offline / Send Message
    divi polycounter lvl 9
    very wicked indeed.
  • Xoliul
    Offline / Send Message
    Xoliul polycounter lvl 10
    Especially the height thing is cool, I didn't know you could do that with materials yet. Makes you wish UE3's terrain system was like this.
  • rebb
    Offline / Send Message
    rebb polycounter lvl 12
    Good idea with the WorldpositionOffset, too bad its only a "visual" offset and the collision of the mesh does not actually change, afaik.
    But that should work fine with small offsets for things like snow or sand where the player can supposedly "sink in" a little anyway.
  • Rhinokey
    Offline / Send Message
    Rhinokey polycounter lvl 11
    since you can do like virtuo, whats the advantage in terrain over this? since terrain seems to be limited to materials and things you can do with them? i guess in super huge areas this may take a lot of time to paint up. but other than that, what technical advantage?
  • rebb
    Offline / Send Message
    rebb polycounter lvl 12
    Not sure who you mean with "since you can do like virtuo", but the advantage of terrain in the case of painting height-offsets inside the editor is that it offsets the actual geometry used for collision and rendering, while the WorldPosition magick offsets only what's being rendered.

    The downside of terrain is that so far nobody seems to have found a way to make this improved blending algo work with it's Material-Layers.

    It's not a real issue if you model out the large forms in a 3D Package of course, and use WorldPositionOffset for smaller adjustments.
  • Xoliul
    Offline / Send Message
    Xoliul polycounter lvl 10
    Yeah but making your terrain model in an external package isn't really efficient. You'll have to go back and forth for every tweak, there's no dynamic tesselation and culling, and worst of all: there are no split lightmaps...
  • Ryan Smith
    Offline / Send Message
    Ryan Smith polycounter lvl 11
    I'd say that the best application for this would be on pretty flat floors that you just want to muck up with some variation. Something like a road or what i showed in the video. Using this method for a full out terrain setup would obviously be a disaster, unless you modeled it in a 3rd party application. but like xoliul said, it's not the fastest way to do things.

    I wouldn't use the phrase "It isn't really efficient". If you mean it's not "TIME efficient" i'd accept that. But in terms of being memory efficient, it's leagues cheaper to use that method then a terrain actor.
  • Ben Apuna
    I remember reading somewhere that Unreal's terrain has a more efficient/friendly collision method applied to it compared to what you would need to use for a gigantic static mesh collision. Here's where I read it, and here. So using this material technique for a gigantic static mesh terrain in a actual playable level might not be such a good idea.
  • Rhinokey
    Offline / Send Message
    Rhinokey polycounter lvl 11
    virt any chance of getting a break down on how to replicate that shader.. or better yet.. a upk of it?
  • Ryan Smith
    Offline / Send Message
    Ryan Smith polycounter lvl 11
    Ya i'm going to be doing a tutorial on how i put it together. I'll go over the math so people understand. It's actually super easy.
  • warby
    Offline / Send Message
    warby polycounter lvl 13
    dude that is totally fucking rad

    cant wait for the upk ! :)))))))
  • Rhinokey
    Offline / Send Message
    Rhinokey polycounter lvl 11
    i know!! i have actualy tried to do the shader in this image on the ground http://www.pandangerous.com/art_dump/prototype_11.jpg but i just dont know enuff to get it all set up proper,
  • r4ptur3
    Offline / Send Message
    r4ptur3 polycounter lvl 10
    this thread is phenomenal. big thumbs up!
  • Snipergen
    Virtuosic wrote: »
    Ya i'm going to be doing a tutorial on how i put it together. I'll go over the math so people understand. It's actually super easy.

    Would be fantastic.

    *stares at the page and hits F5*
  • G3L
    Offline / Send Message
    G3L polycounter lvl 9
    Thought this post from Behrooz Roozbeh from Naughty Dog would help shed some light on this...it's pretty much what everyone has said up to this point about vertex blending. This comes from the Unhcarted 2 Art Thread on Zbrush Central, check it out here

    http://www.zbrushcentral.com/showthread.php?t=79141&page=7&pp=15

    There is a game shader technique called vertex blending that does wonders for tile-able textures..
    The blend Shader uses two sets of textures plus an additional blend map to reveal another set of textures
    Lets say top texture set is the undamaged version(diffuse, normal, specular,...etc maps)
    and second set is the destroyed version of the tezture set, so using a blend map and painting the vertex (assume red channel of vertex is used for the blending) then depending on vertex value of red channel will reveal the second set of textures.
  • MoP
    Offline / Send Message
    MoP polycounter lvl 14
    Ah, yeah, so it seems the technique they used is exactly what we've come up with here anyway... good to know :)
2
Sign In or Register to comment.