@@ -1600,11 +1600,12 @@ internal void LoadVisualMapTexture(CelestialBody b, mapSource s)
16001600
16011601 }
16021602
1603- void GetVisualMapTexturesForBody ( CelestialBody b , out Material material , out string colorMapTextureName , out string normalMapTextureName )
1603+ void GetVisualMapTexturesForBody ( CelestialBody b , out Material material , out bool useMaterialForColorMap , out string colorMapTextureName , out string normalMapTextureName )
16041604 {
16051605 material = null ;
16061606 colorMapTextureName = null ;
16071607 normalMapTextureName = null ;
1608+ useMaterialForColorMap = true ;
16081609
16091610 if ( b . scaledBody == null )
16101611 {
@@ -1630,7 +1631,10 @@ void GetVisualMapTexturesForBody(CelestialBody b, out Material material, out str
16301631 else if ( shaderName . Contains ( "ParallaxScaled" ) )
16311632 {
16321633 SCANparallaxContinued . LoadParallax ( b , ref material ) ;
1634+ useMaterialForColorMap = false ;
16331635 colorMapTextureName = "_ColorMap" ;
1636+ normalMapTextureName = null ; // for whatever reason, the logic in ScANmap that uses the normal map doesn't work with parallax's normal maps
1637+ return ;
16341638 }
16351639 else if ( material . HasProperty ( "_MainTex" ) )
16361640 {
@@ -1662,7 +1666,7 @@ void CacheScaledSpaceTexture(Dictionary<CelestialBody, Texture2D> cache, Celesti
16621666 }
16631667 else
16641668 {
1665- var colorMap = sourceTexture . isReadable ? sourceTexture : readableTexture ( sourceTexture , material , true ) ;
1669+ var colorMap = sourceTexture . isReadable ? sourceTexture : readableTexture ( sourceTexture , useMaterial ? material : null ) ;
16661670 cache . Add ( b , colorMap ) ;
16671671 }
16681672 }
@@ -1680,15 +1684,15 @@ internal void LoadVisualMapTexture_Renamed(CelestialBody b, mapSource s)
16801684 return ;
16811685 }
16821686
1683- GetVisualMapTexturesForBody ( b , out Material material , out string colorMapTextureName , out string normalMapTextureName ) ;
1687+ GetVisualMapTexturesForBody ( b , out Material material , out bool useMaterialForColorMap , out string colorMapTextureName , out string normalMapTextureName ) ;
16841688
16851689 if ( material == null )
16861690 {
16871691 Log . Error ( $ "GetVisualMapTexturesForBody returned a null material for body { b . name } ") ;
16881692 }
16891693 else
16901694 {
1691- CacheScaledSpaceTexture ( readableScaledSpaceMaps , b , material , colorMapTextureName , true ) ;
1695+ CacheScaledSpaceTexture ( readableScaledSpaceMaps , b , material , colorMapTextureName , useMaterialForColorMap ) ;
16921696 CacheScaledSpaceTexture ( readableScaledSpaceNormalMaps , b , material , normalMapTextureName , false ) ;
16931697 }
16941698
@@ -1752,7 +1756,7 @@ internal void UnloadVisualMapTexture(CelestialBody b, mapSource s)
17521756 }
17531757 }
17541758
1755- private Texture2D readableTexture ( Texture tex , Material mat , bool useMat )
1759+ private Texture2D readableTexture ( Texture tex , Material mat )
17561760 {
17571761 if ( tex == null )
17581762 {
@@ -1763,7 +1767,7 @@ private Texture2D readableTexture(Texture tex, Material mat, bool useMat)
17631767
17641768 var rt = RenderTexture . GetTemporary ( tex . width , tex . height , 0 , RenderTextureFormat . ARGB32 , RenderTextureReadWrite . sRGB , 1 ) ;
17651769
1766- if ( useMat )
1770+ if ( mat != null )
17671771 {
17681772 Graphics . Blit ( tex , rt , mat ) ;
17691773 }
0 commit comments