Home Technical Talk

Creating PBR Glass Material

mobpapst
polycounter lvl 4
Offline / Send Message
mobpapst polycounter lvl 4
hey guys,

i want to create my own glass material to take it later on in a pbr engine like cryengine 3.

i saw that they have a special shader for glass but i really dont know how to make the different textures like albedo/spec/gloss/normal in a pbr way to have a good looking glass in the end. maybe you can tell me or show how to do this

Replies

  • LMP
    Offline / Send Message
    LMP polycounter lvl 13
    It's transparent glass right? Glass is fairly simple, yet also complicated... generally, it's pretty reflective, and it has some refraction. My glass shader in UE4 is pretty simple. It's a fairly dark Base Color that's setup in the shader, a roughness set to 0, opacity a 0.5, and refraction is a LERP between 1 and the index of refraction value controlled by a fresnel.
  • EarthQuake
    Glass is very much not "pretty reflective". Glass tends to be extremely smooth, and thus very glossy, which gives sharp mirror like reflections, however glass lets the vast majority of light pass through it, unlike pure metals which actually are very reflective (most to all light reflects off pure metals). The reason you can see yourself clearly in a mirror is not that glass is reflective, but that the glass is backed by a very smooth sheet of metal.

    Glass reflectivity will vary a bit depending on glass type, but the IOR range of glass is generally about 1.440 - 1.900

    Cryengine uses specular maps afaik, so the spec map/reflectance values would be in the (linear space) range of about 3% to 10% or 0.03/0.1.

    Fresnel for glass should be 1 (100%), which means that at grazing angles, glass approaches 100% reflectivity (most materials do).

    Albedo will depend on the type and color, and level of wear of glass.

    Roughness/glossiness will depend on the type of glass as well. How rough or smooth is the surface of the glass? Answer that question and you'll know how to create this map. Scratches, scrapes, dust, dirt and other marks would typically be added here.

    Normal maps for glass aren't any different than they would be for any other material. If your glass is perfectly flat, your normal map would be perfectly flat. If your glass is bent, has subtle imperfections, is cracked, etc, all of that would be represented in the normal map (and/or with the mesh geometry).

    Transparency/translucency will yet again depend on the type of glass. Museum grade glass reflects extremely little light and is fully transparent. Frosted glass may be fully opaque but will let light through, thus is translucent.

    Refraction will depend on the type and thickness of glass.

    Specular highlights for a glass shader are typically rendered in an additive way. For instance, if your glass is 50% opaque, you wouldn't want the reflections to be 50% opaque as well, so you add the reflections as a pass on top of the shader.
  • mobpapst
    Offline / Send Message
    mobpapst polycounter lvl 4
    Thansk EarthQuake!

    this helps me a lot to understand how to create the glass i want
  • [Ste Pie]
    Offline / Send Message
    [Ste Pie] polycounter lvl 2
    I posted in the thread linked below about setting up a glass shader in Cryengine, hopefully that helps you as well.

    http://www.polycount.com/forum/showthread.php?t=146688
  • oXYnary
    Offline / Send Message
    oXYnary polycounter lvl 18
    Sorry to bump an old thread, but how does metalness work on all this?  I'm being told just to up the metalness for the Spec Highlight.  Is this incorrect?
  • radiancef0rge
    Offline / Send Message
    radiancef0rge ngon master
    oXYnary said:
    Sorry to bump an old thread, but how does metalness work on all this?  I'm being told just to up the metalness for the Spec Highlight.  Is this incorrect?
    That would be physically incorrect. (But its possible for aesthetic reasons you may want to increase its specularity for brighter F0 reflections)
  • EarthQuake
    Metalness of 0 means a reflectivity of 4%, and standard glass has a reflectivity of 4%, so yeah, upping the metalness isn't going to give you more realistic glass. Special types of glass have coatings to be even less reflective, down to about 1%.

    If your glass looks wrong with metalness = 0, you probably need a better shader rather than a tweak to the reflectance, specifically a refraction shader as that is the key component to selling glass.
  • oXYnary
    Offline / Send Message
    oXYnary polycounter lvl 18
    Hey just for clarity.  Does water follow this same principle in PBR as Glass (as in being non Metallic).
  • poopipe
    Offline / Send Message
    poopipe grand marshal polycounter
    Yes,  the specular reflectance is a bit different iirc but in terms of textures the Shader expects they're likely to be similar in most cases
Sign In or Register to comment.