diff --git a/Models/AnisotropyBarnLamp/README.body.md b/Models/AnisotropyBarnLamp/README.body.md index 62917caa..d5487947 100644 --- a/Models/AnisotropyBarnLamp/README.body.md +++ b/Models/AnisotropyBarnLamp/README.body.md @@ -49,9 +49,9 @@ The anisotropy rotation is varied across the model using an `anisotropyTexture`. ![A diagram to explain anisotropy colors.](screenshot/anisotropy_Diagram.jpg) (above) A diagram to show which colors to use in the `anisotropyTexture` to get specific results on different parts of the model. -* Ellipses show the colors which will stretch reflections in various directions. +* Ellipses show which colors will stretch reflections in various directions. * Arrows indicate directions of microgrooves or hairs (perpendicular to anisotropy). -* Circle at bottom right is the color to use for zero anisotropy (black in the blue channel). Gray has been used in the red and green channels for this area, but this is not strictly necessary since zero blue completely disables anisotropy. +* Circle at bottom right is in front of the color to use for zero anisotropy (black in the blue channel). Yellowish green has been used in this area (0.5,1,0); more information on this choice below. There is a close correlation between the texture coordinates and the `anisotropyRotation`, because surface tangents are calculated from the UVs and the surface normals of the model. This is explained in a video from Babylon.js [Unraveling Advanced Anisotropic Reflections](https://www.youtube.com/watch?v=Zk0A5UzNLNw). @@ -65,21 +65,31 @@ The parts with vertical UV strips are assigned a pink color to stretch the aniso (above) The affect of each color channel in the `anisotropyTexture`. Left to right: the full anisotropy texture, filling the red channel with black, filling the green channel with black, filling the blue channel with black. -Both the red and green channels are needed for well-shaped anisotropic reflections. The blue channel can be used to disable anisotropy where micro-grooves are not prominent on the surface. When a bump texture is in use with anisotropy, high frequency bump details may need to have anisotropy disabled to achieve better bump lighting results. In this asset, the raised text and knurled grips have been assigned a greenish-yellow color to disable anisotropy. +Both the red and green channels are needed for well-shaped anisotropic reflections. The blue channel can be used to disable anisotropy where micro-grooves are not prominent on the surface. + +When a bump texture is in use with anisotropy, high frequency bump details may need to have anisotropy disabled to achieve better bump lighting results. In this asset, the raised text and knurled grips use black in the blue channel to disable anisotropy. ## Normalizing Anisotropy -A well-formed `anisotropyTexture` needs to be normalized to ensure proper lighting. Each pixel creates a directional vector whose unit length must be one. Without this, anisotropy is likely to yield incorrect results. +A well-formed `anisotropyTexture` needs to be normalized to ensure proper lighting. Each pixel creates a directional 2D vector whose unit length must be one. Without this, anisotropy is likely to yield incorrect results. When normalizing an `anisotropyTexture`, the blue channel should be omitted from normalization because it is used for `anisotropyStrength` not rotation. -![Screenshot of a normalization graph in Substance 3D Designer.](screenshot/anisotropy_Normalize.jpg) +![Screenshot of a normalization graph in Substance 3D Designer.](screenshot/anisotropy_NormalizeGraph.jpg) (above) Adobe Substance 3D Designer can be setup to ignore the blue channel `anisotropyStrength` during normalization, and add it back in afterwards. This graph can be downloaded as a SBSAR file: [Substance_NormalizeRG.zip](screenshot/Substance_NormalizeRG.zip). This is a Substance 3D Asset which can be used to normalize anisotropy textures with [Adobe Substance Player](https://helpx.adobe.com/substance-3d-player/home.html) and other [applications which support SBSAR](https://helpx.adobe.com/substance-3d-integrations/home.html). +When assigning zero anisotropy to high-frequency details like text, it is best to set the red and green channels of the anisotropy texture to the same color as the surrounding area. This can help avoid normalization artifacts where values produce NaNs from divide-by-zero errors, as shown in the bottom example. + +Keeping high-frequency values in the blue channel and using homogenous colors in the red and green channels will produce a cleaner texture, which ultimately compresses better and makes a smaller asset size. + +![Diagram comparing source textures and normalized textures.](screenshot/anisotropy_NormalizedColors.jpg) + +(Above) High frequency details in the blue channel should be paired with homogenous colors in the red and green channels to avoid normalization artifacts. + ## KTX2 BasisU Textures diff --git a/Models/AnisotropyBarnLamp/README.md b/Models/AnisotropyBarnLamp/README.md index 46f9e89d..bbd16958 100644 --- a/Models/AnisotropyBarnLamp/README.md +++ b/Models/AnisotropyBarnLamp/README.md @@ -65,9 +65,9 @@ The anisotropy rotation is varied across the model using an `anisotropyTexture`. ![A diagram to explain anisotropy colors.](screenshot/anisotropy_Diagram.jpg) (above) A diagram to show which colors to use in the `anisotropyTexture` to get specific results on different parts of the model. -* Ellipses show the colors which will stretch reflections in various directions. +* Ellipses show which colors will stretch reflections in various directions. * Arrows indicate directions of microgrooves or hairs (perpendicular to anisotropy). -* Circle at bottom right is the color to use for zero anisotropy (black in the blue channel). Gray has been used in the red and green channels for this area, but this is not strictly necessary since zero blue completely disables anisotropy. +* Circle at bottom right is in front of the color to use for zero anisotropy (black in the blue channel). Yellowish green has been used in this area (0.5,1,0); more information on this choice below. There is a close correlation between the texture coordinates and the `anisotropyRotation`, because surface tangents are calculated from the UVs and the surface normals of the model. This is explained in a video from Babylon.js [Unraveling Advanced Anisotropic Reflections](https://www.youtube.com/watch?v=Zk0A5UzNLNw). @@ -81,21 +81,31 @@ The parts with vertical UV strips are assigned a pink color to stretch the aniso (above) The affect of each color channel in the `anisotropyTexture`. Left to right: the full anisotropy texture, filling the red channel with black, filling the green channel with black, filling the blue channel with black. -Both the red and green channels are needed for well-shaped anisotropic reflections. The blue channel can be used to disable anisotropy where micro-grooves are not prominent on the surface. When a bump texture is in use with anisotropy, high frequency bump details may need to have anisotropy disabled to achieve better bump lighting results. In this asset, the raised text and knurled grips have been assigned a greenish-yellow color to disable anisotropy. +Both the red and green channels are needed for well-shaped anisotropic reflections. The blue channel can be used to disable anisotropy where micro-grooves are not prominent on the surface. + +When a bump texture is in use with anisotropy, high frequency bump details may need to have anisotropy disabled to achieve better bump lighting results. In this asset, the raised text and knurled grips use black in the blue channel to disable anisotropy. ## Normalizing Anisotropy -A well-formed `anisotropyTexture` needs to be normalized to ensure proper lighting. Each pixel creates a directional vector whose unit length must be one. Without this, anisotropy is likely to yield incorrect results. +A well-formed `anisotropyTexture` needs to be normalized to ensure proper lighting. Each pixel creates a directional 2D vector whose unit length must be one. Without this, anisotropy is likely to yield incorrect results. When normalizing an `anisotropyTexture`, the blue channel should be omitted from normalization because it is used for `anisotropyStrength` not rotation. -![Screenshot of a normalization graph in Substance 3D Designer.](screenshot/anisotropy_Normalize.jpg) +![Screenshot of a normalization graph in Substance 3D Designer.](screenshot/anisotropy_NormalizeGraph.jpg) (above) Adobe Substance 3D Designer can be setup to ignore the blue channel `anisotropyStrength` during normalization, and add it back in afterwards. This graph can be downloaded as a SBSAR file: [Substance_NormalizeRG.zip](screenshot/Substance_NormalizeRG.zip). This is a Substance 3D Asset which can be used to normalize anisotropy textures with [Adobe Substance Player](https://helpx.adobe.com/substance-3d-player/home.html) and other [applications which support SBSAR](https://helpx.adobe.com/substance-3d-integrations/home.html). +When assigning zero anisotropy to high-frequency details like text, it is best to set the red and green channels of the anisotropy texture to the same color as the surrounding area. This can help avoid normalization artifacts where values produce NaNs from divide-by-zero errors, as shown in the bottom example. + +Keeping high-frequency values in the blue channel and using homogenous colors in the red and green channels will produce a cleaner texture, which ultimately compresses better and makes a smaller asset size. + +![Diagram comparing source textures and normalized textures.](screenshot/anisotropy_NormalizedColors.jpg) + +(Above) High frequency details in the blue channel should be paired with homogenous colors in the red and green channels to avoid normalization artifacts. + ## KTX2 BasisU Textures diff --git a/Models/AnisotropyBarnLamp/glTF-Binary/AnisotropyBarnLamp.glb b/Models/AnisotropyBarnLamp/glTF-Binary/AnisotropyBarnLamp.glb index f51a1f07..9aba98dc 100644 Binary files a/Models/AnisotropyBarnLamp/glTF-Binary/AnisotropyBarnLamp.glb and b/Models/AnisotropyBarnLamp/glTF-Binary/AnisotropyBarnLamp.glb differ diff --git a/Models/AnisotropyBarnLamp/glTF-KTX2-Basisu/AnisotropyBarnLamp.bin b/Models/AnisotropyBarnLamp/glTF-KTX-BasisU/AnisotropyBarnLamp.bin similarity index 100% rename from Models/AnisotropyBarnLamp/glTF-KTX2-Basisu/AnisotropyBarnLamp.bin rename to Models/AnisotropyBarnLamp/glTF-KTX-BasisU/AnisotropyBarnLamp.bin diff --git a/Models/AnisotropyBarnLamp/glTF-KTX2-Basisu/AnisotropyBarnLamp.gltf b/Models/AnisotropyBarnLamp/glTF-KTX-BasisU/AnisotropyBarnLamp.gltf similarity index 100% rename from Models/AnisotropyBarnLamp/glTF-KTX2-Basisu/AnisotropyBarnLamp.gltf rename to Models/AnisotropyBarnLamp/glTF-KTX-BasisU/AnisotropyBarnLamp.gltf diff --git a/Models/AnisotropyBarnLamp/glTF-KTX-BasisU/AnisotropyBarnLamp_anisotropy.ktx2 b/Models/AnisotropyBarnLamp/glTF-KTX-BasisU/AnisotropyBarnLamp_anisotropy.ktx2 new file mode 100644 index 00000000..8ee2486f Binary files /dev/null and b/Models/AnisotropyBarnLamp/glTF-KTX-BasisU/AnisotropyBarnLamp_anisotropy.ktx2 differ diff --git a/Models/AnisotropyBarnLamp/glTF-KTX2-Basisu/AnisotropyBarnLamp_basecolor.ktx2 b/Models/AnisotropyBarnLamp/glTF-KTX-BasisU/AnisotropyBarnLamp_basecolor.ktx2 similarity index 100% rename from Models/AnisotropyBarnLamp/glTF-KTX2-Basisu/AnisotropyBarnLamp_basecolor.ktx2 rename to Models/AnisotropyBarnLamp/glTF-KTX-BasisU/AnisotropyBarnLamp_basecolor.ktx2 diff --git a/Models/AnisotropyBarnLamp/glTF-KTX2-Basisu/AnisotropyBarnLamp_normalbump.ktx2 b/Models/AnisotropyBarnLamp/glTF-KTX-BasisU/AnisotropyBarnLamp_normalbump.ktx2 similarity index 100% rename from Models/AnisotropyBarnLamp/glTF-KTX2-Basisu/AnisotropyBarnLamp_normalbump.ktx2 rename to Models/AnisotropyBarnLamp/glTF-KTX-BasisU/AnisotropyBarnLamp_normalbump.ktx2 diff --git a/Models/AnisotropyBarnLamp/glTF-KTX2-Basisu/AnisotropyBarnLamp_occlusionroughnessmetal.ktx2 b/Models/AnisotropyBarnLamp/glTF-KTX-BasisU/AnisotropyBarnLamp_occlusionroughnessmetal.ktx2 similarity index 100% rename from Models/AnisotropyBarnLamp/glTF-KTX2-Basisu/AnisotropyBarnLamp_occlusionroughnessmetal.ktx2 rename to Models/AnisotropyBarnLamp/glTF-KTX-BasisU/AnisotropyBarnLamp_occlusionroughnessmetal.ktx2 diff --git a/Models/AnisotropyBarnLamp/glTF-KTX2-Basisu/AnisotropyBarnLamp_anisotropy.ktx2 b/Models/AnisotropyBarnLamp/glTF-KTX2-Basisu/AnisotropyBarnLamp_anisotropy.ktx2 index 8ee2486f..3614ae89 100644 Binary files a/Models/AnisotropyBarnLamp/glTF-KTX2-Basisu/AnisotropyBarnLamp_anisotropy.ktx2 and b/Models/AnisotropyBarnLamp/glTF-KTX2-Basisu/AnisotropyBarnLamp_anisotropy.ktx2 differ diff --git a/Models/AnisotropyBarnLamp/glTF/AnisotropyBarnLamp_anisotropy.png b/Models/AnisotropyBarnLamp/glTF/AnisotropyBarnLamp_anisotropy.png index 3d3a52a7..4bc550fa 100644 Binary files a/Models/AnisotropyBarnLamp/glTF/AnisotropyBarnLamp_anisotropy.png and b/Models/AnisotropyBarnLamp/glTF/AnisotropyBarnLamp_anisotropy.png differ diff --git a/Models/AnisotropyBarnLamp/screenshot/Normalize_RG.sbsar b/Models/AnisotropyBarnLamp/screenshot/Normalize_RG.sbsar new file mode 100644 index 00000000..d2214e4f Binary files /dev/null and b/Models/AnisotropyBarnLamp/screenshot/Normalize_RG.sbsar differ diff --git a/Models/AnisotropyBarnLamp/screenshot/Substance_NormalizeRG.zip b/Models/AnisotropyBarnLamp/screenshot/Substance_NormalizeRG.zip index 33e742ae..96434eea 100644 Binary files a/Models/AnisotropyBarnLamp/screenshot/Substance_NormalizeRG.zip and b/Models/AnisotropyBarnLamp/screenshot/Substance_NormalizeRG.zip differ diff --git a/Models/AnisotropyBarnLamp/screenshot/anisotropy_Channels.jpg b/Models/AnisotropyBarnLamp/screenshot/anisotropy_Channels.jpg index 892ef492..eb5b3ecf 100644 Binary files a/Models/AnisotropyBarnLamp/screenshot/anisotropy_Channels.jpg and b/Models/AnisotropyBarnLamp/screenshot/anisotropy_Channels.jpg differ diff --git a/Models/AnisotropyBarnLamp/screenshot/anisotropy_Diagram.jpg b/Models/AnisotropyBarnLamp/screenshot/anisotropy_Diagram.jpg index 873a5c06..724dec42 100644 Binary files a/Models/AnisotropyBarnLamp/screenshot/anisotropy_Diagram.jpg and b/Models/AnisotropyBarnLamp/screenshot/anisotropy_Diagram.jpg differ diff --git a/Models/AnisotropyBarnLamp/screenshot/anisotropy_NormalizeGraph.jpg b/Models/AnisotropyBarnLamp/screenshot/anisotropy_NormalizeGraph.jpg new file mode 100644 index 00000000..4d14266f Binary files /dev/null and b/Models/AnisotropyBarnLamp/screenshot/anisotropy_NormalizeGraph.jpg differ diff --git a/Models/AnisotropyBarnLamp/screenshot/anisotropy_NormalizedColors.jpg b/Models/AnisotropyBarnLamp/screenshot/anisotropy_NormalizedColors.jpg new file mode 100644 index 00000000..476bfcb9 Binary files /dev/null and b/Models/AnisotropyBarnLamp/screenshot/anisotropy_NormalizedColors.jpg differ diff --git a/Models/AnisotropyBarnLamp/screenshot/anisotropy_RemovingChannels.jpg b/Models/AnisotropyBarnLamp/screenshot/anisotropy_RemovingChannels.jpg index 14b3d919..adda0dab 100644 Binary files a/Models/AnisotropyBarnLamp/screenshot/anisotropy_RemovingChannels.jpg and b/Models/AnisotropyBarnLamp/screenshot/anisotropy_RemovingChannels.jpg differ diff --git a/Models/AnisotropyBarnLamp/screenshot/anisotropy_TextureCoordinates.jpg b/Models/AnisotropyBarnLamp/screenshot/anisotropy_TextureCoordinates.jpg index 0160885c..9e3e98c3 100644 Binary files a/Models/AnisotropyBarnLamp/screenshot/anisotropy_TextureCoordinates.jpg and b/Models/AnisotropyBarnLamp/screenshot/anisotropy_TextureCoordinates.jpg differ diff --git a/Models/AnisotropyBarnLamp/screenshot/anisotropy_Textures.jpg b/Models/AnisotropyBarnLamp/screenshot/anisotropy_Textures.jpg index d859336c..fac9457c 100644 Binary files a/Models/AnisotropyBarnLamp/screenshot/anisotropy_Textures.jpg and b/Models/AnisotropyBarnLamp/screenshot/anisotropy_Textures.jpg differ