jeremyromanowski.com
NERDY TIME
Shader ?
Basic rendering pipeline
Vertex Data
Vertex
Processing
Rasterizing
Display
Output
Merging
Fragment
Processing
Basic rendering pipeline
Vertex Data
Vertex
Processing
Rasterizing
Display
Output
Merging
Fragment
Processing
SHADER
SHADER
Vertex shader
Modify vertex data (mostly position)
Example: Waving flags
Displace vertices’ positions by sine wave and noise
Fragment shader
Modify pixel/fragment data (mostly color)
Example: See through / Infrared Vision
Render specific object in front of the others
A material consists of a shader and
visible parameters from that shader.
Could be considered as a shader preset.
Example: Change base texture of the
MatCap shader to create different materials
Material
PBR ?
Unlit
NOT affected by light -> very fast.
Example: 2D sprites.
Example: Anime style without light.
Lit
Affected by light.
Approximated by a math model.
Example: Phong shading.
*Image: Phong & his friends were measuring a car to render in 3D
Flat Gouraud Phong
0.0 1.0
Phong shading
Diffuse: Calculate the angle between normal vector
and light direction.
Specular: Calculate the angle between reflected
light ray and view direction.
Smaller angle means brighter color.
Cel-shading
Is a Lit shading technique !!!
Transitions between dark & light areas are
controlled by a “shading ramp” image.
Immediate
transitions
Shading ramp image
More: Daniel Ilette’s tutorial
PBR
Physically-Based Rendering.
A group of light simulation techniques.
Control by multiple images called textures.
Ref: Wikipedia
Ref: Unity’s Standard Shaders
*Image: The blue turtle
HANDS-ON
TIME
URP Lit Shader
PBR Textures – Albedo
A base color without lighting factors (specular, shadow...).
Could be a texture (RGB), a solid color, or both.
Depend on light direction.
Other common names are main / base / diffuse textures.
More: Unity’s Albedo Color
PBR Textures – Smoothness
Smoother surface means
clearer reflection.
Smoothness = 0 Smoothness = 0.4 Smoothness = 0.7 !!!
Specular
highlight
0.0 1.0
PBR Textures:
Smoothness
Smoother surface means clearer reflection.
Could be a number / a texture.
Specular highlight depends on light and
view direction.
More: Unity's Smoothness
Smoothness = 0 Smoothness = 0.4
0.0 1.0
PBR Textures:
Normal
Normal vector is perpendicular to a tangent plane
at a surface point.
Normal vector is important in calculating light effect.
Normal vector usually points outward.
More: Wikipedia
Without Normal Map With Normal Map
Texture type must be Normal Map.
Fun: It's mostly purple.
Ref: Unity's Normal Map
PBR Textures:
Normal
PBR Textures:
Normal
Could simulate the details with a low-poly
mesh very efficiently.
Bump map is a more general map
whose values indicating the height
adjustment amount, not the direction.
Metallic parameter controls specular reflection.
*Smoothness affects specular highlight, too.
Could be a number / a texture (single channel).
More: Unity's Metallic Workflow
PBR Textures:
Metallic
More albedo More environment reflection
0.0 1.0
Environment
Reflection
Specular
Highlight
You must pick Metallic or Specular workflow.
Specular gives you more control (color, brightness,
blending with environment ...).
Could be a texture (RGB) or a solid color.
*Not recommended for newbie.
More: Unity's Specular Workflow
PBR Textures –
Specular
Glass
Smoothness = 0.95
Metallic = 1
Golden
Smoothness = 0.75
Metallic = 1
Plastic
Smoothness = 0.75
Metallic = 0
Render both outward
and inward faces
Alpha = 0.2
A single number might not be enough.
Different parts need different PBR configurations.
That's why we need textures for fine-control.
Varied parameters
By sharing metallic & smoothness,
WOOD looks like BRONZE
Metallic
Smoothness
Albedo
WOOD
Non-metallic & rough
Mixed physical materials
Metallic
Smoothness
PBR Textures Preprocessing
RED
GREEN
BLUE
ALPHA
Metallic (R)
Smoothness (A)
Roughness
Invert
*Details in next parts
Other common PBR parameters
ALPHA
Control opacity of transparent object.
*For opaque object, pixels with alpha lower than a threshold would be invisible.
AMBIENT OCCLUSION
Control how much indirect light should be received (specially for cracks, intersections).
EMISSION
Control which area emitting light, and the emitted light color.
GOOGLE TIME
§ Glossiness / Roughness
§ Fresnel effect
§ Rim light
§ Height map
§ Clear coat
Summary
1
2
3
SHADER
It's the code to manipulate vertex and fragment data for rendering.
PBR SHADERS
They're flexible and powerful to create realistic materials.
ALBEDO, NORMAL, SMOOTHNESS
They're common properties essential for further study.
MAKE IT
BREAK IT
EXPAND IT
§ Shader Graph
§ UV Mapping
§ Effects (Dissolve, Hologram ...)
§ Special rendering (Grass, Water ...)
§ …
/AbalanchePage
/Abalanche /Abalanche

Abalanche - Unity Shader Graph #1: Shader & PBR Materials

  • 1.
  • 2.
  • 4.
    Basic rendering pipeline VertexData Vertex Processing Rasterizing Display Output Merging Fragment Processing
  • 5.
    Basic rendering pipeline VertexData Vertex Processing Rasterizing Display Output Merging Fragment Processing SHADER SHADER
  • 6.
    Vertex shader Modify vertexdata (mostly position) Example: Waving flags Displace vertices’ positions by sine wave and noise
  • 7.
    Fragment shader Modify pixel/fragmentdata (mostly color) Example: See through / Infrared Vision Render specific object in front of the others
  • 8.
    A material consistsof a shader and visible parameters from that shader. Could be considered as a shader preset. Example: Change base texture of the MatCap shader to create different materials Material
  • 9.
  • 10.
    Unlit NOT affected bylight -> very fast. Example: 2D sprites. Example: Anime style without light.
  • 11.
    Lit Affected by light. Approximatedby a math model. Example: Phong shading. *Image: Phong & his friends were measuring a car to render in 3D
  • 12.
    Flat Gouraud Phong 0.01.0 Phong shading Diffuse: Calculate the angle between normal vector and light direction. Specular: Calculate the angle between reflected light ray and view direction. Smaller angle means brighter color.
  • 13.
    Cel-shading Is a Litshading technique !!! Transitions between dark & light areas are controlled by a “shading ramp” image. Immediate transitions Shading ramp image More: Daniel Ilette’s tutorial
  • 14.
    PBR Physically-Based Rendering. A groupof light simulation techniques. Control by multiple images called textures. Ref: Wikipedia Ref: Unity’s Standard Shaders *Image: The blue turtle
  • 16.
  • 17.
    PBR Textures –Albedo A base color without lighting factors (specular, shadow...). Could be a texture (RGB), a solid color, or both. Depend on light direction. Other common names are main / base / diffuse textures. More: Unity’s Albedo Color
  • 18.
    PBR Textures –Smoothness Smoother surface means clearer reflection. Smoothness = 0 Smoothness = 0.4 Smoothness = 0.7 !!! Specular highlight 0.0 1.0
  • 19.
    PBR Textures: Smoothness Smoother surfacemeans clearer reflection. Could be a number / a texture. Specular highlight depends on light and view direction. More: Unity's Smoothness Smoothness = 0 Smoothness = 0.4 0.0 1.0
  • 20.
    PBR Textures: Normal Normal vectoris perpendicular to a tangent plane at a surface point. Normal vector is important in calculating light effect. Normal vector usually points outward. More: Wikipedia
  • 21.
    Without Normal MapWith Normal Map Texture type must be Normal Map. Fun: It's mostly purple. Ref: Unity's Normal Map PBR Textures: Normal
  • 22.
    PBR Textures: Normal Could simulatethe details with a low-poly mesh very efficiently. Bump map is a more general map whose values indicating the height adjustment amount, not the direction.
  • 23.
    Metallic parameter controlsspecular reflection. *Smoothness affects specular highlight, too. Could be a number / a texture (single channel). More: Unity's Metallic Workflow PBR Textures: Metallic More albedo More environment reflection 0.0 1.0 Environment Reflection Specular Highlight
  • 24.
    You must pickMetallic or Specular workflow. Specular gives you more control (color, brightness, blending with environment ...). Could be a texture (RGB) or a solid color. *Not recommended for newbie. More: Unity's Specular Workflow PBR Textures – Specular
  • 26.
    Glass Smoothness = 0.95 Metallic= 1 Golden Smoothness = 0.75 Metallic = 1 Plastic Smoothness = 0.75 Metallic = 0 Render both outward and inward faces Alpha = 0.2
  • 28.
    A single numbermight not be enough. Different parts need different PBR configurations. That's why we need textures for fine-control. Varied parameters By sharing metallic & smoothness, WOOD looks like BRONZE
  • 29.
  • 30.
    Metallic Smoothness PBR Textures Preprocessing RED GREEN BLUE ALPHA Metallic(R) Smoothness (A) Roughness Invert *Details in next parts
  • 32.
    Other common PBRparameters ALPHA Control opacity of transparent object. *For opaque object, pixels with alpha lower than a threshold would be invisible. AMBIENT OCCLUSION Control how much indirect light should be received (specially for cracks, intersections). EMISSION Control which area emitting light, and the emitted light color.
  • 33.
    GOOGLE TIME § Glossiness/ Roughness § Fresnel effect § Rim light § Height map § Clear coat
  • 34.
    Summary 1 2 3 SHADER It's the codeto manipulate vertex and fragment data for rendering. PBR SHADERS They're flexible and powerful to create realistic materials. ALBEDO, NORMAL, SMOOTHNESS They're common properties essential for further study.
  • 35.
  • 36.
    § Shader Graph §UV Mapping § Effects (Dissolve, Hologram ...) § Special rendering (Grass, Water ...) § …
  • 37.