Skip to content

Commit 0799ecc

Browse files
committed
Material property cleanup
1 parent 5e7c3aa commit 0799ecc

File tree

4 files changed

+40
-25
lines changed

4 files changed

+40
-25
lines changed

articles/remote-rendering/how-tos/conversion/override-materials.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,7 @@ The full JSON schema for materials files is given here. Except for `unlit` and `
202202
"albedoColor": { "$ref": "#/definitions/colorOrAlpha" },
203203
"roughness": { "type": "number" },
204204
"metalness": { "type": "number" },
205+
"normalMapScale": { "type": "number" },
205206
"transparent": { "type" : "boolean" },
206207
"alphaClipEnabled": { "type" : "boolean" },
207208
"alphaClipThreshold": { "type": "number" },

articles/remote-rendering/overview/features/color-materials.md

Lines changed: 35 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -13,46 +13,56 @@ ms.topic: article
1313

1414
Color materials are more efficient to render than [PBR materials](pbr-materials.md) because of their simpler shading model. They also support different transparency modes.
1515

16-
## Common material properties
16+
## Color material properties
1717

18-
These properties are common to all materials:
18+
The following material properties are exposed in the runtime API, for instance on the [C# ColorMaterial class](/dotnet/api/microsoft.azure.remoterendering.colormaterial) or the [C++ ColorMaterial class](/cpp/api/remote-rendering/colormaterial), respectively.
1919

20-
* **albedoColor:** This color is multiplied with other colors, such as the *albedoMap* or *:::no-loc text="vertex"::: colors*. If *transparency* is enabled on a material, the alpha channel is used to adjust the opacity, with `1` meaning fully opaque and `0` meaning fully transparent. Default is white.
20+
* `ColorFlags`: Misc feature bits can be combined in this bit mask to enable the following features:
21+
* `UseVertexColor`: If the mesh contains :::no-loc text="vertex"::: colors and this option is enabled, the meshes' :::no-loc text="vertex"::: color is multiplied into the `AlbedoColor` and `AlbedoMap`. By default `UseVertexColor` is disabled.
22+
* `DoubleSided`: If double-sidedness is set to true, triangles with this material are rendered even if the camera is looking at their back faces. By default this option is disabled. See also [:::no-loc text="Single-sided"::: rendering](single-sided-rendering.md).
23+
* `AlphaClipped`: Enables hard cut-outs on a per-pixel basis based on the alpha value being below the value of `AlphaClipThreshold` (see below). This works for opaque materials as well.
24+
* `TransparencyWritesDepth`: If the `TransparencyWritesDepth` flag is set on the material and the material is transparent, objects using this material will also contribute to the final depth buffer. See the color material property `ColorTransparencyMode` in the next section. Enabling this feature is recommended if your use case needs a more plausible [late stage reprojection](late-stage-reprojection.md) of fully transparent scenes. For mixed opaque/transparent scenes, this setting may introduce implausible reprojection behavior or reprojection artifacts. For this reason, the default and recommended setting for the general use case is to disable this flag. The written depth values are taken from the per-pixel depth layer of the object that is closest to the camera.
25+
* `FresnelEffect`: This material flag enables the additive [fresnel effect](../../overview/features/fresnel-effect.md) on the respective material. The appearance of the effect is governed by the other fresnel parameters `FresnelEffectColor` and `FresnelEffectExponent` explained below.
26+
* `AlbedoColor`: This color is multiplied with other colors, such as the `AlbedoMap` or *:::no-loc text="vertex"::: colors*. If *transparency* is enabled on a material, the alpha channel is used to adjust the opacity, with `1` meaning fully opaque and `0` meaning fully transparent. The default albedo color is opaque white.
2127

2228
> [!NOTE]
2329
> Since color materials don't reflect the environment, a fully transparent color material becomes invisible. This is different for [PBR materials](pbr-materials.md).
2430
25-
* **albedoMap:** A [2D texture](../../concepts/textures.md) for per-pixel albedo values.
26-
27-
* **alphaClipEnabled** and **alphaClipThreshold:** If *alphaClipEnabled* is true, all pixels where the albedo alpha value is lower than *alphaClipThreshold* won't be drawn. Alpha clipping can be used even without enabling transparency and is much faster to render. Alpha clipped materials are still slower to render than fully opaque materials, though. By default alpha clipping is disabled.
28-
29-
* **textureCoordinateScale** and **textureCoordinateOffset:** The scale is multiplied into the UV texture coordinates, the offset is added to it. Can be used to stretch and shift the textures. The default scale is (1, 1) and offset is (0, 0).
31+
* `AlbedoMap`: A [2D texture](../../concepts/textures.md) for per-pixel albedo values.
3032

31-
* **useVertexColor:** If the mesh contains :::no-loc text="vertex"::: colors and this option is enabled, the meshes' :::no-loc text="vertex"::: color is multiplied into the *albedoColor* and *albedoMap*. By default *useVertexColor* is disabled.
33+
* `AlphaClipThreshold`: If the `AlphaClipped` bit is set on the `ColorFlags` property, all pixels where the albedo alpha value is lower than `AlphaClipThreshold` won't be drawn. Alpha clipping can be used even without enabling transparency and is much faster to render. Alpha clipped materials are still slower to render than fully opaque materials, though. By default alpha clipping is disabled.
3234

33-
* **isDoubleSided:** If double-sidedness is set to true, triangles with this material are rendered even if the camera is looking at their back faces. By default this option is disabled. See also [:::no-loc text="Single-sided"::: rendering](single-sided-rendering.md).
35+
* `TexCoordScale` and `TexCoordOffset`: The scale is multiplied into the UV texture coordinates, the offset is added to it. Can be used to stretch and shift the textures. The default scale is (1, 1) and offset is (0, 0).
3436

35-
* **TransparencyWritesDepth:** If the TransparencyWritesDepth flag is set on the material and the material is transparent, objects using this material will also contribute to the final depth buffer. See the color material property *transparencyMode* in the next section. Enabling this feature is recommended if your use case needs a more plausible [late stage reprojection](late-stage-reprojection.md) of fully transparent scenes. For mixed opaque/transparent scenes, this setting may introduce implausible reprojection behavior or reprojection artifacts. For this reason, the default and recommended setting for the general use case is to disable this flag. The written depth values are taken from the per-pixel depth layer of the object that is closest to the camera.
37+
* `FresnelEffectColor`: The fresnel color used for this material. Only important when the fresnel effect bit has been set on this material (see above). This property controls the base color of the fresnel shine (see [fresnel effect](../../overview/features/fresnel-effect.md) for a full explanation). Currently only the rgb-channel values are important and the alpha value will be ignored.
3638

37-
* **FresnelEffect:** This material flag enables the additive [fresnel effect](../../overview/features/fresnel-effect.md) on the respective material. The appearance of the effect is governed by the other fresnel parameters explained in the following.
39+
* `FresnelEffectExponent`: The fresnel exponent used for this material. Only important when the fresnel effect bit has been set on this material (see above). This property controls the spread of the fresnel shine. The minimum value 0.01 causes a spread across the whole object. The maximum value 10.0 constricts the shine to only the most gracing edges visible.
3840

39-
* **FresnelEffectColor:** The fresnel color used for this material. Only important when the fresnel effect bit has been set on this material (see above). This property controls the base color of the fresnel shine (see [fresnel effect](../../overview/features/fresnel-effect.md) for a full explanation). Currently only the rgb-channel values are important and the alpha value will be ignored.
41+
* `VertexMix`: This value between `0` and `1` specifies how strongly the :::no-loc text="vertex"::: color in a [mesh](../../concepts/meshes.md) contributes to the final color. At the default value of 1, the :::no-loc text="vertex"::: color is multiplied into the albedo color fully. With a value of 0, the :::no-loc text="vertex"::: colors are ignored entirely.
4042

41-
* **FresnelEffectExponent:** The fresnel exponent used for this material. Only important when the fresnel effect bit has been set on this material (see above). This property controls the spread of the fresnel shine. The minimum value 0.01 causes a spread across the whole object. The maximum value 10.0 constricts the shine to only the most gracing edges visible.
42-
43-
## Color material properties
43+
* `ColorTransparencyMode`: Contrary to [PBR materials](pbr-materials.md), color materials distinguish between different transparency modes:
4444

45-
The following properties are specific to color materials:
45+
* `Opaque`: The default mode disables transparency. Alpha clipping is still possible, though, and should be preferred, if sufficient.
46+
* `AlphaBlended`: This mode is similar to the transparency mode for PBR materials. It should be used for see-through materials like glass.
47+
* `Additive`: This mode is the simplest and most efficient transparency mode. The contribution of the material is added to the rendered image. This mode can be used to simulate glowing (but still transparent) objects, such as markers used for highlighting important objects.
4648

47-
* **vertexMix:** This value between `0` and `1` specifies how strongly the :::no-loc text="vertex"::: color in a [mesh](../../concepts/meshes.md) contributes to the final color. At the default value of 1, the :::no-loc text="vertex"::: color is multiplied into the albedo color fully. With a value of 0, the :::no-loc text="vertex"::: colors are ignored entirely.
49+
## Color material overrides during conversion
4850

49-
* **transparencyMode:** Contrary to [PBR materials](pbr-materials.md), color materials distinguish between different transparency modes:
51+
A subset of color material properties can be overridden during model conversion through the [material override file](../../how-tos/conversion/override-materials.md).
52+
The following table shows the mapping between runtime property documented above and the property name in the override file:
5053

51-
1. **Opaque:** The default mode disables transparency. Alpha clipping is still possible, though, and should be preferred, if sufficient.
52-
53-
1. **AlphaBlended:** This mode is similar to the transparency mode for PBR materials. It should be used for see-through materials like glass.
54+
| Material property name | Property name in override file|
55+
|:----------------------------|:---------------------|
56+
| `ColorFlags.AlphaClipped` | `alphaClipEnabled` |
57+
| `ColorFlags.UseVertexColor` | `useVertexColor` |
58+
| `ColorFlags.DoubleSided` | `isDoubleSided` |
59+
| `ColorFlags.TransparencyWritesDepth` | `transparencyWritesDepth` |
60+
| `AlbedoColor` | `albedoColor` |
61+
| `TexCoordScale` | `textureCoordinateScale` |
62+
| `TexCoordOffset` | `textureCoordinateOffset` |
63+
| `ColorTransparencyMode` | `transparent` |
64+
| `AlphaClipThreshold` | `alphaClipThreshold` |
5465

55-
1. **Additive:** This mode is the simplest and most efficient transparency mode. The contribution of the material is added to the rendered image. This mode can be used to simulate glowing (but still transparent) objects, such as markers used for highlighting important objects.
5666

5767
## API documentation
5868

@@ -65,4 +75,5 @@ The following properties are specific to color materials:
6575

6676
* [PBR materials](pbr-materials.md)
6777
* [Textures](../../concepts/textures.md)
68-
* [Meshes](../../concepts/meshes.md)
78+
* [Meshes](../../concepts/meshes.md)
79+
* [Material override files](../../how-tos/conversion/override-materials.md).

articles/remote-rendering/overview/features/pbr-materials.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ PBR stands for **P**hysically **B**ased **R**endering and means that the materia
1717

1818
PBR materials aren't a universal solution, though. There are materials that reflect color differently depending on the viewing angle. For example, some fabrics or car paints. These kinds of materials aren't handled by the standard PBR model, and are currently not supported by Azure Remote Rendering. This limitation includes PBR extensions, such as *Thin-Film* (multi-layered surfaces) and *Clear-Coat* (for car paints).
1919

20+
The following sub-paragraphs list the material properties for PBR materials as exposed in the [material override file](../../how-tos/conversion/override-materials.md#json-schema). For the corresponding property names in the runtime API, refer to the [C# PbrMaterial class](/dotnet/api/microsoft.azure.remoterendering.pbrmaterial) or the [C++ PbrMaterial class](/cpp/api/remote-rendering/pbrmaterial), respectively.
21+
2022
## Common material properties
2123

2224
These properties are common to all materials:
@@ -36,7 +38,7 @@ These properties are common to all materials:
3638

3739
* **isDoubleSided:** If double-sidedness is set to true, triangles with this material are rendered even if the camera is looking at their back faces. For PBR materials lighting is also computed properly for back faces. By default this option is disabled. See also [:::no-loc text="Single-sided"::: rendering](single-sided-rendering.md).
3840

39-
* **TransparencyWritesDepth:** If the TransparencyWritesDepth flag is set on the material and the material is transparent, objects using this material will also contribute to the final depth buffer. See the PBR material flag *transparent* in the next section. Enabling this feature is recommended if your use case needs a more plausible [late stage reprojection](late-stage-reprojection.md) of fully transparent scenes. For mixed opaque/transparent scenes, this setting may introduce implausible reprojection behavior or reprojection artifacts. For this reason, the default and recommended setting for the general use case is to disable this flag. The written depth values are taken from the per-pixel depth layer of the object that is closest to the camera.
41+
* **transparencyWritesDepth:** If the TransparencyWritesDepth flag is set on the material and the material is transparent, objects using this material will also contribute to the final depth buffer. See the PBR material flag *transparent* in the next section. Enabling this feature is recommended if your use case needs a more plausible [late stage reprojection](late-stage-reprojection.md) of fully transparent scenes. For mixed opaque/transparent scenes, this setting may introduce implausible reprojection behavior or reprojection artifacts. For this reason, the default and recommended setting for the general use case is to disable this flag. The written depth values are taken from the per-pixel depth layer of the object that is closest to the camera.
4042

4143
* **FresnelEffect:** This material flag enables the additive [fresnel effect](../../overview/features/fresnel-effect.md) on the respective material. The appearance of the effect is governed by the other fresnel parameters explained in the following.
4244

articles/remote-rendering/reference/material-mapping.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ The following table shows the mapping:
3030
| occlusionFactor | occlusion |
3131
| occlusionTexture | occlusionMap |
3232
| normalTexture | normalMap |
33+
| normalTextureInfo.scale | normalMapScale |
3334
| alphaCutoff | alphaClipThreshold |
3435
| alphaMode.OPAQUE | alphaClipEnabled = false, isTransparent = false |
3536
| alphaMode.MASK | alphaClipEnabled = true, isTransparent = false |

0 commit comments

Comments
 (0)