@@ -11,6 +11,10 @@ namespace Nautilus.Utility;
11
11
public static partial class MaterialUtils
12
12
{
13
13
private static readonly int _emissionMap = Shader . PropertyToID ( "_EmissionMap" ) ;
14
+ private static readonly int _specInt = Shader . PropertyToID ( "_SpecInt" ) ;
15
+ private static readonly int _shininess = Shader . PropertyToID ( "_Shininess" ) ;
16
+ private static readonly int _fresnel = Shader . PropertyToID ( "_Fresnel" ) ;
17
+ private static readonly int _bumpMap = Shader . PropertyToID ( "_BumpMap" ) ;
14
18
15
19
internal static void Patch ( )
16
20
{
@@ -224,13 +228,12 @@ public static void ApplyUBERShader(Material material, float shininess, float spe
224
228
if ( specularTexture != null )
225
229
{
226
230
material . SetTexture ( ShaderPropertyID . _SpecTex , specularTexture ) ;
227
- material . SetFloat ( "_SpecInt" , specularIntensity ) ;
228
- material . SetFloat ( "_Shininess" , shininess ) ;
231
+ material . SetFloat ( _specInt , specularIntensity ) ;
232
+ material . SetFloat ( _shininess , shininess ) ;
229
233
material . EnableKeyword ( "_ZWRITE_ON" ) ;
230
234
material . EnableKeyword ( "MARMO_SPECMAP" ) ;
231
235
material . SetColor ( ShaderPropertyID . _SpecColor , new Color ( 1f , 1f , 1f , 1f ) ) ;
232
- material . SetFloat ( "_Fresnel" , 0.24f ) ;
233
- material . SetVector ( "_SpecTex_ST" , new Vector4 ( 1.0f , 1.0f , 0.0f , 0.0f ) ) ;
236
+ material . SetFloat ( _fresnel , 0.24f ) ;
234
237
}
235
238
236
239
// Apply emission if it was enabled in the standard shader
@@ -245,13 +248,12 @@ public static void ApplyUBERShader(Material material, float shininess, float spe
245
248
}
246
249
247
250
// Apply normal map if it was applied in the standard shader
248
- if ( material . GetTexture ( "_BumpMap" ) )
251
+ if ( material . GetTexture ( _bumpMap ) )
249
252
{
250
253
material . EnableKeyword ( "MARMO_NORMALMAP" ) ;
251
254
}
252
255
253
256
material . enableInstancing = true ;
254
- material . globalIlluminationFlags = MaterialGlobalIlluminationFlags . EmissiveIsBlack | MaterialGlobalIlluminationFlags . RealtimeEmissive ;
255
257
256
258
switch ( materialType )
257
259
{
0 commit comments