SlideShare une entreprise Scribd logo
1  sur  34
Shaders
Ehsan Ehrari
1
Materials, Shaders & Textures
• Rendering in Unity uses Materials, Shaders and Textures. All three
have a close relationship.
2
Materials
• Materials define how a surface should be rendered, by including
references to the Textures it uses, tiling information, Color tints and
more. The available options for a Material depend on which Shader
the Material is using.
3
Textures
• Textures are bitmap images. A Material can contain references to
textures, so that the Material’s Shader can use the textures while
calculating the surface color of a GameObject. In addition to basic
Color (Albedo) of a GameObject’s surface, Textures can represent
many other aspects of a Material’s surface such as its reflectivity or
roughness.
4
Shader
• Small scripts that contain the mathematical calculations and
algorithms for calculating the Color of each pixel rendered, based on
the lighting input and the Material configuration.
• A program specifically made to run on a GPU
• Post processing
5
3D models
• a collection of 3D coordinates called vertices
• Triangles
• Each vertices can contain few other information's color , direction
• Models cannot be rendered without a material
• Materials are wrappers which contain a shader and the values for its
properties.
• Hence, different materials can share the same shader
6
Diagram
7
Anatomy of a shaders
• Unity has two different types of shaders
• surface shaders
• fragment and vertex shaders
• fixed function shaders
8
Anatomy of a shaders
• multiple SubShader sections
• actual instructions for the GPU
• Unity execute in order until it finds one that is compatible with your
graphics
• different platforms
9
The properties
• equivalent to the public fields in a C# script
• changes made to the properties of a material while the game is
running in the editor are permanent.
10
The properties
11
The surface VS Vertex and fragment
• Whenever the material you want to simulate needs to be affected by lights
in a realistic way, chances are you’ll need a surface shader
• Surface shaders hide the calculations of how light is reflected and allows to
specify “intuitive” properties such as the albedo, the normals, the
reflectivity and so on in a function called surf.
• Vertex and fragment shaders work close to the way the GPU renders
triangles, and have no built-in concept of how light should behave. The
geometry of your model is first passed through a function called vert which
can alter its vertices. Then, individual triangles are passed through another
function called frag which decides the final RGB colour for every pixel. They
are useful for 2D effects, postprocessing and special 3D effects which are
too complex to be expressed as surface shaders.
12
Unity Standard Shader
• built-in shader
• “real-world” objects
• wide range of shader types and combinations
• enabled or disabled by simply using or not using
• Incorporate PBS
13
Physics Base Shading
• Simulates the interactions between materials and light in a way that
mimics reality.
• Only recently become possible in real-time graphics
• It works at its best in situations where lighting and materials need to
exist together intuitively and realistically.
• Advance lighting model
14
Standard Shader
• The Standard Shader is designed with hard surfaces in mind (also
known as “architectural materials”), and can deal with most real-
world materials like stone, glass, ceramics, brass, silver or rubber. It
will even do a decent job with non-hard materials like skin, hair and
cloth.
• With the Standard Shader, a large range of shader types (such as
Diffuse, Specular, Bumped Specular, Reflective) are combined into a
single shader intended to be used across all material types.
15
Rendered using the standard shader on all models
16
Material Parameters
17
Rendering Mode
• Opaque
• Cutout
• Transparent
• Fade
18
Opaque
• Opaque - Is the default, and suitable for normal solid objects with no
transparent areas.
19
Cutout
• Cutout - Allows you to create a transparent effect that has hard edges
between the opaque and transparent areas. In this mode, there are
no semi-transparent areas, the texture is either 100% opaque, or
invisible. This is useful when using transparency to create the shape
of materials such as leaves, or cloth with holes and tatters.
20
Transparent
• Transparent - Suitable for rendering realistic transparent materials
such as clear plastic or glass.
21
Fade
• Fade - Allows the transparency values to entirely fade an object out,
including any specular highlights or reflections it may have. This mode
is useful if you want to animate an object fading in or out. It is not
suitable for rendering realistic transparent materials such as clear
plastic or glass because the reflections and highlights will also be
faded out.
22
Albedo Color
• The Albedo parameter controls the base color of the
surface.
• More common to assign a texture map for the
Albedo parameter
• Albedo texture should not contain any lighting
23
Albedo Transparency
• The alpha value of the Albedo colour controls the transparency level
for the material. This only has an effect if the Rendering
Mode for the material is set to one of the transparent mode, and
not Opaque.
24
Specular mode: Specular parameter
• Standard (Specular setup):
Choose this shader for the
classic approach. A Specular
color is used to control the
color and strength of
specular reflections in the
material.
25
Metallic mode: Metallic Parameter
• When working in the Metallic
workflow (as opposed to the
Specular workflow), the the
reflectivity and light response of
the surface are modified by the
Metallic level and
the Smoothness level.
26
Metallic
27
Smoothness
• The smoothness of the material is controlled by a slider. This slider
allows you to control the “microsurface detail” or smoothness across
a surface
28
Normal Maps
• Normal maps are a type of Bump Map. They are a special kind of
texture that allow you to add surface detail such as bumps, grooves,
and scratches to a model which catch the light as if they are
represented by real geometry.
29
Normal Map
30
Height Map
• Height mapping (also known as parallax mapping) is a similar concept
to normal mapping, however this technique is more complex - and
therefore also more performance-expensive.
31
Occlusion Map
• The occlusion map is used to provide information about which areas
of the model should receive high or low indirect lighting.
32
Emission
• Emission controls the color and intensity of light emitted from the
surface. When you use an emissive Material in your Scene, it appears
as a visible source of light. The GameObject appears to be self-
illuminated.
33
Thank You
34

Contenu connexe

Tendances

Texture mapping
Texture mapping Texture mapping
Texture mapping wahab13
 
Fundamentals Image and Graphics
Fundamentals Image and GraphicsFundamentals Image and Graphics
Fundamentals Image and GraphicsShrawan Adhikari
 
Principles of composition
Principles of compositionPrinciples of composition
Principles of compositionBev Towns
 
Compositing, Composing Worlds
Compositing, Composing WorldsCompositing, Composing Worlds
Compositing, Composing WorldsNelson Zagalo
 
Image Compression Using Neural Network
 Image Compression Using Neural Network Image Compression Using Neural Network
Image Compression Using Neural NetworkOmkar Lokhande
 
Progressive Lightmapper: An Introduction to Lightmapping in Unity
Progressive Lightmapper: An Introduction to Lightmapping in UnityProgressive Lightmapper: An Introduction to Lightmapping in Unity
Progressive Lightmapper: An Introduction to Lightmapping in UnityUnity Technologies
 
Modelización icónica con la proporción áurea
Modelización icónica con la proporción áureaModelización icónica con la proporción áurea
Modelización icónica con la proporción áureaLiye Zhu
 
Graphics pipeline and rendering
Graphics pipeline and renderingGraphics pipeline and rendering
Graphics pipeline and renderingiain bruce
 
Photogrammetry and Star Wars Battlefront
Photogrammetry and Star Wars BattlefrontPhotogrammetry and Star Wars Battlefront
Photogrammetry and Star Wars BattlefrontElectronic Arts / DICE
 
도트클리커 게임만들기
도트클리커 게임만들기도트클리커 게임만들기
도트클리커 게임만들기Yunjeong Kim
 
[0806 박민근] 림 라이팅(rim lighting)
[0806 박민근] 림 라이팅(rim lighting)[0806 박민근] 림 라이팅(rim lighting)
[0806 박민근] 림 라이팅(rim lighting)MinGeun Park
 
CS 354 Texture Mapping
CS 354 Texture MappingCS 354 Texture Mapping
CS 354 Texture MappingMark Kilgard
 
Eigenface For Face Recognition
Eigenface For Face RecognitionEigenface For Face Recognition
Eigenface For Face RecognitionMinh Tran
 

Tendances (20)

Texture mapping
Texture mapping Texture mapping
Texture mapping
 
Fundamentals Image and Graphics
Fundamentals Image and GraphicsFundamentals Image and Graphics
Fundamentals Image and Graphics
 
Texture Mapping
Texture MappingTexture Mapping
Texture Mapping
 
Principles of composition
Principles of compositionPrinciples of composition
Principles of composition
 
GRPHICS06 - Shading
GRPHICS06 - ShadingGRPHICS06 - Shading
GRPHICS06 - Shading
 
Compositing, Composing Worlds
Compositing, Composing WorldsCompositing, Composing Worlds
Compositing, Composing Worlds
 
Image Compression Using Neural Network
 Image Compression Using Neural Network Image Compression Using Neural Network
Image Compression Using Neural Network
 
Progressive Lightmapper: An Introduction to Lightmapping in Unity
Progressive Lightmapper: An Introduction to Lightmapping in UnityProgressive Lightmapper: An Introduction to Lightmapping in Unity
Progressive Lightmapper: An Introduction to Lightmapping in Unity
 
Modelización icónica con la proporción áurea
Modelización icónica con la proporción áureaModelización icónica con la proporción áurea
Modelización icónica con la proporción áurea
 
3D Maya Lighting
3D Maya Lighting3D Maya Lighting
3D Maya Lighting
 
Graphics pipeline and rendering
Graphics pipeline and renderingGraphics pipeline and rendering
Graphics pipeline and rendering
 
Photogrammetry and Star Wars Battlefront
Photogrammetry and Star Wars BattlefrontPhotogrammetry and Star Wars Battlefront
Photogrammetry and Star Wars Battlefront
 
Introduction to Unity
Introduction to UnityIntroduction to Unity
Introduction to Unity
 
도트클리커 게임만들기
도트클리커 게임만들기도트클리커 게임만들기
도트클리커 게임만들기
 
Moving object detection
Moving object detectionMoving object detection
Moving object detection
 
[0806 박민근] 림 라이팅(rim lighting)
[0806 박민근] 림 라이팅(rim lighting)[0806 박민근] 림 라이팅(rim lighting)
[0806 박민근] 림 라이팅(rim lighting)
 
CS 354 Texture Mapping
CS 354 Texture MappingCS 354 Texture Mapping
CS 354 Texture Mapping
 
Eigenface For Face Recognition
Eigenface For Face RecognitionEigenface For Face Recognition
Eigenface For Face Recognition
 
Animation
AnimationAnimation
Animation
 
Abhilash VFX presentation
Abhilash VFX presentationAbhilash VFX presentation
Abhilash VFX presentation
 

Similaire à Shaders & Standard Shader In Unity

Les 2 game 3d - texturing & materials
Les 2   game 3d - texturing & materialsLes 2   game 3d - texturing & materials
Les 2 game 3d - texturing & materialsFrancisco Peters
 
Game development terminologies
Game development terminologiesGame development terminologies
Game development terminologiesAhmed Badr
 
From Experimentation to Production: The Future of WebGL
From Experimentation to Production: The Future of WebGLFrom Experimentation to Production: The Future of WebGL
From Experimentation to Production: The Future of WebGLFITC
 
[UniteKorea2013] The Unity Rendering Pipeline
[UniteKorea2013] The Unity Rendering Pipeline[UniteKorea2013] The Unity Rendering Pipeline
[UniteKorea2013] The Unity Rendering PipelineWilliam Hugo Yang
 
Clean architecture for shaders unite2019
Clean architecture for shaders unite2019Clean architecture for shaders unite2019
Clean architecture for shaders unite2019Abhilash Majumder
 
Layar - 3D Content Creation Tips and Tricks
Layar - 3D Content Creation Tips and TricksLayar - 3D Content Creation Tips and Tricks
Layar - 3D Content Creation Tips and TricksLayar
 
Modeling and texturing in 3 ds max
Modeling and texturing in 3 ds maxModeling and texturing in 3 ds max
Modeling and texturing in 3 ds maxsribalaji0007
 
Modelo y textrurizado 3 ds max
Modelo y textrurizado 3 ds maxModelo y textrurizado 3 ds max
Modelo y textrurizado 3 ds maxLuchIn Avalos
 
OpenCV presentation series- part 4
OpenCV presentation series- part 4OpenCV presentation series- part 4
OpenCV presentation series- part 4Sairam Adithya
 
digital image processing.pptx
digital image processing.pptxdigital image processing.pptx
digital image processing.pptxnibiganesh
 
Cahall Final Intern Presentation
Cahall Final Intern PresentationCahall Final Intern Presentation
Cahall Final Intern PresentationDaniel Cahall
 
Rendering basics
Rendering basicsRendering basics
Rendering basicsicedmaster
 
Authoring of procedural rocks in The Blacksmith realtime short
Authoring of procedural rocks in The Blacksmith realtime shortAuthoring of procedural rocks in The Blacksmith realtime short
Authoring of procedural rocks in The Blacksmith realtime shortVesselin Efremov
 
Make your designers love (working with) you
Make your designers love (working with) youMake your designers love (working with) you
Make your designers love (working with) youVinay Shenoy
 

Similaire à Shaders & Standard Shader In Unity (20)

3 D texturing
 3 D texturing 3 D texturing
3 D texturing
 
Les 2 game 3d - texturing & materials
Les 2   game 3d - texturing & materialsLes 2   game 3d - texturing & materials
Les 2 game 3d - texturing & materials
 
Deferred shading
Deferred shadingDeferred shading
Deferred shading
 
Game development terminologies
Game development terminologiesGame development terminologies
Game development terminologies
 
From Experimentation to Production: The Future of WebGL
From Experimentation to Production: The Future of WebGLFrom Experimentation to Production: The Future of WebGL
From Experimentation to Production: The Future of WebGL
 
TASK 2
TASK 2TASK 2
TASK 2
 
[UniteKorea2013] The Unity Rendering Pipeline
[UniteKorea2013] The Unity Rendering Pipeline[UniteKorea2013] The Unity Rendering Pipeline
[UniteKorea2013] The Unity Rendering Pipeline
 
Clean architecture for shaders unite2019
Clean architecture for shaders unite2019Clean architecture for shaders unite2019
Clean architecture for shaders unite2019
 
Layar - 3D Content Creation Tips and Tricks
Layar - 3D Content Creation Tips and TricksLayar - 3D Content Creation Tips and Tricks
Layar - 3D Content Creation Tips and Tricks
 
Modeling and texturing in 3 ds max
Modeling and texturing in 3 ds maxModeling and texturing in 3 ds max
Modeling and texturing in 3 ds max
 
Modelo y textrurizado 3 ds max
Modelo y textrurizado 3 ds maxModelo y textrurizado 3 ds max
Modelo y textrurizado 3 ds max
 
WT in IP.ppt
WT in IP.pptWT in IP.ppt
WT in IP.ppt
 
3D modeling and animation
3D modeling and animation3D modeling and animation
3D modeling and animation
 
OpenCV presentation series- part 4
OpenCV presentation series- part 4OpenCV presentation series- part 4
OpenCV presentation series- part 4
 
digital image processing.pptx
digital image processing.pptxdigital image processing.pptx
digital image processing.pptx
 
PPT s08-machine vision-s2
PPT s08-machine vision-s2PPT s08-machine vision-s2
PPT s08-machine vision-s2
 
Cahall Final Intern Presentation
Cahall Final Intern PresentationCahall Final Intern Presentation
Cahall Final Intern Presentation
 
Rendering basics
Rendering basicsRendering basics
Rendering basics
 
Authoring of procedural rocks in The Blacksmith realtime short
Authoring of procedural rocks in The Blacksmith realtime shortAuthoring of procedural rocks in The Blacksmith realtime short
Authoring of procedural rocks in The Blacksmith realtime short
 
Make your designers love (working with) you
Make your designers love (working with) youMake your designers love (working with) you
Make your designers love (working with) you
 

Dernier

Student login on Anyboli platform.helpin
Student login on Anyboli platform.helpinStudent login on Anyboli platform.helpin
Student login on Anyboli platform.helpinRaunakKeshri1
 
APM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAPM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAssociation for Project Management
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxVishalSingh1417
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformChameera Dedduwage
 
Measures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDMeasures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDThiyagu K
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsTechSoup
 
Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Disha Kariya
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactdawncurless
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13Steve Thomason
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingTechSoup
 
General AI for Medical Educators April 2024
General AI for Medical Educators April 2024General AI for Medical Educators April 2024
General AI for Medical Educators April 2024Janet Corral
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...EduSkills OECD
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphThiyagu K
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactPECB
 
9548086042 for call girls in Indira Nagar with room service
9548086042  for call girls in Indira Nagar  with room service9548086042  for call girls in Indira Nagar  with room service
9548086042 for call girls in Indira Nagar with room servicediscovermytutordmt
 
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhikauryashika82
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfciinovamais
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Celine George
 

Dernier (20)

Student login on Anyboli platform.helpin
Student login on Anyboli platform.helpinStudent login on Anyboli platform.helpin
Student login on Anyboli platform.helpin
 
APM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAPM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across Sectors
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptx
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy Reform
 
Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1
 
Measures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDMeasures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SD
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The Basics
 
Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impact
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy Consulting
 
General AI for Medical Educators April 2024
General AI for Medical Educators April 2024General AI for Medical Educators April 2024
General AI for Medical Educators April 2024
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
 
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptxINDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot Graph
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global Impact
 
9548086042 for call girls in Indira Nagar with room service
9548086042  for call girls in Indira Nagar  with room service9548086042  for call girls in Indira Nagar  with room service
9548086042 for call girls in Indira Nagar with room service
 
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17
 

Shaders & Standard Shader In Unity

  • 2. Materials, Shaders & Textures • Rendering in Unity uses Materials, Shaders and Textures. All three have a close relationship. 2
  • 3. Materials • Materials define how a surface should be rendered, by including references to the Textures it uses, tiling information, Color tints and more. The available options for a Material depend on which Shader the Material is using. 3
  • 4. Textures • Textures are bitmap images. A Material can contain references to textures, so that the Material’s Shader can use the textures while calculating the surface color of a GameObject. In addition to basic Color (Albedo) of a GameObject’s surface, Textures can represent many other aspects of a Material’s surface such as its reflectivity or roughness. 4
  • 5. Shader • Small scripts that contain the mathematical calculations and algorithms for calculating the Color of each pixel rendered, based on the lighting input and the Material configuration. • A program specifically made to run on a GPU • Post processing 5
  • 6. 3D models • a collection of 3D coordinates called vertices • Triangles • Each vertices can contain few other information's color , direction • Models cannot be rendered without a material • Materials are wrappers which contain a shader and the values for its properties. • Hence, different materials can share the same shader 6
  • 8. Anatomy of a shaders • Unity has two different types of shaders • surface shaders • fragment and vertex shaders • fixed function shaders 8
  • 9. Anatomy of a shaders • multiple SubShader sections • actual instructions for the GPU • Unity execute in order until it finds one that is compatible with your graphics • different platforms 9
  • 10. The properties • equivalent to the public fields in a C# script • changes made to the properties of a material while the game is running in the editor are permanent. 10
  • 12. The surface VS Vertex and fragment • Whenever the material you want to simulate needs to be affected by lights in a realistic way, chances are you’ll need a surface shader • Surface shaders hide the calculations of how light is reflected and allows to specify “intuitive” properties such as the albedo, the normals, the reflectivity and so on in a function called surf. • Vertex and fragment shaders work close to the way the GPU renders triangles, and have no built-in concept of how light should behave. The geometry of your model is first passed through a function called vert which can alter its vertices. Then, individual triangles are passed through another function called frag which decides the final RGB colour for every pixel. They are useful for 2D effects, postprocessing and special 3D effects which are too complex to be expressed as surface shaders. 12
  • 13. Unity Standard Shader • built-in shader • “real-world” objects • wide range of shader types and combinations • enabled or disabled by simply using or not using • Incorporate PBS 13
  • 14. Physics Base Shading • Simulates the interactions between materials and light in a way that mimics reality. • Only recently become possible in real-time graphics • It works at its best in situations where lighting and materials need to exist together intuitively and realistically. • Advance lighting model 14
  • 15. Standard Shader • The Standard Shader is designed with hard surfaces in mind (also known as “architectural materials”), and can deal with most real- world materials like stone, glass, ceramics, brass, silver or rubber. It will even do a decent job with non-hard materials like skin, hair and cloth. • With the Standard Shader, a large range of shader types (such as Diffuse, Specular, Bumped Specular, Reflective) are combined into a single shader intended to be used across all material types. 15
  • 16. Rendered using the standard shader on all models 16
  • 18. Rendering Mode • Opaque • Cutout • Transparent • Fade 18
  • 19. Opaque • Opaque - Is the default, and suitable for normal solid objects with no transparent areas. 19
  • 20. Cutout • Cutout - Allows you to create a transparent effect that has hard edges between the opaque and transparent areas. In this mode, there are no semi-transparent areas, the texture is either 100% opaque, or invisible. This is useful when using transparency to create the shape of materials such as leaves, or cloth with holes and tatters. 20
  • 21. Transparent • Transparent - Suitable for rendering realistic transparent materials such as clear plastic or glass. 21
  • 22. Fade • Fade - Allows the transparency values to entirely fade an object out, including any specular highlights or reflections it may have. This mode is useful if you want to animate an object fading in or out. It is not suitable for rendering realistic transparent materials such as clear plastic or glass because the reflections and highlights will also be faded out. 22
  • 23. Albedo Color • The Albedo parameter controls the base color of the surface. • More common to assign a texture map for the Albedo parameter • Albedo texture should not contain any lighting 23
  • 24. Albedo Transparency • The alpha value of the Albedo colour controls the transparency level for the material. This only has an effect if the Rendering Mode for the material is set to one of the transparent mode, and not Opaque. 24
  • 25. Specular mode: Specular parameter • Standard (Specular setup): Choose this shader for the classic approach. A Specular color is used to control the color and strength of specular reflections in the material. 25
  • 26. Metallic mode: Metallic Parameter • When working in the Metallic workflow (as opposed to the Specular workflow), the the reflectivity and light response of the surface are modified by the Metallic level and the Smoothness level. 26
  • 28. Smoothness • The smoothness of the material is controlled by a slider. This slider allows you to control the “microsurface detail” or smoothness across a surface 28
  • 29. Normal Maps • Normal maps are a type of Bump Map. They are a special kind of texture that allow you to add surface detail such as bumps, grooves, and scratches to a model which catch the light as if they are represented by real geometry. 29
  • 31. Height Map • Height mapping (also known as parallax mapping) is a similar concept to normal mapping, however this technique is more complex - and therefore also more performance-expensive. 31
  • 32. Occlusion Map • The occlusion map is used to provide information about which areas of the model should receive high or low indirect lighting. 32
  • 33. Emission • Emission controls the color and intensity of light emitted from the surface. When you use an emissive Material in your Scene, it appears as a visible source of light. The GameObject appears to be self- illuminated. 33