Home Technical Talk

Snow and sand on roads when needed (For games)

polycounter lvl 6
Offline / Send Message
D4N005H polycounter lvl 6
Hello, again.
I am making a game, the game has roads and the roads should look sand-free after in-game rains, And also should look for example snowy when the in-game weather is snowy. So I think there should be two textures, one clean asphalt and one with sand. Also there should be some snow or water particles for those weather conditions.

The problem is that I am making the roads in 3DsMax and I can't continue my job if I don't get how that transition between those two textures would be. So would you tell me how should this be done?

Note: The game engine is Unity3D

Replies

  • Eric Chadwick
    Options
    Offline / Send Message
    I would use a blend shader for this. It can be as simple as animating the blend % between totally-covered-with-sand and not-covered-at-all.

    This video by Tor Frick shows it nicely.
    Vertex Painting in UDK - Eat 3D

    You can do similar work in Unity, you just need a custom shader. If you're not comfortable with writing a shader, you can use an editor like Shader Forge. If that's too hard to figure out, search the Asset Store for existing shaders.
  • D4N005H
    Options
    Offline / Send Message
    D4N005H polycounter lvl 6
    Okay thanks Mr.Chadwick, Should I do anything special in 3DsMAX? I am currently creating the 3D models of the roads and applying them a texture of clean asphalt in 3DsMax.
  • Eric Chadwick
    Options
    Offline / Send Message
    I just did a little searching around in the Asset Store, for "blend shader", and found this nice shader set:

    Winter Shaders - Asset Store

    It has a slider at the bottom of the pic for Spread, animating this would give you your sand/snow growth effect.

    I think it uses vertex color to control where the snow goes? You could ask on their forum thread.
    http://forum.unity3d.com/threads/released-winter-shaders.222766/

    ljmrygz-jpg.90064
  • Eric Chadwick
    Options
    Offline / Send Message
    D4N005H wrote: »
    Okay thanks Mr.Chadwick, Should I do anything special in 3DsMAX? I am currently creating the 3D models of the roads and applying them a texture of clean asphalt in 3DsMax.

    This will depend on what shader you choose. Some shaders use vertex color to control where the sand/snow appears. You could paint that in 3ds Max, or you could use a tool to paint it in Unity (this is often a better idea).

    You still need to make UVs for the roads. Can't do that in Unity.
  • D4N005H
    Options
    Offline / Send Message
    D4N005H polycounter lvl 6
    Okay thanks. I will continue creating UVs and using a simple clean asphalt texture for the roads in 3DsMax and then when I finished creating roads, I will have a research for "blender shader" tools in Unity3D. This summer I only create and apply UVs and textures for the roads in 3DsMax.
  • troublemaker
    Options
    Offline / Send Message
    troublemaker polycounter lvl 7
    Hi,

    I did a quick prototype of snow shader a while ago.

    It doesn't have many of winter shader features but basic idea is there and here is shader code if you like to enhance it.

    It should work in Unity3D.
  • D4N005H
    Options
    Offline / Send Message
    D4N005H polycounter lvl 6
    Thanks I will get into Shaders and modifying them when possible (After creating all the +1000 roads in 3DsMax)

    I have a related question,too. Look at this awesome realistic road of GTA V:
    There are fractures, shiny surfaces and also matte surfaces. I searched the net for how to add those particles to road for Unity3D and I came up with nothing useful, Would you tell me how to add those for game (In 3DsMax) ?

    EastJoshuaRoad-GTAV.jpg

    bdd424cbc92c181d.jpg

    14b71211343216a4.jpg



    Also if you look at the roads, you will see that the white lines are not included in the texture of the road but it looks like a layer that is exist on top of the road, How would I do this in 3DsMax?
    5b8zfc.jpg

    jq2t6o.jpg

    The photos in this post, are not by me.
  • Eric Chadwick
    Options
    Offline / Send Message
    This is likely to be done with a multi-layer shader. The tiling textures are: road lines, cracks, asphalt, sand. They are probably blended together using one vertex color (red, green, blue, or alpha).

    They are also probably doing something fancy with their textures, to avoid having to add an alpha channel, which would increase the file size (and memory cost) of each texture... You could make the road lines as white lines on a black background, and stick this in the red channel. Then in the green channel you could only put the yellow lines, as white on black, and the shader uses this as a mask for the yellow color (or whatever color the artist sets it to be in the material). In the blue channel you could put a specular mask, or a bump map, or whatever else you need.

    All this work is done in Photoshop (tiling the textures, arranging the channels), a text editor (to make the shaders), and in your game editor (to adjust the materials, add the textures, and paint the vertex blends). The only thing you would do in 3ds Max is to create the road model and its UVs (though often a game editor will have its own road tool, to save the artists' time).
  • Eric Chadwick
    Options
    Offline / Send Message
    A good tutorial on this workflow:
    The Desert(What can you do with no diffuse maps?)

    More tutorials and guides on the MultiTexture wiki page, also check out the Texture Atlas page.
  • Eric Chadwick
    Options
    Offline / Send Message
    If you are making +1000 models in 3ds Max, you should make a small test scene first, with one road. Get that into the game, and get your scene all set up the way you like, with finished art.

    You will learn a lot, and this will help you figure out the best workflow for creating your models.

    If you create all your +1000 assets ahead of time, without finalizing the workflow, you will have a lot of re-work to do later, to fix various things which you could not have foreseen.
  • D4N005H
    Options
    Offline / Send Message
    D4N005H polycounter lvl 6
    Thanks Mr.Chadwick, I've read your replies carefully. I will create a scene (only a textured road) and then I will import it into Unity3D, then I apply a Shader and see the result. However I should learn how to work with Unity3D shaders, this might take lot of time.
  • D4N005H
    Options
    Offline / Send Message
    D4N005H polycounter lvl 6
    Hello again. I tried to learn how to use simple shaders in Unity3D v5 and now I've tested the roads and I see no errors. I believe that means I should continue creating the rest of them in 3DsMax.
    PLEASE NOTE: I tried vertex coloring technology and it was a bit hard for me (as I have learned a bit about the shaders of Unity3D very recently) So instead of vertex coloring, I used specular map to make those fractures shiny. (In this case, it a text that says "Thanks Mr.Eric for helping me" - look at the image below)
    2460uu9.jpg
    Here is a better version!:
    el5jte.jpg

    another picture:

    1z32c10.jpg

    So I actually want to replicate the GTA V style roads in this way:

    29qks5t.jpg

    2v2jcyr.jpg

    What do you think about this method?
  • D4N005H
    Options
    Offline / Send Message
    D4N005H polycounter lvl 6
    One more thing, I've found a cool and easy to use way to blend textures in Unity3D, I thought it's good to share with you guys:
    [ame]https://www.youtube.com/watch?v=u9lLBqObZF0[/ame]

    I believe it's enough for me to stop working in Unity3D right now, and continue working in 3DSMax , and then returning to Unity3D later.
  • troublemaker
    Options
    Offline / Send Message
    troublemaker polycounter lvl 7
    Good stuff.

    Just a note about references from GTA V.
    They must be (like other massive open world games) using a rendering technique called "Virtual Texturing".

    This technique (implemented by rendering programmers) allows artists to stamp massive amount of layers/decals on a terrain. Normally its done in the game editor with dedicated terrain editing tools.

    e.g. The road would be a layer on the terrain and all fractures, sand, mud etc... would be on top of it.
    Think of it like a massive texture (i.e. MegaTexture from iD software) being composited at run time will all the decals.

    If you want to get a feel of it from Artist workflow wise, I suggest to download free version of CryEngine and make or modify a road spline in the demo project.
  • Eric Chadwick
    Options
    Offline / Send Message
    I really don't think they're using virtual texturing. They're pretty close-lipped about their actual art tech. But it looks to me like layered shaders.
  • D4N005H
    Options
    Offline / Send Message
    D4N005H polycounter lvl 6
    Good stuff.

    Just a note about references from GTA V.
    They must be (like other massive open world games) using a rendering technique called "Virtual Texturing".

    This technique (implemented by rendering programmers) allows artists to stamp massive amount of layers/decals on a terrain. Normally its done in the game editor with dedicated terrain editing tools.

    e.g. The road would be a layer on the terrain and all fractures, sand, mud etc... would be on top of it.
    Think of it like a massive texture (i.e. MegaTexture from iD software) being composited at run time will all the decals.

    If you want to get a feel of it from Artist workflow wise, I suggest to download free version of CryEngine and make or modify a road spline in the demo project.

    Yes I've read about it in the wiki page of Polycount.com but thanks for your info,though. Unfortunately, that would take too much time and effort (I guess) so I might not work on it (at least for the project that I am working on),
  • troublemaker
    Options
    Offline / Send Message
    troublemaker polycounter lvl 7
    Off course. Anyway you'll need programming support or some asset store plugins to be able to do that.
    So its best to just know about why GTA V looks the way it looks and rather focus on artistic tools. Like Eric mentioned - Multitexturing.
  • D4N005H
    Options
    Offline / Send Message
    D4N005H polycounter lvl 6
    Yep, thanks for the advice.

    So I continued learning the vertex color method in the way that the video below says:
    [ame]https://www.youtube.com/watch?v=inbx6y3bdlM[/ame]

    But I got a problem, the problem is the reflection. When I applied a material (that was created by Shader Forge 1.3 plug in - because in the video it is mentioned to use the plug in) I saw that the reflections is not realistic as the standard material of Unity3D is. I even can't change the strength of the specular and normal maps (Or I don't know how to do so) in the plug in. Do you have any idea to overcome those problems?
    (Notice the bluish reflection on the right road in the image below You can compare the left road with the previously shared image of it in my last post)
    fdws9s.jpg
  • D4N005H
    Options
    Offline / Send Message
    D4N005H polycounter lvl 6
    If Shader Forge is not powerful enough, is there any other material editor that is better than it? or at least a material editor to setup the R,G and B alphas so that I can blend textures with it without loosing the realistic reflection feature.
  • D4N005H
    Options
    Offline / Send Message
    D4N005H polycounter lvl 6
    I asked the question HERE, I believe the creator of the Shader Forge might help.
  • D4N005H
    Options
    Offline / Send Message
    D4N005H polycounter lvl 6
    I solved the problem, Shader Forge is powerful enough and I replicated the standard shader (Specular setup) of Unity3D with ShaderForge v1.3 so I can now use Vertex color blend technique with the quality of Unity3D's standard shader with the help of Shader Forge now.
    Here's the full story of how I solved the problem:
    http://forum.unity3d.com/threads/shader-forge-a-visual-node-based-shader-editor.222049/page-75#post-2114108

    Regards.
Sign In or Register to comment.