mirror of
https://github.com/4sval/FModel.git
synced 2026-07-29 15:06:31 -05:00
fixed clamp + meow roughness + ui stuff
This commit is contained in:
parent
fd7b1226b5
commit
1ae75d36d2
|
|
@ -29,7 +29,7 @@ struct Mask
|
|||
Boost SkinBoost;
|
||||
|
||||
float AmbientOcclusion;
|
||||
float Cavity;
|
||||
float Curvature;
|
||||
};
|
||||
|
||||
struct Parameters
|
||||
|
|
@ -175,16 +175,16 @@ void main()
|
|||
if (uParameters.HasM)
|
||||
{
|
||||
vec3 m = SamplerToVector(uParameters.M.Sampler).rgb;
|
||||
float subsurface = clamp(m.b * .04f, 0.0f, 1.0f);
|
||||
|
||||
float subsurface = clamp(1.0f, 0.0f, m.b * .04f);
|
||||
if (subsurface > 0.0f && uParameters.M.SkinBoost.Exponent > 0.0f)
|
||||
{
|
||||
vec3 color = uParameters.M.SkinBoost.Color * pow(uParameters.M.SkinBoost.Exponent, uParameters.M.SkinBoost.Exponent);
|
||||
result *= clamp(color * m.b, 0.0f, 1.0f);
|
||||
vec3 color = uParameters.M.SkinBoost.Color * uParameters.M.SkinBoost.Exponent;
|
||||
result *= clamp(vec3(1.0f), vec3(0.0f), color * m.b);
|
||||
}
|
||||
|
||||
if (m.r > 0.0f) result *= m.r * uParameters.M.AmbientOcclusion;
|
||||
if (m.g > 0.0f) result += m.g * uParameters.M.Cavity;
|
||||
if (m.g > 0.0f) result += m.g * uParameters.M.Curvature;
|
||||
}
|
||||
|
||||
vec4 emissive = SamplerToVector(uParameters.Emissive[layer].Sampler);
|
||||
|
|
|
|||
|
|
@ -202,7 +202,7 @@ public class Material : IDisposable
|
|||
shader.SetUniform("uParameters.M.SkinBoost.Color", M.SkinBoost.Color);
|
||||
shader.SetUniform("uParameters.M.SkinBoost.Exponent", M.SkinBoost.Exponent);
|
||||
shader.SetUniform("uParameters.M.AmbientOcclusion", M.AmbientOcclusion);
|
||||
shader.SetUniform("uParameters.M.Cavity", M.Cavity);
|
||||
shader.SetUniform("uParameters.M.Curvature", M.Curvature);
|
||||
shader.SetUniform("uParameters.HasM", HasM);
|
||||
|
||||
shader.SetUniform("uParameters.Roughness", Roughness);
|
||||
|
|
@ -238,12 +238,12 @@ public class Material : IDisposable
|
|||
{
|
||||
SnimGui.Layout("Ambient Occlusion");ImGui.PushID(4);
|
||||
ImGui.DragFloat("", ref M.AmbientOcclusion, _step, _zero, 1.0f, _mult, _clamp);
|
||||
ImGui.PopID();SnimGui.Layout("Cavity");ImGui.PushID(5);
|
||||
ImGui.DragFloat("", ref M.Cavity, _step, _zero, 1.0f, _mult, _clamp);
|
||||
ImGui.PopID();SnimGui.Layout("Skin Boost Exponent");ImGui.PushID(6);
|
||||
ImGui.DragFloat("", ref M.SkinBoost.Exponent, _step, _zero, _infinite, _mult, _clamp);
|
||||
ImGui.PopID();SnimGui.Layout("Skin Boost Color");ImGui.PushID(7);
|
||||
ImGui.PopID();SnimGui.Layout("Curvature");ImGui.PushID(5);
|
||||
ImGui.DragFloat("", ref M.Curvature, _step, _zero, 1.0f, _mult, _clamp);
|
||||
ImGui.PopID();SnimGui.Layout("Color Boost");ImGui.PushID(6);
|
||||
ImGui.ColorEdit3("", ref M.SkinBoost.Color);
|
||||
ImGui.PopID();SnimGui.Layout("Color Boost Exponent");ImGui.PushID(7);
|
||||
ImGui.DragFloat("", ref M.SkinBoost.Exponent, _step, _zero, _infinite, _mult, _clamp);
|
||||
ImGui.PopID();
|
||||
}
|
||||
ImGui.EndTable();
|
||||
|
|
@ -342,7 +342,7 @@ public struct Mask
|
|||
public Boost SkinBoost;
|
||||
|
||||
public float AmbientOcclusion;
|
||||
public float Cavity;
|
||||
public float Curvature;
|
||||
}
|
||||
|
||||
public struct Boost
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ public class Options
|
|||
public readonly Dictionary<string, Texture> Icons;
|
||||
|
||||
private ETexturePlatform _platform;
|
||||
private readonly FGame _game;
|
||||
private readonly string _game;
|
||||
|
||||
public Options()
|
||||
{
|
||||
|
|
@ -37,7 +37,7 @@ public class Options
|
|||
};
|
||||
|
||||
_platform = UserSettings.Default.OverridedPlatform;
|
||||
_game = Services.ApplicationService.ApplicationView.CUE4Parse.Game;
|
||||
_game = Services.ApplicationService.ApplicationView.CUE4Parse.Provider.GameName;
|
||||
|
||||
SelectModel(Guid.Empty);
|
||||
}
|
||||
|
|
@ -93,7 +93,7 @@ public class Options
|
|||
if (!Textures.TryGetValue(guid, out texture) && o.GetFirstMip() is { } mip)
|
||||
{
|
||||
TextureDecoder.DecodeTexture(mip, o.Format, o.isNormalMap, _platform, out var data, out _);
|
||||
// if (fix) FixChannels(o, mip, ref data);
|
||||
if (fix) FixChannels(o, mip, ref data);
|
||||
|
||||
texture = new Texture(data, mip.SizeX, mip.SizeY, o);
|
||||
Textures[guid] = texture;
|
||||
|
|
@ -109,6 +109,25 @@ public class Options
|
|||
private void FixChannels(UTexture2D o, FTexture2DMipMap mip, ref byte[] data)
|
||||
{
|
||||
// only if it makes a big difference pls
|
||||
switch (_game)
|
||||
{
|
||||
case "hk_project":
|
||||
{
|
||||
unsafe
|
||||
{
|
||||
var offset = 0;
|
||||
fixed (byte* d = data)
|
||||
{
|
||||
for (var i = 0; i < mip.SizeX * mip.SizeY; i++)
|
||||
{
|
||||
(d[offset + 1], d[offset + 2]) = (d[offset + 2], d[offset + 1]); // swap G and B
|
||||
offset += 4;
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public bool TryGetModel(out Model model) => Models.TryGetValue(SelectedModel, out model);
|
||||
|
|
|
|||
|
|
@ -188,6 +188,11 @@ public class SnimGui
|
|||
s.WindowShouldClose(true, false);
|
||||
}
|
||||
ImGui.EndDisabled();
|
||||
if (ImGui.Selectable("Teleport To"))
|
||||
{
|
||||
var instancePos = model.Transforms[model.SelectedInstance].Position;
|
||||
s.Camera.Position = new Vector3(instancePos.X, instancePos.Y, instancePos.Z);
|
||||
}
|
||||
if (ImGui.Selectable("Delete")) s.Renderer.Options.Models.Remove(guid);
|
||||
if (ImGui.Selectable("Deselect")) s.Renderer.Options.SelectModel(Guid.Empty);
|
||||
ImGui.Separator();
|
||||
|
|
@ -237,15 +242,22 @@ public class SnimGui
|
|||
ImGui.PushStyleVar(ImGuiStyleVar.WindowPadding, Vector2.Zero);
|
||||
MeshWindow("Details", s.Renderer, (icons, model) =>
|
||||
{
|
||||
ImGui.Text($"Entity: ({model.Type}) {model.Name}");
|
||||
ImGui.Text($"Guid: {s.Renderer.Options.SelectedModel.ToString(EGuidFormats.UniqueObjectGuid)}");
|
||||
ImGui.Spacing();
|
||||
if (ImGui.Button("Go To"))
|
||||
ImGui.PushStyleVar(ImGuiStyleVar.FramePadding, new Vector2(8, 3));
|
||||
ImGui.PushStyleVar(ImGuiStyleVar.CellPadding, new Vector2(0, 1));
|
||||
if (ImGui.BeginTable("model_details", 2, ImGuiTableFlags.SizingStretchProp))
|
||||
{
|
||||
var instancePos = model.Transforms[model.SelectedInstance].Position;
|
||||
s.Camera.Position = new Vector3(instancePos.X, instancePos.Y, instancePos.Z);
|
||||
Layout("Entity");ImGui.Text($" : ({model.Type}) {model.Name}");
|
||||
Layout("Guid");ImGui.Text($" : {s.Renderer.Options.SelectedModel.ToString(EGuidFormats.UniqueObjectGuid)}");
|
||||
if (model.HasSkeleton)
|
||||
{
|
||||
Layout("Skeleton");ImGui.Text($" : {model.Skeleton.RefSkel.Name}");
|
||||
Layout("Bones");ImGui.Text($" : x{model.Skeleton.RefSkel.BoneTree.Length}");
|
||||
Layout("Sockets");ImGui.Text($" : x{model.Skeleton.Sockets.Length}");
|
||||
}
|
||||
|
||||
ImGui.EndTable();
|
||||
}
|
||||
ImGui.Spacing();
|
||||
ImGui.PopStyleVar(2);
|
||||
if (ImGui.BeginTabBar("tabbar_details", ImGuiTabBarFlags.None))
|
||||
{
|
||||
if (ImGui.BeginTabItem("Sections") && ImGui.BeginTable("table_sections", 2, ImGuiTableFlags.Resizable | ImGuiTableFlags.BordersOuterV, ImGui.GetContentRegionAvail()))
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user