Sub topic 12
Glass with Transmission
Glass is a dielectric surface: it does not conduct electricity like metal, and it reflects and transmits light. In Blender, the Principled BSDF creates glass mainly through the Transmission Weight, IOR, Roughness, and Base Color inputs.
This chapter assumes that you can create a material, assign it to an object, and work in the Shader Editor.
How Transmission works
Transmission controls how much light passes through the surface. A value of 0 creates an opaque surface. A value of 1 allows the surface to transmit light.
IOR, or index of refraction, controls how strongly light bends when it enters and leaves the material. Clear glass commonly uses an IOR near 1.45. Water is near 1.33, while diamond is near 2.42.
Roughness controls the sharpness of reflections and transmitted light:
0.0creates clear, sharp glass.- A small value creates frosted or dusty glass.
- A high value creates a cloudy, diffuse surface.
For clear glass, use a white Base Color, zero Roughness, IOR 1.45, and Transmission Weight 1.0.
import bpy
# Use the active mesh object.
obj = bpy.context.active_object
if obj is None or obj.type != "MESH":
raise RuntimeError("Select a mesh object before running this script.")
mat = bpy.data.materials.new(name="ClearGlass")
mat.use_nodes = True
bsdf = mat.node_tree.nodes.get("Principled BSDF")
bsdf.inputs["Base Color"].default_value = (1.0, 1.0, 1.0, 1.0)
bsdf.inputs["Roughness"].default_value = 0.0
bsdf.inputs["IOR"].default_value = 1.45
bsdf.inputs["Transmission Weight"].default_value = 1.0
if obj.data.materials:
obj.data.materials[0] = mat
else:
obj.data.materials.append(mat)In the Shader Editor, the Principled BSDF should remain connected to the Material Output node. The material needs suitable lighting and something visible behind it. A glass object facing an empty background may look like it has no material.
Thickness, normals, and render engines
A solid glass object works better than a single plane because thickness gives light two surfaces to enter and leave. Use Solidify or model the object with an inner surface when appropriate.
Surface normals must point outward. Reversed normals can cause incorrect refraction or dark patches. In Edit Mode, select the mesh and use Mesh > Normals > Recalculate Outside.
Cycles usually gives the most physically accurate transmission. Eevee can render glass quickly, but its screen-space or ray-tracing settings may need adjustment. If glass appears opaque in Eevee, check the material's blend and ray-tracing settings for your Blender version, and enable the relevant refraction or ray-tracing support.
Frosted and tinted glass
To make frosted glass, raise Roughness to about 0.25 or 0.5. To make tinted glass, change Base Color to a pale color and keep Transmission Weight high. Strong colors can absorb much of the transmitted light and make the object appear darker.
Exercise
Which Principled BSDF inputs create clear glass, and what change would make it frosted?
Show answer
Use Transmission Weight 1.0, IOR about 1.45, white Base Color, and Roughness 0.0. Increase Roughness to make the glass frosted.