0
0
Unityframework~15 mins

Material properties in Unity - Deep Dive

Choose your learning style9 modes available
Overview - Material properties
What is it?
Material properties in Unity define how a surface looks and reacts to light. They control colors, textures, shininess, transparency, and other visual effects on 3D objects. These properties are set in materials, which are applied to objects to give them a specific appearance. Understanding material properties helps you make objects look realistic or stylized in your game or scene.
Why it matters
Without material properties, all objects would look flat and lifeless, making games and scenes dull and confusing. Material properties solve the problem of making surfaces appear real or artistic by controlling how light interacts with them. This makes the world feel believable and immersive, which is essential for player engagement and visual storytelling.
Where it fits
Before learning material properties, you should understand basic 3D objects and how Unity renders scenes. After mastering material properties, you can explore shaders, lighting techniques, and advanced rendering effects to create even richer visuals.
Mental Model
Core Idea
Material properties are like the paint and finish on a real-world object that decide how it looks and shines under light.
Think of it like...
Imagine painting a wooden table: the color of the paint, the glossiness of the varnish, and the texture you feel all change how the table looks and feels. Material properties in Unity do the same for 3D objects.
┌───────────────┐
│   Material    │
│  Properties   │
├───────────────┤
│ Color         │
│ Texture       │
│ Smoothness    │
│ Metallic      │
│ Transparency  │
└───────────────┘
        ↓
┌───────────────┐
│  3D Object    │
│  Appearance   │
└───────────────┘
Build-Up - 6 Steps
1
FoundationWhat is a Material in Unity
🤔
Concept: Introduce the basic idea of a material as a container for visual settings.
In Unity, a material holds settings that tell the engine how to draw the surface of a 3D object. It includes colors, textures (images), and other properties that affect appearance. You create a material and then assign it to an object to change how it looks.
Result
Objects with materials show colors and textures instead of plain default colors.
Understanding that materials are the bridge between 3D models and their visual look is key to controlling appearance.
2
FoundationBasic Material Properties Explained
🤔
Concept: Learn the common properties like color, texture, and smoothness.
Materials have properties such as: - Color: The base color of the surface. - Texture: An image that wraps around the object. - Smoothness: How shiny or matte the surface looks. - Metallic: How much the surface looks like metal. These properties combine to create the final look.
Result
Changing these properties changes how the object looks in the scene.
Knowing these basic properties lets you start customizing object appearances easily.
3
IntermediateUsing Textures to Add Detail
🤔Before reading on: Do you think textures only add color, or can they also affect shininess and bumps? Commit to your answer.
Concept: Textures can control more than just color; they can affect shininess, bumps, and transparency.
Textures are images applied to materials. Besides color, special textures called maps can control: - Normal maps: Create bumps and dents without changing shape. - Metallic maps: Define which parts look metallic. - Smoothness maps: Control shiny vs matte areas. - Alpha maps: Control transparency. Using these maps adds realism and detail.
Result
Objects look more complex and realistic with detailed surface effects.
Understanding that textures can control multiple visual aspects unlocks advanced material design.
4
IntermediateHow Lighting Interacts with Materials
🤔Before reading on: Does changing material properties affect how light bounces off an object? Yes or no? Commit to your answer.
Concept: Material properties determine how light reflects, refracts, or absorbs on surfaces.
Materials tell Unity how to calculate light interaction: - Metallic surfaces reflect light sharply. - Smooth surfaces create clear reflections. - Rough surfaces scatter light softly. - Transparent materials let light pass through. These interactions create the illusion of real materials.
Result
Objects respond to scene lighting realistically based on their material settings.
Knowing that materials control light behavior helps you predict and craft realistic visuals.
5
AdvancedCustomizing Materials with Shader Properties
🤔Before reading on: Do you think all material properties are fixed, or can shaders add new custom properties? Commit to your answer.
Concept: Shaders define how materials render and can expose custom properties for advanced effects.
A shader is a small program that runs on the GPU to draw materials. Unity’s standard shader has many built-in properties, but custom shaders can add new ones like emission (glow), detail maps, or special effects. You can edit these properties in materials to create unique looks.
Result
Materials can have complex, dynamic appearances beyond basic color and texture.
Understanding shaders and their properties is essential for creating advanced and optimized visuals.
6
ExpertPerformance Impact of Material Properties
🤔Before reading on: Do you think adding more textures and effects always improves visuals without cost? Commit to your answer.
Concept: Material complexity affects rendering performance and must be balanced for smooth gameplay.
Each texture and property adds work for the GPU. Using many high-resolution textures, transparency, or complex shaders can slow down rendering. Optimizing materials by reducing textures, using simpler shaders, or combining maps helps keep games running smoothly on all devices.
Result
Well-optimized materials maintain good visuals without hurting game performance.
Knowing the performance cost of material properties helps you make smart trade-offs in real projects.
Under the Hood
Unity materials work by passing their properties to shaders, which are programs running on the graphics card. The shader uses these properties to calculate the color of each pixel on the object based on lighting, camera angle, and textures. This process happens every frame to create dynamic, realistic visuals.
Why designed this way?
Separating materials from shaders allows flexibility: artists can tweak appearance without changing code, and developers can write shaders for different effects. This design balances ease of use with powerful customization, supporting a wide range of visual styles and hardware.
┌───────────────┐       ┌───────────────┐
│   Material    │──────▶│   Shader      │
│ Properties   │       │  Program      │
└───────────────┘       └───────────────┘
          │                      │
          ▼                      ▼
┌─────────────────────────────────────────┐
│ GPU calculates pixel colors using light │
│ direction, camera, and material inputs  │
└─────────────────────────────────────────┘
Myth Busters - 4 Common Misconceptions
Quick: Does increasing smoothness always make an object look better? Commit to yes or no.
Common Belief:More smoothness always improves the look by making surfaces shinier and nicer.
Tap to reveal reality
Reality:Too much smoothness can make surfaces look unnatural or plastic-like, losing realism.
Why it matters:Overusing smoothness can break immersion and make materials look fake.
Quick: Do you think textures only affect color? Commit to yes or no.
Common Belief:Textures only change the color of an object’s surface.
Tap to reveal reality
Reality:Textures can also control bumps, metalness, transparency, and other effects.
Why it matters:Ignoring texture maps limits the visual richness and realism you can achieve.
Quick: Can one material be shared by many objects without issues? Commit to yes or no.
Common Belief:You can freely share one material among many objects without side effects.
Tap to reveal reality
Reality:Changing a shared material affects all objects using it, which can cause unintended changes.
Why it matters:Not understanding this leads to bugs where multiple objects change appearance unexpectedly.
Quick: Does using transparent materials always improve visuals? Commit to yes or no.
Common Belief:Transparent materials are always better for effects like glass or water.
Tap to reveal reality
Reality:Transparency is expensive to render and can cause sorting issues if not handled carefully.
Why it matters:Misusing transparency can cause performance drops and visual glitches.
Expert Zone
1
Some material properties only affect appearance in certain lighting conditions, so testing under different lights is crucial.
2
Unity’s material system caches shader variants; excessive unique materials can increase build size and load times.
3
Using texture atlases can reduce draw calls by combining multiple textures into one, improving performance.
When NOT to use
Avoid complex materials with many textures and transparency on mobile or VR platforms; use simpler shaders or baked lighting instead for better performance.
Production Patterns
In production, artists and developers collaborate: artists create base materials and textures, while developers optimize shaders and manage material instances to balance quality and performance.
Connections
Physics Materials
Related but different: physics materials control physical behavior, while material properties control visual appearance.
Understanding both helps create objects that look right and behave realistically in a game.
Photography Lighting Techniques
Material properties simulate how real-world surfaces react to light, similar to how photographers use lighting to shape appearance.
Knowing photography lighting principles helps in setting material properties for realistic rendering.
Painting and Surface Finishes
Material properties mimic real-world paint types and finishes like matte, gloss, or metallic.
Familiarity with physical materials and finishes aids in choosing and adjusting material properties effectively.
Common Pitfalls
#1Using one material instance for many objects and changing its color per object.
Wrong approach:material.color = Color.red; // applied globally to all objects sharing this material
Correct approach:Use material instances or MaterialPropertyBlock to change color per object without affecting others.
Root cause:Misunderstanding that materials are shared assets and changes affect all users.
#2Applying high-resolution textures everywhere without optimization.
Wrong approach:Assigning 4K textures to all materials regardless of object size or importance.
Correct approach:Use lower resolution textures for small or distant objects and compress textures appropriately.
Root cause:Not considering performance impact of texture size on rendering speed and memory.
#3Setting transparency without sorting or blending considerations.
Wrong approach:Using transparent materials on many overlapping objects without sorting layers.
Correct approach:Manage render queues and sorting layers to avoid visual glitches with transparency.
Root cause:Lack of understanding of how transparency affects rendering order and blending.
Key Takeaways
Material properties define how 3D objects look by controlling color, texture, shininess, and transparency.
Textures can influence many visual aspects beyond color, such as bumps and metalness, adding realism.
Materials work with shaders to calculate how light interacts with surfaces every frame.
Optimizing material complexity is crucial to maintain good performance in games and applications.
Sharing materials requires care because changes affect all objects using that material.