Search Unity

A good shader for glass on a car

Discussion in 'Shaders' started by Shadowing, Jul 3, 2018.

  1. Shadowing

    Shadowing

    Joined:
    Jan 29, 2015
    Posts:
    1,648
    Anyone know the best shader for car glass or glass on a plane for example.
    Maybe one in the asset store? I bought one few weeks ago but it still sucks.
     
  2. space928

    space928

    Joined:
    Jun 11, 2015
    Posts:
    21
    Why can't you use the Standard shader it features PBR rendering and realistic transparency and it comes with Unity.
     
  3. Shadowing

    Shadowing

    Joined:
    Jan 29, 2015
    Posts:
    1,648
    I bought a couple cars on the asset store and I looked how they are doing glass. so its all good now.
    Standard shader doesn't seem to be enough.
    I'm using this new shader now that has a Reflect value setting and lets you set the Cupbemap Texture.

    Simply making a window have transparency isn't enough. That's how I was doing it this entire time.

    Unless there is another way using standard shader that I don't understand? I don't know to much about what PbR rendering is.
     
  4. space928

    space928

    Joined:
    Jun 11, 2015
    Posts:
    21
    Cubemap textures allow you to have better reflections, but the Unity Standard shader also has this indirectly in the form of Reflection Probe support which are a far more robust way to achieve performant reflections. Using reflection probes allows for a very similar performance to cubemapped shaders while also providing more accurate reflections as it will choose the most relevant reflection probe in the scene based on where it is rather than a single static cubemap. If yoou are not targeting mobile you can also use screen space reflections, which while performance heavy, provide extremely accurate reflections with minimal effort and can be used in conjunction with reflection probes see the Unity Post Processing Stack for a free and really good screen space reflection image effect.
    Hope this helps,

    - Thomas
     
  5. Shadowing

    Shadowing

    Joined:
    Jan 29, 2015
    Posts:
    1,648
    Hmm idk my glass looks superior now then how it looked with the standard shader.
    It didn't reflect at all.
    I always have the reglecrefl check box set on it.
    Is there a post processing setting that enhances that adjusts the level of reflection?

    Not talking about bthe screen space reflection thing.ill have look at the processing stack to find that. Don't remember off hand seeing that. Using unity 2017
     
  6. Frostbite23

    Frostbite23

    Joined:
    Mar 8, 2013
    Posts:
    458
    Could you send 2 Screenshots comparing the 2 shaders? One being the standard and the other being the shader you got? Perhaps like @space928 said you might have went past the reflection probes, most likely not giving you the desired result. Mess with the metallic and smoothness values or switch to the specular standard shader. Should give you what you are looking for.
     
  7. bgolus

    bgolus

    Joined:
    Dec 7, 2012
    Posts:
    12,352
    When doing PBR reflections it's important to be using an HDR reflection probe, be that an HDR probe texture or a reflection probe that's rendering the world.
     
  8. mariusgeorge

    mariusgeorge

    Joined:
    Jan 29, 2016
    Posts:
    18
    What I can't figure out, is how to do regular real windows. They are basically 100% see-through (or close), but they have highly reflective surfaces. So depending on environment, you should see 100% clearly what's on the other side of the window, unless the other side of the window is quite dark and you have environment or direct light on "this" side of the window, so you see a lot of reflections in it. It's almost like I want to set alpha of the material to 0, but have a specular layer on top of that, that only reflects the environment. Can't figure out how to do that with any of the built-in HDRP shaders or shader options. Any idea?
     
  9. Shadowing

    Shadowing

    Joined:
    Jan 29, 2015
    Posts:
    1,648
    You can do that with a reflection probe
     
  10. bgolus

    bgolus

    Joined:
    Dec 7, 2012
    Posts:
    12,352
    Surface > Transparent
    Blend > Premultiply
     
  11. mariusgeorge

    mariusgeorge

    Joined:
    Jan 29, 2016
    Posts:
    18
    Custom shader? I meant using the HDRP lit with one of its many customization options. I actually managed to somehow get something to work more or less, without exactly understanding why. The HDRP shaders / system is really powerful. The 100% clear glass with high reflection has been a bit of an edge case that I couldn't get figure out what the correct settings are.
     
  12. bgolus

    bgolus

    Joined:
    Dec 7, 2012
    Posts:
    12,352
    Use those settings with either with a custom shader graph, or the default HD Lit shader.