From 0bc56bcb5a3d8df614153926ad5a71acd8d4fd89 Mon Sep 17 00:00:00 2001 From: ousttrue Date: Wed, 5 Feb 2025 18:41:26 +0900 Subject: [PATCH] fix MetallicRoughness --- .../VRM10Viewer/Assets/TinyPbr.shadergraph | 28 ++-- .../VRM10Viewer/Assets/black.png | Bin 0 -> 68 bytes .../VRM10Viewer/Assets/black.png.meta | 127 ++++++++++++++++++ .../VRM10_Samples/VRM10Viewer/Assets/blue.png | Bin 0 -> 79 bytes .../VRM10Viewer/Assets/blue.png.meta | 127 ++++++++++++++++++ .../VRM10_Samples/VRM10Viewer/Assets/red.png | Bin 0 -> 79 bytes .../VRM10Viewer/Assets/red.png.meta | 127 ++++++++++++++++++ .../VRM10Viewer/Assets/white.png | Bin 0 -> 79 bytes .../VRM10Viewer/Assets/white.png.meta | 127 ++++++++++++++++++ .../TinyPbrMaterialDescriptorGenerator.cs | 14 +- 10 files changed, 531 insertions(+), 19 deletions(-) create mode 100644 Assets/VRM10_Samples/VRM10Viewer/Assets/black.png create mode 100644 Assets/VRM10_Samples/VRM10Viewer/Assets/black.png.meta create mode 100644 Assets/VRM10_Samples/VRM10Viewer/Assets/blue.png create mode 100644 Assets/VRM10_Samples/VRM10Viewer/Assets/blue.png.meta create mode 100644 Assets/VRM10_Samples/VRM10Viewer/Assets/red.png create mode 100644 Assets/VRM10_Samples/VRM10Viewer/Assets/red.png.meta create mode 100644 Assets/VRM10_Samples/VRM10Viewer/Assets/white.png create mode 100644 Assets/VRM10_Samples/VRM10Viewer/Assets/white.png.meta diff --git a/Assets/VRM10_Samples/VRM10Viewer/Assets/TinyPbr.shadergraph b/Assets/VRM10_Samples/VRM10Viewer/Assets/TinyPbr.shadergraph index 808e1111a..2eb3b1c4d 100644 --- a/Assets/VRM10_Samples/VRM10Viewer/Assets/TinyPbr.shadergraph +++ b/Assets/VRM10_Samples/VRM10Viewer/Assets/TinyPbr.shadergraph @@ -966,7 +966,7 @@ "overrideHLSLDeclaration": false, "hlslDeclarationOverride": 0, "m_Hidden": false, - "m_Value": 1.0, + "m_Value": 0.0, "m_FloatType": 0, "m_RangeValues": { "x": 0.0, @@ -1786,7 +1786,7 @@ "hlslDeclarationOverride": 0, "m_Hidden": false, "m_Value": { - "m_SerializedTexture": "", + "m_SerializedTexture": "{\"texture\":{\"fileID\":2800000,\"guid\":\"51ce5cf2de6d788449c2fdd4b8488a92\",\"type\":3}}", "m_Guid": "" }, "isMainTexture": false, @@ -2317,10 +2317,10 @@ "m_Expanded": true, "m_Position": { "serializedVersion": "2", - "x": -178.66664123535157, - "y": 498.0000305175781, - "width": 127.33338928222656, - "height": 119.99990844726563 + "x": -324.66668701171877, + "y": 508.00006103515627, + "width": 209.33328247070313, + "height": 303.99993896484377 } }, "m_Slots": [ @@ -2341,7 +2341,7 @@ "take away" ], "m_Precision": 0, - "m_PreviewExpanded": false, + "m_PreviewExpanded": true, "m_DismissedVersion": 0, "m_PreviewMode": 0, "m_CustomColors": { @@ -2383,7 +2383,7 @@ "hlslDeclarationOverride": 0, "m_Hidden": false, "m_Value": { - "m_SerializedTexture": "", + "m_SerializedTexture": "{\"texture\":{\"fileID\":2800000,\"guid\":\"3ab316f1cf207684abb754d9a2731c66\",\"type\":3}}", "m_Guid": "" }, "isMainTexture": true, @@ -2669,10 +2669,10 @@ "m_Expanded": true, "m_Position": { "serializedVersion": "2", - "x": -414.6666564941406, - "y": 530.6666259765625, - "width": 209.3333282470703, - "height": 304.0 + "x": -530.0000610351563, + "y": 546.0000610351563, + "width": 127.3333740234375, + "height": 120.0 } }, "m_Slots": [ @@ -2692,7 +2692,7 @@ "x" ], "m_Precision": 0, - "m_PreviewExpanded": true, + "m_PreviewExpanded": false, "m_DismissedVersion": 0, "m_PreviewMode": 0, "m_CustomColors": { @@ -2749,7 +2749,7 @@ "hlslDeclarationOverride": 0, "m_Hidden": false, "m_Value": { - "m_SerializedTexture": "", + "m_SerializedTexture": "{\"texture\":{\"fileID\":2800000,\"guid\":\"909670d47b2f55d4a991788acca59d7e\",\"type\":3}}", "m_Guid": "" }, "isMainTexture": false, diff --git a/Assets/VRM10_Samples/VRM10Viewer/Assets/black.png b/Assets/VRM10_Samples/VRM10Viewer/Assets/black.png new file mode 100644 index 0000000000000000000000000000000000000000..aa8727af7477c12b66881bfabe91216f9e0abd42 GIT binary patch literal 68 zcmeAS@N?(olHy`uVBq!ia0vp^Od!kwBL7~QRScxKJzX3_IIbrrIIuA=@G&qNzPu|6 P6lU;r^>bP0l+XkKoE;79 literal 0 HcmV?d00001 diff --git a/Assets/VRM10_Samples/VRM10Viewer/Assets/black.png.meta b/Assets/VRM10_Samples/VRM10Viewer/Assets/black.png.meta new file mode 100644 index 000000000..37047a83e --- /dev/null +++ b/Assets/VRM10_Samples/VRM10Viewer/Assets/black.png.meta @@ -0,0 +1,127 @@ +fileFormatVersion: 2 +guid: d8c7685da35f7994799534cbc1acce4a +TextureImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 13 + mipmaps: + mipMapMode: 0 + enableMipMap: 1 + sRGBTexture: 1 + linearTexture: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapsPreserveCoverage: 0 + alphaTestReferenceValue: 0.5 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + flipGreenChannel: 0 + isReadable: 0 + streamingMipmaps: 0 + streamingMipmapsPriority: 0 + vTOnly: 0 + ignoreMipmapLimit: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + serializedVersion: 2 + filterMode: 1 + aniso: 1 + mipBias: 0 + wrapU: 0 + wrapV: 0 + wrapW: 0 + nPOTScale: 1 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spritePixelsToUnits: 100 + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spriteGenerateFallbackPhysicsShape: 1 + alphaUsage: 1 + alphaIsTransparency: 0 + spriteTessellationDetail: -1 + textureType: 0 + textureShape: 1 + singleChannelComponent: 0 + flipbookRows: 1 + flipbookColumns: 1 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + ignorePngGamma: 0 + applyGammaDecoding: 0 + swizzle: 50462976 + cookieLightType: 0 + platformSettings: + - serializedVersion: 3 + buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 3 + buildTarget: Standalone + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 3 + buildTarget: WebGL + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + physicsShape: [] + bones: [] + spriteID: + internalID: 0 + vertices: [] + indices: + edges: [] + weights: [] + secondaryTextures: [] + nameFileIdTable: {} + mipmapLimitGroupName: + pSDRemoveMatte: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/VRM10_Samples/VRM10Viewer/Assets/blue.png b/Assets/VRM10_Samples/VRM10Viewer/Assets/blue.png new file mode 100644 index 0000000000000000000000000000000000000000..35cd4570f0705db3aa3258f52758ae66ceaa7419 GIT binary patch literal 79 zcmeAS@N?(olHy`uVBq!ia0vp^Od!kwBL7~QRScxWJY5_^IIbtBB>Xsk;J|?+Kz!f; a0|U1_BlFF5tKxww7(8A5T-G@yGywqqeiuUk literal 0 HcmV?d00001 diff --git a/Assets/VRM10_Samples/VRM10Viewer/Assets/blue.png.meta b/Assets/VRM10_Samples/VRM10Viewer/Assets/blue.png.meta new file mode 100644 index 000000000..78c97a508 --- /dev/null +++ b/Assets/VRM10_Samples/VRM10Viewer/Assets/blue.png.meta @@ -0,0 +1,127 @@ +fileFormatVersion: 2 +guid: 909670d47b2f55d4a991788acca59d7e +TextureImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 13 + mipmaps: + mipMapMode: 0 + enableMipMap: 1 + sRGBTexture: 1 + linearTexture: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapsPreserveCoverage: 0 + alphaTestReferenceValue: 0.5 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + flipGreenChannel: 0 + isReadable: 0 + streamingMipmaps: 0 + streamingMipmapsPriority: 0 + vTOnly: 0 + ignoreMipmapLimit: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + serializedVersion: 2 + filterMode: 1 + aniso: 1 + mipBias: 0 + wrapU: 0 + wrapV: 0 + wrapW: 0 + nPOTScale: 1 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spritePixelsToUnits: 100 + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spriteGenerateFallbackPhysicsShape: 1 + alphaUsage: 1 + alphaIsTransparency: 0 + spriteTessellationDetail: -1 + textureType: 0 + textureShape: 1 + singleChannelComponent: 0 + flipbookRows: 1 + flipbookColumns: 1 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + ignorePngGamma: 0 + applyGammaDecoding: 0 + swizzle: 50462976 + cookieLightType: 0 + platformSettings: + - serializedVersion: 3 + buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 3 + buildTarget: Standalone + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 3 + buildTarget: WebGL + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + physicsShape: [] + bones: [] + spriteID: + internalID: 0 + vertices: [] + indices: + edges: [] + weights: [] + secondaryTextures: [] + nameFileIdTable: {} + mipmapLimitGroupName: + pSDRemoveMatte: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/VRM10_Samples/VRM10Viewer/Assets/red.png b/Assets/VRM10_Samples/VRM10Viewer/Assets/red.png new file mode 100644 index 0000000000000000000000000000000000000000..b90efb932a03fd2d0251dfcd544cd5a93a018845 GIT binary patch literal 79 zcmeAS@N?(olHy`uVBq!ia0vp^Od!kwBL7~QRScxWJY5_^IIbuEIe!2Ij(|y^dRazh U?U&0=097z}y85}Sb4q9e02Z$o^#A|> literal 0 HcmV?d00001 diff --git a/Assets/VRM10_Samples/VRM10Viewer/Assets/red.png.meta b/Assets/VRM10_Samples/VRM10Viewer/Assets/red.png.meta new file mode 100644 index 000000000..21e77cd47 --- /dev/null +++ b/Assets/VRM10_Samples/VRM10Viewer/Assets/red.png.meta @@ -0,0 +1,127 @@ +fileFormatVersion: 2 +guid: 51ce5cf2de6d788449c2fdd4b8488a92 +TextureImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 13 + mipmaps: + mipMapMode: 0 + enableMipMap: 1 + sRGBTexture: 1 + linearTexture: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapsPreserveCoverage: 0 + alphaTestReferenceValue: 0.5 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + flipGreenChannel: 0 + isReadable: 0 + streamingMipmaps: 0 + streamingMipmapsPriority: 0 + vTOnly: 0 + ignoreMipmapLimit: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + serializedVersion: 2 + filterMode: 1 + aniso: 1 + mipBias: 0 + wrapU: 0 + wrapV: 0 + wrapW: 0 + nPOTScale: 1 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spritePixelsToUnits: 100 + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spriteGenerateFallbackPhysicsShape: 1 + alphaUsage: 1 + alphaIsTransparency: 0 + spriteTessellationDetail: -1 + textureType: 0 + textureShape: 1 + singleChannelComponent: 0 + flipbookRows: 1 + flipbookColumns: 1 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + ignorePngGamma: 0 + applyGammaDecoding: 0 + swizzle: 50462976 + cookieLightType: 0 + platformSettings: + - serializedVersion: 3 + buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 3 + buildTarget: Standalone + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 3 + buildTarget: WebGL + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + physicsShape: [] + bones: [] + spriteID: + internalID: 0 + vertices: [] + indices: + edges: [] + weights: [] + secondaryTextures: [] + nameFileIdTable: {} + mipmapLimitGroupName: + pSDRemoveMatte: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/VRM10_Samples/VRM10Viewer/Assets/white.png b/Assets/VRM10_Samples/VRM10Viewer/Assets/white.png new file mode 100644 index 0000000000000000000000000000000000000000..8cd9f771b390c3a52ade99568cd4a51856b6b74b GIT binary patch literal 79 zcmeAS@N?(olHy`uVBq!ia0vp^Od!kwBL7~QRScxWJY5_^IIbuE`TyUZnVDG_h=G7X Xg^ihUuiWEZKotz0u6{1-oD!M= 0 } } }) { @@ -108,21 +111,22 @@ namespace UniVRM10.VRM10Viewer if (GltfTextureImporter.TryCreateLinear(data, src.pbrMetallicRoughness.metallicRoughnessTexture.index, offset, scale, out var _, out var desc)) { context.MetallicRoughnessMap = await getTextureAsync(desc, awaitCaller); - context.Metallic = 1; - context.Roughness = 1; } } } public static async Task ImportOcclusionAsync(GltfData data, glTFMaterial src, TinyPbrMaterialContext context, GetTextureAsyncFunc getTextureAsync, IAwaitCaller awaitCaller) { + if (src.occlusionTexture != null) + { + context.OcclusionStrength = src.occlusionTexture.strength; + } if (src is { occlusionTexture: { index: >= 0 } }) { var (offset, scale) = GltfTextureImporter.GetTextureOffsetAndScale(src.occlusionTexture); if (GltfTextureImporter.TryCreateLinear(data, src.occlusionTexture.index, offset, scale, out var _, out var desc)) { context.OcclusionTexture = await getTextureAsync(desc, awaitCaller); - context.OcclusionStrength = src.occlusionTexture.strength; } } }