1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

SHADER Photo Quality Road Surface

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

  1. luchian

    luchian Administrator ACM Racing Team ACM Club Driver

    Joined:
    Jun 3, 2014
    Likes Received:
    311
    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
    Likes Received:
    18
    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
    Likes Received:
    7
    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 ACM Racing Team ACM Club Driver

    Joined:
    Jun 3, 2014
    Likes Received:
    311
    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
    Likes Received:
    7
    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 ACM Racing Team ACM Club Driver

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

    Lucas L New Member

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

    Pixelchaser Well-Known Member ACM Club Driver

    Joined:
    Jan 4, 2015
    Likes Received:
    372
    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
    Likes Received:
    18
    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 ACM Club Driver

    Joined:
    Jan 4, 2015
    Likes Received:
    372
    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 Member

    Joined:
    Apr 6, 2015
    Likes Received:
    26
    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 Member

    Joined:
    Apr 6, 2015
    Likes Received:
    26
    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.