-
Notifications
You must be signed in to change notification settings - Fork 45
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #825 from cx20/add_gltf_sample_model
Added glTF Sample model
- Loading branch information
Showing
16 changed files
with
1,183 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
## Screenshot | ||
|
||
 | ||
|
||
## Description | ||
|
||
This model tests what happens when vertex colors contain alpha values and a material uses `alphaCutoff`. The above screenshot shows what this model looks like when the test passes. | ||
|
||
## Common Problems | ||
|
||
### Problem: Noisy alpha clipping | ||
|
||
 | ||
|
||
The two middle cubes (yellow and green) show a lot of fragment noise in the above screenshot. Here's a zoomed-in view to show detail on the green cube: | ||
|
||
 | ||
|
||
The exact reason this noise is present can vary by rendering engine implementation, platform, and GPU in use. It's possible that discarding masked fragments too early in a shader (prior to gradients and texture lookup usage) may be a contributing factor in some implementations. | ||
|
||
### Problem: No alpha mask | ||
|
||
 | ||
|
||
The above screenshot shows a renderer that is not doing any alpha masking against vertex color alpha values. In this case, a large red "X" appears over the left-most sample that is intended to be left blank. This indicates a test failure. | ||
|
||
### Problem: Incorrect alpha comparison | ||
|
||
 | ||
|
||
In the above screenshot, the two middle cubes are missing, indicating that when the alpha value exactly matches the `alphaCutoff`, the result is clipped. | ||
|
||
The glTF specification [Alpha Coverage section](https://registry.khronos.org/glTF/specs/2.0/glTF-2.0.html#alpha-coverage) has this to say: | ||
|
||
> When `alphaMode` is set to `MASK` the `alphaCutoff` property specifies the cutoff threshold. If the alpha value is greater than or equal to the `alphaCutoff` value then it is rendered as fully opaque, otherwise, it is rendered as fully transparent. | ||
The specification makes special mention of the equality case presented here by the two middle cubes in yellow and green. They should be rendered fully opaque. So a rendering similar to the above screenshot with the missing middle cubes is a test failure. | ||
|
||
## Label Text | ||
|
||
In case the text on the labels is hard to read or needs translation, it is reproduced below: | ||
|
||
### Far left sample | ||
|
||
``` | ||
THIS SPACE INTENTIONALLY LEFT BLANK | ||
There should not be an X here. | ||
``` | ||
|
||
``` | ||
Blank space | ||
COLOR_0.a = 0.48 | ||
alphaCutoff = 0.5 | ||
(less than) | ||
``` | ||
|
||
### Second sample, yellow box | ||
|
||
``` | ||
Solid Box | ||
COLOR_0.a = 0.5 | ||
alphaCutoff = 0.5 | ||
(equal) | ||
``` | ||
|
||
### Third sample, green box | ||
|
||
``` | ||
Solid Box | ||
COLOR_0.a = 1.0 | ||
alphaCutoff = 1.0 | ||
(equal) | ||
``` | ||
|
||
### Far right sample, blue box | ||
|
||
``` | ||
Solid Box | ||
COLOR_0.a = 0.51 | ||
alphaCutoff = 0.5 | ||
(greater than) | ||
``` | ||
|
Binary file added
BIN
+99.6 KB
tutorialModels/VertexColorAlphaClipTest/glTF-Binary/VertexColorAlphaClipTest.glb
Binary file not shown.
Binary file added
BIN
+18.4 KB
tutorialModels/VertexColorAlphaClipTest/glTF/IntentionallyLeftBlank.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+30.5 KB
tutorialModels/VertexColorAlphaClipTest/glTF/VertexColorAlphaClipLabels_v2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+39.4 KB
tutorialModels/VertexColorAlphaClipTest/glTF/VertexColorAlphaClipTest.bin
Binary file not shown.
Oops, something went wrong.