Day 3 of feeling stupid.
Spud. I'm not trying to save the textures, just redirect the material used in game to a clothing item. That way extra geometry like this can be grafted onto any model. Saving a preset limits its use, It would be cool to make stuff like this that could be used on any existing look.
Adding extra geometry that grafts onto the skin could be useful for a lot of things other than just this, like horns and spines that have raised skin surrounding them to make them look more like a part of the model, raised moles or scars, cybernetic implants that effect the skin around them, detailed ear or nose prosthetic. All sorts of fantasy and sci-fi weirdness.
Hazmhox. Thanks for the idea's, but I'm still lost.
I 'read' through the code for Embody. Is this a pointy metal thing with a hole in?
using System.Collections.Generic;
using System.Linq;
using UnityEngine;
namespace Handlers
{
public class SkinHandler : IHandler
{
private readonly DAZSkinV2 _skin;
private readonly IEnumerable<string> _materialsToHide;
private readonly int _materialsToHideMax;
private List<SkinShaderMaterialSnapshot> _materialRefs;
public SkinHandler(DAZSkinV2 skin, IEnumerable<string> materialsToHide, int materialsToHideMax)
{
_skin = skin;
_materialsToHide = materialsToHide;
_materialsToHideMax = materialsToHideMax;
}
public bool Prepare()
{
_materialRefs = new List<SkinShaderMaterialSnapshot>();
foreach (var material in GetMaterialsToHide())
{
var materialInfo = SkinShaderMaterialSnapshot.FromMaterial(material);
Shader shader;
if (!ReplacementShaders.ShadersMap.TryGetValue(material.shader.name, out shader))
SuperController.LogError("Missing replacement shader: '" + material.shader.name + $"' ({material.name} will not be hidden)");
if (shader != null)
{
material.shader = shader;
materialInfo.alphaAdjustSupport = material.HasProperty("_AlphaAdjust");
materialInfo.alphaCutoffSupport = material.HasProperty("_Cutoff");
materialInfo.specColorSupport = material.HasProperty("_SpecColor");
}
else
{
materialInfo.alphaAdjustSupport = materialInfo.originalAlphaAdjustSupport;
materialInfo.alphaCutoffSupport = materialInfo.originalAlphaCutoffSupport;
materialInfo.specColorSupport = materialInfo.originalSpecColorSupport;
}
_materialRefs.Add(materialInfo);
}
// This is a hack to force a refresh of the shaders cache
_skin.BroadcastMessage("OnApplicationFocus", true);
return true;
}