<commit_before>---
title: "Material"
type: components
layout: docs
parent_section: components
order: 9
---

The material component defines the appearance of an entity. It can define attributes such as color, opacity, or texture. A geometry component is usually defined alongside the material component.

Here is an example defining a red material on a box geometry, creating a red cube.

```html
<a-entity geometry="primitive: box" material="color: red"></a-entity>
```

| Attribute    | Description                                                                                                                                    | Default Value |
|--------------|------------------------------------------------------------------------------------------------------------------------------------------------|---------------|
| color        | Base color of the geometry.                                                                                                                    | #fff          |
| envMap       | Environment cubemap texture for reflections. Can be a selector to <a-cubemap> or a comma-separated list of URLs.                             | None          |
| height       | Height of video (in pixels), if defining a video texture.                                                                                      | 360           |
| metalness    | How metallic the material is from 0 to 1. Does not apply if `shader` is set to `flat`.                                                         | 0.5           |
| opacity      | Extent of transparency. If the `transparent` attribute is not `true`, then the material will remain opaque and `opacity` will only affect color. | 1.0           |
| reflectivity | How reflective the material is from `0` to `1` if the `envMap` attribute is set.                                                               | 1.0           |
| repeat       | How many times a texture (defined by `src`) repeats in the X and Y direction.                                                                  | 1 1           |
| roughness    | How rough the material is from 0 to 1. A rougher material will scatter reflected light in more directions than a smooth material. Does not apply if `shader` is set to `flat`. | 0.5 |
| transparent  | Whether material is transparent. Transparent entities are rendered after non-transparent entities.                                             | false         |
| shader       | Shading model. Defaults to physically based shading but can also be set to `flat` shading.                                                     | standard      |
| src          | Image or video texture map. Can either be a selector to an `<img>` or `<video>`, or an inline URL.                                             | None          |
| width        | Width of video (in pixels), if defining a video texture.                                                                                       | 640           |

## Defining Textures

To set a texture on the material, specify the `src` attribute. `src` can either be a selector to an `<img>` or `<video>` element:<commit_msg>Docs > Components > Material: quote numbers in description column of table<commit_after>---
title: "Material"
type: components
layout: docs
parent_section: components
order: 9
---

The material component defines the appearance of an entity. It can define attributes such as color, opacity, or texture. A geometry component is usually defined alongside the material component.

Here is an example defining a red material on a box geometry, creating a red cube.

```html
<a-entity geometry="primitive: box" material="color: red"></a-entity>
```

| Attribute    | Description                                                                                                                                    | Default Value |
|--------------|------------------------------------------------------------------------------------------------------------------------------------------------|---------------|
| color        | Base color of the geometry.                                                                                                                    | #fff          |
| envMap       | Environment cubemap texture for reflections. Can be a selector to <a-cubemap> or a comma-separated list of URLs.                             | None          |
| height       | Height of video (in pixels), if defining a video texture.                                                                                      | 360           |
| metalness    | How metallic the material is from `0` to `1`. Does not apply if `shader` is set to `flat`.                                                     | 0.5           |
| opacity      | Extent of transparency. If the `transparent` attribute is not `true`, then the material will remain opaque and `opacity` will only affect color. | 1.0           |
| reflectivity | How reflective the material is from `0` to `1` if the `envMap` attribute is set.                                                               | 1.0           |
| repeat       | How many times a texture (defined by `src`) repeats in the X and Y direction.                                                                  | 1 1           |
| roughness    | How rough the material is from `0` to `1`. A rougher material will scatter reflected light in more directions than a smooth material. Does not apply if `shader` is set to `flat`. | 0.5 |
| transparent  | Whether material is transparent. Transparent entities are rendered after non-transparent entities.                                             | false         |
| shader       | Shading model. Defaults to physically based shading but can also be set to `flat` shading.                                                     | standard      |
| src          | Image or video texture map. Can either be a selector to an `<img>` or `<video>`, or an inline URL.                                             | None          |
| width        | Width of video (in pixels), if defining a video texture.                                                                                       | 640           |

## Defining Textures

To set a texture on the material, specify the `src` attribute. `src` can either be a selector to an `<img>` or `<video>` element:
{'fraction_non_alphanumeric': 0.11551155115511551, 'fraction_numerical': 0.00722929435800723, 'mean_word_length': 1.1017173051519153, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 19, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 69, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1056046', 'n_tokens_mistral': 1231, 'n_tokens_neox': 1160, 'n_words': 618}