1
This commit is contained in:
@@ -0,0 +1,72 @@
|
||||
#if VEGETATION_STUDIO_PRO
|
||||
using AwesomeTechnologies.VegetationSystem;
|
||||
using UnityEngine;
|
||||
|
||||
namespace AwesomeTechnologies.Shaders
|
||||
{
|
||||
|
||||
public class FAEFoliageShaderController : IShaderController
|
||||
{
|
||||
public bool MatchShader(string shaderName)
|
||||
{
|
||||
if (string.IsNullOrEmpty(shaderName)) return false;
|
||||
|
||||
return (shaderName == "FAE/Foliage" || shaderName == "Universal Render Pipeline/FAE/FAE_Foliage") ? true : false;
|
||||
}
|
||||
|
||||
public bool MatchBillboardShader(Material[] materials)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
public ShaderControllerSettings Settings { get; set; }
|
||||
public void CreateDefaultSettings(Material[] materials)
|
||||
{
|
||||
Settings = new ShaderControllerSettings
|
||||
{
|
||||
Heading = "Fantasy Adventure Environment Foliage",
|
||||
Description = "Description text",
|
||||
LODFadePercentage = false,
|
||||
LODFadeCrossfade = false,
|
||||
SampleWind = true,
|
||||
SupportsInstantIndirect = true
|
||||
};
|
||||
|
||||
Settings.AddLabelProperty("Color");
|
||||
Settings.AddFloatProperty("AmbientOcclusion", "Ambient Occlusion", "", ShaderControllerSettings.GetFloatFromMaterials(materials, "_AmbientOcclusion"), 0, 1);
|
||||
|
||||
Settings.AddLabelProperty("Translucency");
|
||||
Settings.AddFloatProperty("TranslucencyAmount", "Amount", "", ShaderControllerSettings.GetFloatFromMaterials(materials, "_TransmissionAmount"), 0, 10);
|
||||
Settings.AddFloatProperty("TranslucencySize", "Size", "", ShaderControllerSettings.GetFloatFromMaterials(materials, "_TransmissionSize"), 1, 20);
|
||||
|
||||
Settings.AddLabelProperty("Wind");
|
||||
Settings.AddFloatProperty("WindInfluence", "Max Strength", "", ShaderControllerSettings.GetFloatFromMaterials(materials, "_MaxWindStrength"), 0, 1);
|
||||
Settings.AddFloatProperty("GlobalWindMotion", "Global motion", "", ShaderControllerSettings.GetFloatFromMaterials(materials, "_GlobalWindMotion"), 0, 1);
|
||||
Settings.AddFloatProperty("LeafFlutter", "Leaf flutter", "", ShaderControllerSettings.GetFloatFromMaterials(materials, "_LeafFlutter"), 0, 1);
|
||||
Settings.AddFloatProperty("WindSwinging", "Swinging", "", ShaderControllerSettings.GetFloatFromMaterials(materials, "_WindSwinging"), 0, 1);
|
||||
Settings.AddFloatProperty("WindAmplitude", "Amplitude Multiplier", "", ShaderControllerSettings.GetFloatFromMaterials(materials, "_WindAmplitudeMultiplier"), 0, 10);
|
||||
}
|
||||
|
||||
public void UpdateMaterial(Material material, EnvironmentSettings environmentSettings)
|
||||
{
|
||||
if (Settings == null) return;
|
||||
|
||||
material.SetFloat("_AmbientOcclusion", Settings.GetFloatPropertyValue("AmbientOcclusion"));
|
||||
|
||||
material.SetFloat("_TransmissionAmount", Settings.GetFloatPropertyValue("TranslucencyAmount"));
|
||||
material.SetFloat("_TransmissionSize", Settings.GetFloatPropertyValue("TranslucencySize"));
|
||||
|
||||
material.SetFloat("_MaxWindStrength", Settings.GetFloatPropertyValue("WindInfluence"));
|
||||
material.SetFloat("_GlobalWindMotion", Settings.GetFloatPropertyValue("GlobalWindMotion"));
|
||||
material.SetFloat("_LeafFlutter", Settings.GetFloatPropertyValue("LeafFlutter"));
|
||||
material.SetFloat("_WindSwinging", Settings.GetFloatPropertyValue("WindSwinging"));
|
||||
material.SetFloat("_WindAmplitudeMultiplier", Settings.GetFloatPropertyValue("WindAmplitude"));
|
||||
}
|
||||
|
||||
public void UpdateWind(Material material, WindSettings windSettings)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
@@ -0,0 +1,103 @@
|
||||
#if VEGETATION_STUDIO_PRO
|
||||
using AwesomeTechnologies.VegetationSystem;
|
||||
using UnityEngine;
|
||||
|
||||
namespace AwesomeTechnologies.Shaders
|
||||
{
|
||||
|
||||
public class FAEGrassShaderController : IShaderController
|
||||
{
|
||||
public bool MatchShader(string shaderName)
|
||||
{
|
||||
if (string.IsNullOrEmpty(shaderName)) return false;
|
||||
|
||||
return (shaderName == "FAE/Grass") ? true : false;
|
||||
}
|
||||
|
||||
public bool MatchBillboardShader(Material[] materials)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
public ShaderControllerSettings Settings { get; set; }
|
||||
public void CreateDefaultSettings(Material[] materials)
|
||||
{
|
||||
Settings = new ShaderControllerSettings
|
||||
{
|
||||
Heading = "Fantasy Adventure Environment Grass",
|
||||
Description = "Description text",
|
||||
LODFadePercentage = false,
|
||||
LODFadeCrossfade = false,
|
||||
SampleWind = true,
|
||||
SupportsInstantIndirect = true
|
||||
};
|
||||
|
||||
bool hasPigmentMap = Shader.GetGlobalTexture("_PigmentMap");
|
||||
|
||||
|
||||
Settings.AddLabelProperty("Color");
|
||||
Settings.AddBooleanProperty("EnablePigmentMap", "Use pigment map", "", hasPigmentMap);
|
||||
Settings.AddColorProperty("TopColor", "Top", "", ShaderControllerSettings.GetColorFromMaterials(materials, "_ColorTop"));
|
||||
Settings.AddColorProperty("BottomColor", "Bottom", "", ShaderControllerSettings.GetColorFromMaterials(materials, "_ColorBottom"));
|
||||
Settings.AddFloatProperty("WindTint", "Wind tint", "", ShaderControllerSettings.GetFloatFromMaterials(materials, "_ColorVariation"), 0, 1);
|
||||
Settings.AddFloatProperty("AmbientOcclusion", "Ambient Occlusion", "", ShaderControllerSettings.GetFloatFromMaterials(materials, "_AmbientOcclusion"), 0, 1);
|
||||
|
||||
Settings.AddLabelProperty("Translucency");
|
||||
Settings.AddFloatProperty("TranslucencyAmount", "Amount", "", ShaderControllerSettings.GetFloatFromMaterials(materials, "_TransmissionAmount"), 0, 10);
|
||||
Settings.AddFloatProperty("TranslucencySize", "Size", "", ShaderControllerSettings.GetFloatFromMaterials(materials, "_TransmissionSize"), 1, 20);
|
||||
|
||||
Settings.AddLabelProperty("Wind");
|
||||
Settings.AddFloatProperty("WindInfluence", "Influence", "", ShaderControllerSettings.GetFloatFromMaterials(materials, "_MaxWindStrength"), 0, 1);
|
||||
Settings.AddFloatProperty("WindSwinging", "Swinging", "", ShaderControllerSettings.GetFloatFromMaterials(materials, "_WindSwinging"), 0, 1);
|
||||
Settings.AddFloatProperty("WindAmplitude", "Amplitude Multiplier", "", ShaderControllerSettings.GetFloatFromMaterials(materials, "_WindAmplitudeMultiplier"), 0, 10);
|
||||
|
||||
#if TOUCH_REACT
|
||||
Settings.AddLabelProperty("Touch React");
|
||||
#else
|
||||
Settings.AddLabelProperty("Player bending");
|
||||
|
||||
#endif
|
||||
Settings.AddFloatProperty("BendingInfluence", "Influence", "", ShaderControllerSettings.GetFloatFromMaterials(materials, "_BendingInfluence"), 0, 1);
|
||||
|
||||
|
||||
}
|
||||
|
||||
public void UpdateMaterial(Material material, EnvironmentSettings environmentSettings)
|
||||
{
|
||||
if (Settings == null) return;
|
||||
|
||||
//Force enable touch react usage
|
||||
#if TOUCH_REACT
|
||||
material.SetFloat("_VS_TOUCHBEND", 0);
|
||||
#endif
|
||||
material.SetFloat("_PigmentMapInfluence", Settings.GetBooleanPropertyValue("EnablePigmentMap") ? 1 : 0);
|
||||
|
||||
//Allow VS heightmaps to control the height
|
||||
material.SetFloat("_MaxHeight", 0.5f);
|
||||
|
||||
material.SetColor("_ColorTop", Settings.GetColorPropertyValue("TopColor"));
|
||||
material.SetColor("_ColorBottom", Settings.GetColorPropertyValue("BottomColor"));
|
||||
material.SetFloat("_ColorVariation", Settings.GetFloatPropertyValue("WindTint"));
|
||||
material.SetFloat("_AmbientOcclusion", Settings.GetFloatPropertyValue("AmbientOcclusion"));
|
||||
|
||||
material.SetFloat("_TransmissionAmount", Settings.GetFloatPropertyValue("TranslucencyAmount"));
|
||||
material.SetFloat("_TransmissionSize", Settings.GetFloatPropertyValue("TranslucencySize"));
|
||||
|
||||
material.SetFloat("_MaxWindStrength", Settings.GetFloatPropertyValue("WindInfluence"));
|
||||
material.SetFloat("_WindSwinging", Settings.GetFloatPropertyValue("WindSwinging"));
|
||||
material.SetFloat("_WindAmplitudeMultiplier", Settings.GetFloatPropertyValue("WindAmplitude"));
|
||||
|
||||
material.SetFloat("_BendingInfluence", Settings.GetFloatPropertyValue("BendingInfluence"));
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
public void UpdateWind(Material material, WindSettings windSettings)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
@@ -0,0 +1,126 @@
|
||||
#if VEGETATION_STUDIO_PRO
|
||||
using AwesomeTechnologies.VegetationSystem;
|
||||
using UnityEngine;
|
||||
|
||||
namespace AwesomeTechnologies.Shaders
|
||||
{
|
||||
// ReSharper disable once InconsistentNaming
|
||||
public class FAETreeShaderController : IShaderController
|
||||
{
|
||||
private static readonly string[] BranchShaderNames =
|
||||
{
|
||||
"FAE/Tree Branch",
|
||||
"Universal Render Pipeline/FAE/FAE_TreeBranch"
|
||||
};
|
||||
|
||||
private static readonly string[] TrunkShaderNames =
|
||||
{
|
||||
"FAE/Tree Trunk",
|
||||
"Universal Render Pipeline/FAE/FAE_TreeTrunk"
|
||||
};
|
||||
|
||||
public bool MatchShader(string shaderName)
|
||||
{
|
||||
if (string.IsNullOrEmpty(shaderName)) return false;
|
||||
|
||||
for (int i = 0; i <= BranchShaderNames.Length - 1; i++)
|
||||
{
|
||||
if (BranchShaderNames[i].Contains(shaderName)) return true;
|
||||
}
|
||||
|
||||
for (int i = 0; i <= TrunkShaderNames.Length - 1; i++)
|
||||
{
|
||||
if (TrunkShaderNames[i].Contains(shaderName)) return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public bool MatchBillboardShader(Material[] materials)
|
||||
{
|
||||
//VSP will skip any LODs matching this shader, bypass when URP is in use so billboards are still rendered
|
||||
if (UnityEngine.Rendering.GraphicsSettings.renderPipelineAsset != null) return false;
|
||||
|
||||
for (int i = 0; i <= materials.Length - 1; i++)
|
||||
{
|
||||
if (materials[i].shader.name == "FAE/Tree Billboard" || materials[i].shader.name == "Universal Render Pipeline/FAE/FAE_TreeBillboard") return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool IsTrunkShader(string shaderName)
|
||||
{
|
||||
for (int i = 0; i <= TrunkShaderNames.Length - 1; i++)
|
||||
{
|
||||
if (TrunkShaderNames[i].Contains(shaderName)) return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public ShaderControllerSettings Settings { get; set; }
|
||||
public void CreateDefaultSettings(Material[] materials)
|
||||
{
|
||||
Settings = new ShaderControllerSettings
|
||||
{
|
||||
Heading = "Fantasy Adventure Environment Tree",
|
||||
Description = "",
|
||||
LODFadePercentage = true,
|
||||
LODFadeCrossfade = true,
|
||||
SampleWind = true,
|
||||
SupportsInstantIndirect = true
|
||||
};
|
||||
|
||||
Settings.AddLabelProperty("Branch");
|
||||
Settings.AddColorProperty("Color", "Main color", "", ShaderControllerSettings.GetColorFromMaterials(materials, "_Color"));
|
||||
Settings.AddColorProperty("HueVariation", "Hue Variation", "",
|
||||
ShaderControllerSettings.GetColorFromMaterials(materials, "_HueVariation"));
|
||||
Settings.AddColorProperty("TransmissionColor", "Transmission Color", "",
|
||||
ShaderControllerSettings.GetColorFromMaterials(materials, "_TransmissionColor"));
|
||||
Settings.AddFloatProperty("AmbientOcclusionBranch", "Ambient Occlusion", "",
|
||||
ShaderControllerSettings.GetFloatFromMaterials(materials, "_AmbientOcclusion"), 0, 1);
|
||||
Settings.AddFloatProperty("GradientBrightnessBranch", "Gradient Brightness", "",
|
||||
ShaderControllerSettings.GetFloatFromMaterials(materials, "_GradientBrightness"), 0, 2);
|
||||
|
||||
Settings.AddLabelProperty("Trunk");
|
||||
Settings.AddFloatProperty("GradientBrightnessTrunk", "Gradient Brightness", "",
|
||||
ShaderControllerSettings.GetFloatFromMaterials(materials, "_GradientBrightness"), 0, 2);
|
||||
Settings.AddFloatProperty("AmbientOcclusionTrunk", "Ambient Occlusion", "",
|
||||
ShaderControllerSettings.GetFloatFromMaterials(materials, "_AmbientOcclusion"), 0, 1);
|
||||
|
||||
Settings.AddLabelProperty("Branch Wind");
|
||||
Settings.AddFloatProperty("WindInfluence", "Max Strength", "", ShaderControllerSettings.GetFloatFromMaterials(materials, "_MaxWindStrength"), 0, 1);
|
||||
Settings.AddFloatProperty("WindAmplitude", "Amplitude Multiplier", "", ShaderControllerSettings.GetFloatFromMaterials(materials, "_WindAmplitudeMultiplier"), 0, 10);
|
||||
|
||||
}
|
||||
|
||||
public void UpdateMaterial(Material material, EnvironmentSettings environmentSettings)
|
||||
{
|
||||
if (Settings == null) return;
|
||||
|
||||
bool isTrunk = IsTrunkShader(material.shader.name);
|
||||
|
||||
if (isTrunk)
|
||||
{
|
||||
material.SetFloat("_AmbientOcclusion", Settings.GetFloatPropertyValue("AmbientOcclusionTrunk"));
|
||||
material.SetFloat("_GradientBrightness", Settings.GetFloatPropertyValue("GradientBrightnessTrunk"));
|
||||
}
|
||||
else
|
||||
{
|
||||
material.SetColor("_Color", Settings.GetColorPropertyValue("Color"));
|
||||
material.SetColor("_HueVariation", Settings.GetColorPropertyValue("HueVariation"));
|
||||
material.SetColor("_TransmissionColor", Settings.GetColorPropertyValue("TransmissionColor"));
|
||||
material.SetFloat("_AmbientOcclusion", Settings.GetFloatPropertyValue("AmbientOcclusionBranch"));
|
||||
material.SetFloat("_GradientBrightness", Settings.GetFloatPropertyValue("GradientBrightnessBranch"));
|
||||
|
||||
material.SetFloat("_MaxWindStrength", Settings.GetFloatPropertyValue("WindInfluence"));
|
||||
material.SetFloat("_WindAmplitudeMultiplier", Settings.GetFloatPropertyValue("WindAmplitude"));
|
||||
}
|
||||
}
|
||||
|
||||
public void UpdateWind(Material material, WindSettings windSettings)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
Reference in New Issue
Block a user