@@ -1090,12 +1090,15 @@ public GltfSubObject(MeshPrimitive meshPrimitive, string name, int hierarchyInde
10901090 if ( meshPrimitive . Targets != null && meshPrimitive . Targets . Length > 0 )
10911091 options |= SceneryMaterialOptions . PbrHasMorphTargets ;
10921092
1093+ var flipNormals = 1f ;
10931094 if ( ! shape . MsfsFlavoured && distanceLevel . Matrices . ElementAt ( hierarchyIndex ) . Determinant ( ) > 0 )
10941095 // This is according to the glTF spec
10951096 options |= SceneryMaterialOptions . PbrCullClockWise ;
10961097 else if ( shape . MsfsFlavoured && distanceLevel . Matrices . ElementAt ( hierarchyIndex ) . Determinant ( ) < 0 )
10971098 // Msfs seems to be using this reversed
10981099 options |= SceneryMaterialOptions . PbrCullClockWise ;
1100+ else
1101+ flipNormals = - 1f ;
10991102
11001103 var referenceAlpha = 0f ;
11011104 var doubleSided = material . DoubleSided ;
@@ -1167,12 +1170,12 @@ public GltfSubObject(MeshPrimitive meshPrimitive, string name, int hierarchyInde
11671170 var baseColorFactor = MemoryMarshal . Cast < float , Vector4 > ( material . PbrMetallicRoughness ? . BaseColorFactor ?? new [ ] { 1f , 1f , 1f , 1f } ) [ 0 ] ;
11681171 var metallicFactor = material . PbrMetallicRoughness ? . MetallicFactor ?? 1f ;
11691172 var roughtnessFactor = material . PbrMetallicRoughness ? . RoughnessFactor ?? 1f ;
1170- var normalScale = material . NormalTexture ? . Scale ?? 0 ; // Must be 0 only if the textureInfo is missing, otherwise it must have the default value 1.
1173+ var normalScale = flipNormals * ( material . NormalTexture ? . Scale ?? 2f ) ; // 2 indicates the textureInfo is missing, otherwise it get default 1
11711174 var occlusionStrength = material . OcclusionTexture ? . Strength ?? 0 ; // Must be 0 only if the textureInfo is missing, otherwise it must have the default value 1.
11721175 var emissiveFactor = MemoryMarshal . Cast < float , Vector3 > ( material . EmissiveFactor ?? new [ ] { 0f , 0f , 0f } ) [ 0 ] * emissiveStrength ;
11731176 var clearcoatFactor = clearcoat ? . ClearcoatFactor ?? 0 ;
11741177 var clearcoatRoughnessFactor = clearcoat ? . ClearcoatRoughnessFactor ?? 0 ;
1175- var clearcoatNormalScale = clearcoat ? . ClearcoatNormalTexture ? . Scale ?? 1 ;
1178+ var clearcoatNormalScale = flipNormals * ( clearcoat ? . ClearcoatNormalTexture ? . Scale ?? 2f ) ;
11761179
11771180 switch ( baseColorSamplerState . Item2 )
11781181 {
@@ -1844,7 +1847,7 @@ public void Animate(int animationNumber, float time, Matrix[] animatedMatrices)
18441847 { "MorphPrimitivesTest" . ToLower ( ) , Matrix . CreateScale ( 2 ) * Matrix . CreateTranslation ( 0 , 1 , 0 ) } ,
18451848 { "MosquitoInAmber" . ToLower ( ) , Matrix . CreateScale ( 25 ) * Matrix . CreateTranslation ( 0 , 1 , 0 ) } ,
18461849 { "MultiUVTest" . ToLower ( ) , Matrix . CreateTranslation ( 0 , 2 , 0 ) } ,
1847- { "NegativeScaleTest" . ToLower ( ) , Matrix . CreateTranslation ( 0 , 3 , 0 ) } ,
1850+ { "NegativeScaleTest" . ToLower ( ) , Matrix . CreateTranslation ( 0 , 4 , 0 ) } ,
18481851 { "NormalTangentMirrorTest" . ToLower ( ) , Matrix . CreateScale ( 2 ) * Matrix . CreateTranslation ( 0 , 2 , 0 ) } ,
18491852 { "NormalTangentTest" . ToLower ( ) , Matrix . CreateScale ( 2 ) * Matrix . CreateTranslation ( 0 , 2 , 0 ) } ,
18501853 { "OrientationTest" . ToLower ( ) , Matrix . CreateScale ( 0.2f ) * Matrix . CreateTranslation ( 0 , 2 , 0 ) } ,
@@ -1857,9 +1860,11 @@ public void Animate(int animationNumber, float time, Matrix[] animatedMatrices)
18571860 { "SciFiHelmet" . ToLower ( ) , Matrix . CreateTranslation ( 0 , 2 , 0 ) } ,
18581861 { "SheenChair" . ToLower ( ) , Matrix . CreateScale ( 2 ) } ,
18591862 { "SheenCloth" . ToLower ( ) , Matrix . CreateScale ( 50 ) } ,
1863+ { "SheenTestGrid" . ToLower ( ) , Matrix . CreateScale ( 5 ) * Matrix . CreateTranslation ( 0 , 4 , 0 ) } ,
18601864 { "SpecGlossVsMetalRough" . ToLower ( ) , Matrix . CreateScale ( 7 ) * Matrix . CreateTranslation ( 0 , 2 , 0 ) } ,
18611865 { "SpecularTest" . ToLower ( ) , Matrix . CreateScale ( 5 ) * Matrix . CreateTranslation ( 0 , 2 , 0 ) } ,
18621866 { "StainedGlassLamp" . ToLower ( ) , Matrix . CreateScale ( 3 ) } ,
1867+ { "SunglassesKhronos" . ToLower ( ) , Matrix . CreateScale ( 30 ) } ,
18631868 { "Suzanne" . ToLower ( ) , Matrix . CreateTranslation ( 0 , 2 , 0 ) } ,
18641869 { "TextureCoordinateTest" . ToLower ( ) , Matrix . CreateTranslation ( 0 , 2 , 0 ) } ,
18651870 { "TextureEncodingTest" . ToLower ( ) , Matrix . CreateScale ( 0.5f ) * Matrix . CreateTranslation ( 0 , 3 , 0 ) } ,
0 commit comments