Skip to content

Commit

Permalink
Fix normal map conversion losing texture wrap mode
Browse files Browse the repository at this point in the history
  • Loading branch information
DeathWeasel1337 committed Dec 10, 2021
1 parent c3ee20b commit e466ad6
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/MaterialEditor.Core/Core.MaterialEditor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public partial class MaterialEditorPlugin : MaterialEditorAPI.MaterialEditorPlug
/// <summary>
/// MaterialEditor plugin version
/// </summary>
public const string PluginVersion = "3.1.11";
public const string PluginVersion = "3.1.12";

/// <summary>
/// Material which is used in normal map conversion
Expand Down Expand Up @@ -970,11 +970,13 @@ public override bool ConvertNormalMap(ref Texture tex, string propertyName)
if (!NormalMapProperties.Contains(propertyName))
return false;

var wrapMode = tex.wrapMode;
RenderTexture rt = new RenderTexture(tex.width, tex.height, 0);
rt.useMipMap = true;
rt.autoGenerateMips = true;
Graphics.Blit(tex, rt, NormalMapConvertMaterial);
tex = rt;
tex.wrapMode = wrapMode;

return true;
}
Expand Down

0 comments on commit e466ad6

Please sign in to comment.