Skip to content

Commit

Permalink
Fixed colors by converting them from glTF's linear space into sRGB(ga…
Browse files Browse the repository at this point in the history
…mma) space for Unity's material

Preparing changelog
  • Loading branch information
atteneder committed Apr 29, 2020
1 parent ed229c8 commit 6eeca08
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
9 changes: 4 additions & 5 deletions ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,15 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]
## [1.0.1] - 2020-04-29
### Added
- Abstract interface `IDownloadProvider` let's users implement custom download behavior (useful for authentification or caching)

## [1.0.1] - 2020-04-19
### Changed
- Removed support for obsolete draft extensions `KHR_texture_cttf` and `KHR_image_ktx2`
### Fixed
- Correct (brighter) colors due to color-space conversion (conversion from linear to gamma before applying to material)
- Correct shading in linear color space projects due to correct (linear) sampling of normal, occlusion and metallic-roughness maps
- Memory leak: free up volatile array `imageFormats`
### Changed
- Removed support for obsolete draft extensions `KHR_texture_cttf` and `KHR_image_ktx2`

## [1.0.0] - 2020-03-13
### Changed
Expand Down
6 changes: 3 additions & 3 deletions Runtime/Scripts/DefaultMaterialGenerator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ ref Dictionary<int,Texture2D>[] imageVariants
if (gltfMaterial.extensions != null) {
Schema.PbrSpecularGlossiness specGloss = gltfMaterial.extensions.KHR_materials_pbrSpecularGlossiness;
if (specGloss != null) {
material.color = specGloss.diffuseColor;
material.color = specGloss.diffuseColor.gamma;
material.SetVector(StandardShaderHelper.specColorPropId, specGloss.specularColor);
material.SetFloat(StandardShaderHelper.glossinessPropId,specGloss.glossinessFactor);

Expand All @@ -102,7 +102,7 @@ ref Dictionary<int,Texture2D>[] imageVariants
}

if (gltfMaterial.pbrMetallicRoughness!=null) {
material.color = gltfMaterial.pbrMetallicRoughness.baseColor;
material.color = gltfMaterial.pbrMetallicRoughness.baseColor.gamma;
material.SetFloat(StandardShaderHelper.metallicPropId, gltfMaterial.pbrMetallicRoughness.metallicFactor );
material.SetFloat(StandardShaderHelper.roughnessPropId, gltfMaterial.pbrMetallicRoughness.roughnessFactor );

Expand Down Expand Up @@ -142,7 +142,7 @@ ref imageVariants
}

if(gltfMaterial.emissive != Color.black) {
material.SetColor("_EmissionColor", gltfMaterial.emissive);
material.SetColor("_EmissionColor", gltfMaterial.emissive.gamma);
material.EnableKeyword(StandardShaderHelper.KW_EMISSION);
}

Expand Down

0 comments on commit 6eeca08

Please sign in to comment.