SHADER Photo Quality Road Surface

Discussion in 'Tracks' started by luchian, Dec 17, 2016.

  1. luchian

    luchian Administrator Staff Member

    Joined:
    Jun 3, 2014
    Messages:
    3,007
    Likes Received:
    1,492
    Before anything, all credits for this guide go to @LilSKi , who took the time to share (<<thank you). If you are not familiar with him, his tracks (e.g. Bridgehampton Race Circuit) are one of the best modded tracks out there.

    Back to our guide, this is what we aim to.. ahm no, what we WILL obtain by following the indications below.

    road_sample_1.jpg
    road_sample_2.jpg

    The shader to use (the that Kunos also uses in official tracks) is ksMultilayer_fresnel_nm
    Here are the settings from the SDK Editor.

    shader_settings_1.jpg

    shader_settings_2.jpg

    Let's go through all those textures and how to set them up to produce what you see above.

    1/ the road diffuse.
    This texture should be 1024x4096. You want as long a texture as possible to limit the amount of times it repeats. Shown below is the diffuse with the alpha channel next to it. Basically, the alpha channel here is your specular level. White is 100% and black is 0%. What I simply do is make the alpha channel a copy of the diffuse and adjust the levels how I want them to be. The format of the diffuse should be DXT5 and with about 4 mipmaps.

    tex_diffuse.jpg

    In general you only want to use one single diffuse for your entire road. You may ask "how do I get color variations and such?" The answer is in the detail textures which I will get to that in a later post.

    2/ the mask.
    My mask is fairly small at 128x512. It does not need to be as large as the diffuse. Mine looks like this and is in DXT3 format with 4 mipmaps.

    tex_mask.jpg
    The red is where the main road detail image is shown and the purple is where the main red channel detail is mixed with the blue channel crack texture. You can play with this bad boy all day long and even mix in the green channel if you want with another detail texture. I only used the two channels. You shouldn't need to use the alpha channel with this so it should be 100% black if it is not used with a detail texture.

    3/ txDetailR - the main detail image (in this example).
    It should be 1024x1024 in DXT5 format with 4 mipmaps and it looks like this. The main texture is on the left and the alpha channel is on the right. This alpha channel is also specular so here you want it fairly dark with only some pebbles light to light up by the sun.

    tex_detail.jpg

    3.1/ txDetailG
    If you are not using any of the color channels in the mask you can simply repeat the main detail image just to complete the form in the editor. In my case I don't use green so it gets the main detail again.

    3.2/ txdetailA is also not used in this case, so it can be set to the main detail like the green channel.

    4/ txDetailB - The blue channel
    Used in this example for the cracks texture. It should be 512x512 and DXT3 with 4 mipmaps. Again the alpha channel is specular. You will have to fine tune it so it matches the detail texture it blends with.

    tex_cracks.jpg

    5/ normal map.
    It should be 1024x1024. No alpha is used on this and it can be DXT1 with 4 mip maps. You adjust the normal map resolution with the two numbers in "detailNMMult"

    tex_NM.jpg

    Final note from the author: I hope this helps clear up how to set the textures to make this shader work properly. I would suggest you use my settings to start and then you can play with the numbers to make them work for you.

    ..and a possibly useful note from NightEye: I found that Photoshop exports a full black alpha as full white somehow. Making the alpha #010101 fixes this. It doesn't matter if you use a black detail texture, though. But it's worth mentioning for people who experience weird results inside the Editor.


    ***
    So there it is, asphalt in all its glory. If you get this to look right, it's a huge step in bringing your track to "AC standards".

    ***
    PS: an alternative explanation, you can also find in this post from @Pixelchaser , should that "speak" better to you. Whichever you choose, good luck and let us know your results !
     
  2. QuadCoreMax

    QuadCoreMax Member

    Joined:
    Aug 29, 2015
    Messages:
    34
    Likes Received:
    19
    Thanks Luchian !

    If you want to really know every detail how AC has set up the shaders & materials for the tracks & cars, check out 3DSimEd, which exposes the exact values & maps.

    I'm actually analysing the content...
     
  3. Lucas L

    Lucas L New Member

    Joined:
    Jan 5, 2017
    Messages:
    8
    Likes Received:
    12
    I've got a question about mip maps. Above it says "512x512 and DXT3 with 4 mipmaps"

    In photoshop, I use the Nvidia dds plugin for save dds and I don't see an option to set how many mipmaps are saved. Is there a different plug in or something I should be using?

    Thanks
     
  4. luchian

    luchian Administrator Staff Member

    Joined:
    Jun 3, 2014
    Messages:
    3,007
    Likes Received:
    1,492
    My nvidia plugin keeps crashing so cannot test now, but there should be a combo box where you can set the number of mipmaps (iirc).

    LE: there it is
    dds.jpg
     
    QuadCoreMax likes this.
  5. Lucas L

    Lucas L New Member

    Joined:
    Jan 5, 2017
    Messages:
    8
    Likes Received:
    12
    It looks like "generate MIP maps" doesn't have a numeric value attached to it, unlike "use existing MIP maps", right?
     
  6. luchian

    luchian Administrator Staff Member

    Joined:
    Jun 3, 2014
    Messages:
    3,007
    Likes Received:
    1,492
    The combo box is not only for "use existing". It's for both.
     
  7. Lucas L

    Lucas L New Member

    Joined:
    Jan 5, 2017
    Messages:
    8
    Likes Received:
    12
    Ah okay, thanks!
     
  8. Pixelchaser

    Pixelchaser Well-Known Member

    Joined:
    Jan 4, 2015
    Messages:
    1,541
    Likes Received:
    1,050
    Ac will add all mips btw, no need to save any. keep file sizes down, let engine do it as there is no visual difference I have ever detected. infact I will test that further tbh when I get the chance with colour change over the mips. in3dsimed there is a data entry for mip maps. I just cant remember seeing that in the sdk editor though so its activation I think is by default based upon presence and I just stopped using them. :lol: mainly because I was saving 8K textures for scenery a lot.
     
    Last edited: Jan 6, 2017
  9. QuadCoreMax

    QuadCoreMax Member

    Joined:
    Aug 29, 2015
    Messages:
    34
    Likes Received:
    19
    We might achieve better results, if overlaying more transparent dirt/groove/skids textures on the road.

    In Bridgehampton, the crack textures should be extracted & then manually & randomly distributed on the road to enhance the quality of it.

    Lately, I been thinking about Zbrushing the physical road & then use the displacement map to generate the detailed phys road mesh, but my PC is not following.

    Hmm...

    Inverse could be possible too, using a AC displacement shader to generate the noise for the phys mesh...:)
     
  10. Pixelchaser

    Pixelchaser Well-Known Member

    Joined:
    Jan 4, 2015
    Messages:
    1,541
    Likes Received:
    1,050
    zbrush, I don't think you can paint in these physics details, at least not by eye. its best left to noise modifiers or more simple means of randomising by minute amounts. but you`ll never know until you try it, and surprises are great.
     
  11. LilSKi

    LilSKi Well-Known Member

    Joined:
    Apr 6, 2015
    Messages:
    370
    Likes Received:
    329
    Mips get added automatically BUT it increases load times substantially. I thought the same thing but when Bridge started to take over 25 sec to load I was concerned. When I added mips it went down to 10 sec or less.

    EDIT: Plus there are some nice tricks you can use with custom mip maps to help remove texture repeating over distance.
     
    Last edited: Jan 6, 2017
    QuadCoreMax likes this.
  12. LilSKi

    LilSKi Well-Known Member

    Joined:
    Apr 6, 2015
    Messages:
    370
    Likes Received:
    329
    The idea is to get the best visuals out of the least amount of objects. Sure we can add 1000 different layers and mix and match all kinds of stuff but it won't run very well.
     
  13. Robert B

    Robert B New Member

    Joined:
    Apr 26, 2017
    Messages:
    14
    Likes Received:
    3
    hi guys

    as promised in my introducing post:
    im trying to learn how to do such nice looking road surfaces like these and got some questions.
    i would like to know how to do" the diffuse/mask/detail maps with gimp.
    diffuse map: are these two layers? are they both alpha channels?which one is on top? or is there a layermask? or something else?
    mask: basically the same question. plus: where are the colors coming from? do i have to paint or erase something?maybe on the color channels?
    txdetailR/B:same question as the diffuse one was.

    really basic things im trying to figure out.
     
  14. Pixelchaser

    Pixelchaser Well-Known Member

    Joined:
    Jan 4, 2015
    Messages:
    1,541
    Likes Received:
    1,050
    well.......

    the diffuse is usually your commanding texture, but that depends on what shader you are choosing to use and whether its for scenery or for road surface.

    the most popular shader used for roads as used by kunos themselves is multilayer Fresnel nm shader.

    the mask isn't used directly or visually, the mask is a system where it places the detail textures, its the same size diffuse and it goes along the road with you. they have the same uv layout.

    so where red or green or blue is painted on the mask texture, this places the 3 detail textures you enter in. and its this that blends with the diffuse.

    the diffuse and detail textures are blended together. the mask blends them. so why is this ? well when we look at the world we see detail close up and it diminishes detail the further you get away, but the far away look is comprised of the detail so this shader does exactly that , it blends the two over distance.

    how to design it, in simple terms we get a far away image of a road and use it as the diffuse. and the detail textures are just very close texture of the road surface, tarmac pebbles etc. these texture are very uniform as they are designed to be scaled within the main texture, we could use 1m x 1m photograph of road surface for the detail textures and it would be tiled or repeated at 1m x 1m, having option for 4 of these at the same time produces a realistic road effect.

    alpha channels are normally used for the specular highlights. and they are also blended, the alpha (specular) from the detail channels. and the alpha (specular) from the diffuse.

    suggest you grab 3dsimed and open yourself some of the textures from the game. its the only way to learn by understanding how its done first.

    first post pretty much contains all the info.
     
    Last edited: Apr 26, 2017
    toxiciron likes this.
  15. Robert B

    Robert B New Member

    Joined:
    Apr 26, 2017
    Messages:
    14
    Likes Received:
    3
    I think you misunderstood me.
    The principle how it works I understand, roughly.
    My questions relates to how I can make my own maps in gimp by myself.that I step for step exactly the same as described in the first post can imitate.
    How I have to arrange, for example diffuse and specular, in gimp itself.
    (now with google translator)
     
    Last edited: Apr 26, 2017
  16. Pixelchaser

    Pixelchaser Well-Known Member

    Joined:
    Jan 4, 2015
    Messages:
    1,541
    Likes Received:
    1,050
    ok, well i think its artwork and knowledge of the tools. for myself and after studying kunos textures I have been using photography and my photoshop skills to get some results. take the information from the photographs taken of surfaces from far and close and imitate what is happening in the kunos textures. translate information black and white and make speculars. also translate information and make normal maps with dds file format plugins. I don't work in Gimp and have never used it, but I believe the fundamentals are the same. at least working from a source image certainly is.

    would a video of taking an image from the camera and turning it into a useable object for the game in photoshop be help ? I plan on doing this soon.
     
    Last edited: Apr 26, 2017
  17. Robert B

    Robert B New Member

    Joined:
    Apr 26, 2017
    Messages:
    14
    Likes Received:
    3
    ok.i try to explain it that way (for diffuse map):
    i have a road png in layer 1 (in gimp).thats the diffuse map.i dublicate layer 1 and get layer 2 with the same picture. i Desaturate the colors from layer 2 and get a black,grey and white picture from the road.thats the specular map(from a technical pov).right?
    if it is right (i doubt it ),now i have to make layer 2 as an alpha layer.but how?and whats next?what to do till i can click the export Botton and export all this as a dds file?


    Sure, a video would help a lot. I believe the fundamentals are the same,too.at least i hope so.
     
  18. Pixelchaser

    Pixelchaser Well-Known Member

    Joined:
    Jan 4, 2015
    Messages:
    1,541
    Likes Received:
    1,050
    how you make it technically, yes that's right...

    how these gimp users use an alpha channel and how we track makers use it are different, but here in the channels dialogue it shows you the RGB and A channels just like in photoshop. whilst they use it for transparency purposes, our game shaders simply use it for specular in most circumstances... I don't use gimp, so I cant really tell you how it goes other than its just another layer, and only black and white. and saved without the alpha being viewable or visually parts of the whole image, it just exists in the background and used by the engine, note the eye viewer symbol next to each layer in the channels dialogue, its likely and similar to photoshop to save it without it being viewable etc etc.

     
    Last edited: Apr 26, 2017
  19. Robert B

    Robert B New Member

    Joined:
    Apr 26, 2017
    Messages:
    14
    Likes Received:
    3
    like that?

    or the second one?
     

    Attached Files:

    Last edited: Apr 26, 2017
  20. Pixelchaser

    Pixelchaser Well-Known Member

    Joined:
    Jan 4, 2015
    Messages:
    1,541
    Likes Received:
    1,050
    yeah, sort of. what you have here is the type of thing you use on the alpha channel. this what you have is on the RGB. I know Gimp is awkward when it comes to this, I cant explain it better.

    here is part of a texture from spa track this is the diffuse. on RGB it has the colour info., in the alpha channel is this black and white stuff. maybe you can see this file and understand it, I certainly don't understand Gimp at all. ive ben using photoshop forever.
    http://www.mediafire.com/file/5ibpx1r1dwi4msr/spa_asphalt.rar
     
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice