Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Wet pavement or floor

Discussion in 'Shaders' started by fabio1955, Oct 26, 2011.

  1. fabio1955

    fabio1955

    Joined:
    Nov 11, 2009
    Posts:
    72
    I am trying to set a wet pavement material for my car based game.
    It should reflect the car not like a mirror but as asphalt under the rain. I already sent the question to Unity Answers but got few answers. Maybe there is a shader around... Any suggestion from here?
     
  2. dogzerx2

    dogzerx2

    Joined:
    Dec 27, 2009
    Posts:
    3,957
    Hmm.. yeah, you'll need a special shader if you want realism!

    What if you only reflect the lights, though? On rainy days you can really see the car's headlights reflected on the street! Yet cars are not seen reflected unless it's too wet!
    Put a noisy normal map so the lights get distorted slightly.. and also give the specular channel some randomness.. as if the water is displayed in poodles!


    Material above is the default bumped specular..with noise as bump map, and a random specular channel so it looks like it has puddles
     
    Last edited: Oct 26, 2011
  3. larvantholos

    larvantholos

    Joined:
    Oct 29, 2009
    Posts:
    668
    To get the best affect, your going to want to look into what a specular map is, used with a normal map, will get you there. As for shaders, theres a few shader packs on the asset store - chickens can get a look like you want, but doesn't accept a specular map, just uses unity's built in alpha grayscale system, advanced surface shaders does accept a specular input, letting you dial in what you'd be looking for more accurately, you might also want to check out hard surface shaders, as I suspect you could get a very good wet look with those too. I know I recently used it to fake some water :D
     
  4. Chickenlord

    Chickenlord

    Joined:
    May 13, 2011
    Posts:
    381
    Hey,
    if you don't just have a wet street but real wholes filled with water, hard surface shaders is probably the best choice, as it supports Screen Space Reflections which would probably be the perfect solution for this case.
    If the only issue preventing you from buying my package is a separate specularity map, just let my know. I can add that pretty quickly.
    BUT you might not get the look you want out of a simple specular shader, not even a reflective one. (Can't really say anything about Hard Surface Shaders, but i'm just assuming he uses Blinn-Phong, as they run on quite a low number of instructions. If i'm wrong, please correct me). Because as you can even see in the picture dogzerx posted, wet streets behave different than other surfaces when it comes to specularity.
    I could give u the link to the Unreal Engine Samaritan Presentation, but sadly, this is the only topic that they simply don't say anything about (at least not in the three different pdf version i have. Maybe there's a fourth one) :D
     
  5. Vert

    Vert

    Joined:
    Mar 23, 2010
    Posts:
    1,099

    Clip from Burnout 2: Point of Impact. Specular mapped and only headlights are reflected(saves big on resources and as stated above, you really don't see the cars reflection.)

    In this case its important to have the water spray off the wheels and the sound effect for driving on wet pavement. That is what will trick the mind into thinking the road is wet. Also don't forget to make things a little more slippery when traveling with some speed. All of those together will make the pavement believably wet.
     
  6. fabio1955

    fabio1955

    Joined:
    Nov 11, 2009
    Posts:
    72
    Ok, I am near to get what I wanted.
    I am using the standard bumped specular shader with the normal map generated from the asphalt texure.
    Light are with a low y (0.3) and ignore the car. On top of them I added other two lights.
    only a last question @dogzerx: how you get the "random specular channel "? Should I edit the shader?:(
     

    Attached Files:

  7. Photon-Blasting-Service

    Photon-Blasting-Service

    Joined:
    Apr 27, 2009
    Posts:
    423
    Build a very low poly model and use that in the reflections. If you place the pivot correctly, you can just flip the low poly version upside down and render that in the wet parts. You might want to tag certain objects as reflected and only render those tagged to reduce the objects rendered in reflections.

    This can also work for rear-view mirrors.
     
  8. dogzerx2

    dogzerx2

    Joined:
    Dec 27, 2009
    Posts:
    3,957
    To do that you need a 32 bit image for the color map, or should I say image with transparency. The transparency channel is used as the specular channel. (TGA supports 32 bit)

    On the asphalt color map, you should add a new channel. Within photoshop: go to the channel tab (where red green and blue channels are found), and create a 4th channel (as you do when creating a new layer).

    On that newly created channel, put something that looks like puddles on a road, anything random should work (white is maximum specular, and black is no specular).

    Save in a 32 bit format, TGA works perfectly!

    *Same thing is done for materials with reflection, reflection and specular share the same channel! And materials with transparency also rely on the transparency channel to gather the transparency amount.
     
  9. Vert

    Vert

    Joined:
    Mar 23, 2010
    Posts:
    1,099
    looks good, but the road seems too bumpy, at least for the roads I have seen here in the US. I would level off the max bump height to make the road look worn down a bit. That asphalt looks like it needs a steam roller to flatten it out a bit. Also, it seems a bit too grey on my monitor. I would darken the color a bit. But that's based on the roads I have seen and I realize the whole world isn't like the fraction I have seen of it. Other than these minor things it looks fantastic.
     
  10. Stefano_1990

    Stefano_1990

    Joined:
    Oct 10, 2011
    Posts:
    278
    Also a small detail your number plate texture is mapped the wrong way round. The opel sign is too btw.
     
    Last edited: Oct 27, 2011
  11. jasonkaler

    jasonkaler

    Joined:
    Feb 14, 2011
    Posts:
    242
    something about that asphalt isn't working for me.
    it's possibly that the bumps are shiny on one side where as what a road is wet, it's the water that reflects and the water is flat.
     
  12. dogzerx2

    dogzerx2

    Joined:
    Dec 27, 2009
    Posts:
    3,957
    I think the bump is too sharp, makes it look dry instead of wet. Where water is the bump should be smoother! That bump should be ever so subtle, the slightest bump will distort the specular noticeably, only a tad bit is enough!
     
  13. fabio1955

    fabio1955

    Joined:
    Nov 11, 2009
    Posts:
    72
    Nearly done (at least for my level)
     

    Attached Files:

  14. carking1996

    carking1996

    Joined:
    Jun 15, 2010
    Posts:
    2,605
    The puddles ruin the scene IMO. Make them darker and more transparent. ;)
     
  15. Vert

    Vert

    Joined:
    Mar 23, 2010
    Posts:
    1,099
    I agree. The puddles ruin your amazing asphalt.

    Also, the headlights have too strong of a flare effect and illuminate too much under the vehicle. Assuming they are spot lights (which they should probably be for the best effect), they should have their distance and angle adjusted. This will enable a more cone shaped reflection on the pavement. I know you are more concerned about the asphalt, but its just a tip to make the lights look more real.

    Looking at your screen shot makes me want to go play some Burnout 2, my favorite racing game.
     
    Last edited: Oct 27, 2011
  16. dogzerx2

    dogzerx2

    Joined:
    Dec 27, 2009
    Posts:
    3,957
    You've nailed it with that asphalt, I'm really digging it!

    For the mesh puddles, I agree completely with carking1996! darker and reflective!
     
  17. fabio1955

    fabio1955

    Joined:
    Nov 11, 2009
    Posts:
    72
    @dogzerx: it would be nice you could share the material used in your picture with 10 lights...
     
  18. Stefano_1990

    Stefano_1990

    Joined:
    Oct 10, 2011
    Posts:
    278
    Thats what puddles look like! You might not know since you live in sunny italy :p

     
  19. ivanzu

    ivanzu

    Joined:
    Nov 25, 2010
    Posts:
    2,065
    That is how bad road looks like.
     
  20. Stefano_1990

    Stefano_1990

    Joined:
    Oct 10, 2011
    Posts:
    278
    That's what all roads in England look like. I was talking about the puddle not the road haha
     
  21. hippocoder

    hippocoder

    Digital Ape Moderator

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    Puddles should be almost black and sharply show the light, the bump needs to be higher on the asphalt, but same shininess, and there needs to be a glorious shadow under the car. Change the light halos, the crosses just look bad.

    The car is also too lit for the scene, it is almost daytime lighting, so see if you can fix that too.


    GJ so far!
     
    Last edited: Oct 28, 2011
  22. nocoast

    nocoast

    Joined:
    Jul 17, 2013
    Posts:
    3
    Is there a way to achieve this wet pavement effect with emissive materials?

    In the thread example there is a light source at each headlight of the car.
     
  23. fabio1955

    fabio1955

    Joined:
    Nov 11, 2009
    Posts:
    72
    The effect is only reflection. I don't see any realism on adopting an emissive material for the road pavement. If the light is not close enough to the floor (for example a traffic light pole) I use to add another light near the pavement.
    Greetings
     
  24. hippocoder

    hippocoder

    Digital Ape Moderator

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    Moved to shaderlab! Hope you can find a solution to your wet floor problem.