mirror of
https://github.com/xivdev/Penumbra.git
synced 2025-12-13 12:14:17 +01:00
Fix basecolor texture in material export
This commit is contained in:
parent
a69811800d
commit
2b36f39848
2 changed files with 5 additions and 4 deletions
|
|
@ -1,6 +1,7 @@
|
||||||
using Lumina.Data.Parsing;
|
using Lumina.Data.Parsing;
|
||||||
using Penumbra.GameData.Files;
|
using Penumbra.GameData.Files;
|
||||||
using Penumbra.GameData.Files.MaterialStructs;
|
using Penumbra.GameData.Files.MaterialStructs;
|
||||||
|
using Penumbra.UI.AdvancedWindow.Materials;
|
||||||
using SharpGLTF.Materials;
|
using SharpGLTF.Materials;
|
||||||
using SixLabors.ImageSharp;
|
using SixLabors.ImageSharp;
|
||||||
using SixLabors.ImageSharp.Advanced;
|
using SixLabors.ImageSharp.Advanced;
|
||||||
|
|
@ -140,13 +141,13 @@ public class MaterialExporter
|
||||||
|
|
||||||
// Lerp between table row values to fetch final pixel values for each subtexture.
|
// Lerp between table row values to fetch final pixel values for each subtexture.
|
||||||
var lerpedDiffuse = Vector3.Lerp((Vector3)prevRow.DiffuseColor, (Vector3)nextRow.DiffuseColor, rowBlend);
|
var lerpedDiffuse = Vector3.Lerp((Vector3)prevRow.DiffuseColor, (Vector3)nextRow.DiffuseColor, rowBlend);
|
||||||
baseColorSpan[x].FromVector4(new Vector4(lerpedDiffuse, 1));
|
baseColorSpan[x].FromVector4(new Vector4(MtrlTab.PseudoSqrtRgb(lerpedDiffuse), 1));
|
||||||
|
|
||||||
var lerpedSpecularColor = Vector3.Lerp((Vector3)prevRow.SpecularColor, (Vector3)nextRow.SpecularColor, rowBlend);
|
var lerpedSpecularColor = Vector3.Lerp((Vector3)prevRow.SpecularColor, (Vector3)nextRow.SpecularColor, rowBlend);
|
||||||
specularSpan[x].FromVector4(new Vector4(lerpedSpecularColor, 1));
|
specularSpan[x].FromVector4(new Vector4(MtrlTab.PseudoSqrtRgb(lerpedSpecularColor), 1));
|
||||||
|
|
||||||
var lerpedEmissive = Vector3.Lerp((Vector3)prevRow.EmissiveColor, (Vector3)nextRow.EmissiveColor, rowBlend);
|
var lerpedEmissive = Vector3.Lerp((Vector3)prevRow.EmissiveColor, (Vector3)nextRow.EmissiveColor, rowBlend);
|
||||||
emissiveSpan[x].FromVector4(new Vector4(lerpedEmissive, 1));
|
emissiveSpan[x].FromVector4(new Vector4(MtrlTab.PseudoSqrtRgb(lerpedEmissive), 1));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -594,7 +594,7 @@ public partial class MtrlTab
|
||||||
internal static float PseudoSqrtRgb(float x)
|
internal static float PseudoSqrtRgb(float x)
|
||||||
=> x < 0.0f ? -MathF.Sqrt(-x) : MathF.Sqrt(x);
|
=> x < 0.0f ? -MathF.Sqrt(-x) : MathF.Sqrt(x);
|
||||||
|
|
||||||
internal static Vector3 PseudoSqrtRgb(Vector3 vec)
|
public static Vector3 PseudoSqrtRgb(Vector3 vec)
|
||||||
=> new(PseudoSqrtRgb(vec.X), PseudoSqrtRgb(vec.Y), PseudoSqrtRgb(vec.Z));
|
=> new(PseudoSqrtRgb(vec.X), PseudoSqrtRgb(vec.Y), PseudoSqrtRgb(vec.Z));
|
||||||
|
|
||||||
internal static Vector4 PseudoSqrtRgb(Vector4 vec)
|
internal static Vector4 PseudoSqrtRgb(Vector4 vec)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue