Merge pull request #2597 from tsgcpp/feautere/use_emissiveStrength_in_MToon10

Fix to multiply _EmissionColor by emissiveStrength in MToon10
This commit is contained in:
ousttrue 2025-03-04 18:59:39 +09:00 committed by GitHub
commit 7158deefc7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 9 additions and 6 deletions

View File

@ -36,7 +36,7 @@ namespace UniVRM10
null,
Vrm10MToonTextureImporter.EnumerateAllTextures(data, m, mtoon).ToDictionary(tuple => tuple.key, tuple => tuple.Item2.Item2),
TryGetAllFloats(m, mtoon).ToDictionary(tuple => tuple.key, tuple => tuple.value),
TryGetAllColors(m, mtoon).ToDictionary(tuple => tuple.key, tuple => tuple.value),
TryGetAllColors(data, m, mtoon).ToDictionary(tuple => tuple.key, tuple => tuple.value),
TryGetAllFloatArrays(m, mtoon).ToDictionary(tuple => tuple.key, tuple => tuple.value),
new Action<Material>[]
{
@ -50,7 +50,7 @@ namespace UniVRM10
return true;
}
public static IEnumerable<(string key, Color value)> TryGetAllColors(glTFMaterial material, VRMC_materials_mtoon mToon)
public static IEnumerable<(string key, Color value)> TryGetAllColors(GltfData data, glTFMaterial material, VRMC_materials_mtoon mToon)
{
const ColorSpace gltfColorSpace = ColorSpace.Linear;
@ -72,10 +72,13 @@ namespace UniVRM10
// Emission
// Emissive factor should be stored in Linear space
var emissionColor = material?.emissiveFactor?.ToColor3(gltfColorSpace, ColorSpace.Linear);
if (emissionColor.HasValue)
if (material != null)
{
yield return (MToon10Prop.EmissiveFactor.ToUnityShaderLabName(), emissionColor.Value);
var emissionColor = GltfMaterialImportUtils.ImportLinearEmissiveFactor(data, material);
if (emissionColor.HasValue)
{
yield return (MToon10Prop.EmissiveFactor.ToUnityShaderLabName(), emissionColor.Value);
}
}
// Matcap

View File

@ -31,7 +31,7 @@ namespace UniVRM10
null,
Vrm10MToonTextureImporter.EnumerateAllTextures(data, m, mtoon).ToDictionary(tuple => tuple.key, tuple => tuple.Item2.Item2),
BuiltInVrm10MToonMaterialImporter.TryGetAllFloats(m, mtoon).ToDictionary(tuple => tuple.key, tuple => tuple.value),
BuiltInVrm10MToonMaterialImporter.TryGetAllColors(m, mtoon).ToDictionary(tuple => tuple.key, tuple => tuple.value),
BuiltInVrm10MToonMaterialImporter.TryGetAllColors(data, m, mtoon).ToDictionary(tuple => tuple.key, tuple => tuple.value),
BuiltInVrm10MToonMaterialImporter.TryGetAllFloatArrays(m, mtoon).ToDictionary(tuple => tuple.key, tuple => tuple.value),
new Action<Material>[]
{