FAEFoliageShaderController.cs 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. #if VEGETATION_STUDIO_PRO
  2. using AwesomeTechnologies.VegetationSystem;
  3. using UnityEngine;
  4. namespace AwesomeTechnologies.Shaders
  5. {
  6. public class FAEFoliageShaderController : IShaderController
  7. {
  8. public bool MatchShader(string shaderName)
  9. {
  10. if (string.IsNullOrEmpty(shaderName)) return false;
  11. return (shaderName == "FAE/Foliage" || shaderName == "Universal Render Pipeline/FAE/FAE_Foliage") ? true : false;
  12. }
  13. public bool MatchBillboardShader(Material[] materials)
  14. {
  15. return false;
  16. }
  17. public ShaderControllerSettings Settings { get; set; }
  18. public void CreateDefaultSettings(Material[] materials)
  19. {
  20. Settings = new ShaderControllerSettings
  21. {
  22. Heading = "Fantasy Adventure Environment Foliage",
  23. Description = "Description text",
  24. LODFadePercentage = false,
  25. LODFadeCrossfade = false,
  26. SampleWind = true,
  27. SupportsInstantIndirect = true
  28. };
  29. Settings.AddLabelProperty("Color");
  30. Settings.AddFloatProperty("AmbientOcclusion", "Ambient Occlusion", "", ShaderControllerSettings.GetFloatFromMaterials(materials, "_AmbientOcclusion"), 0, 1);
  31. Settings.AddLabelProperty("Translucency");
  32. Settings.AddFloatProperty("TranslucencyAmount", "Amount", "", ShaderControllerSettings.GetFloatFromMaterials(materials, "_TransmissionAmount"), 0, 10);
  33. Settings.AddFloatProperty("TranslucencySize", "Size", "", ShaderControllerSettings.GetFloatFromMaterials(materials, "_TransmissionSize"), 1, 20);
  34. Settings.AddLabelProperty("Wind");
  35. Settings.AddFloatProperty("WindInfluence", "Max Strength", "", ShaderControllerSettings.GetFloatFromMaterials(materials, "_MaxWindStrength"), 0, 1);
  36. Settings.AddFloatProperty("GlobalWindMotion", "Global motion", "", ShaderControllerSettings.GetFloatFromMaterials(materials, "_GlobalWindMotion"), 0, 1);
  37. Settings.AddFloatProperty("LeafFlutter", "Leaf flutter", "", ShaderControllerSettings.GetFloatFromMaterials(materials, "_LeafFlutter"), 0, 1);
  38. Settings.AddFloatProperty("WindSwinging", "Swinging", "", ShaderControllerSettings.GetFloatFromMaterials(materials, "_WindSwinging"), 0, 1);
  39. Settings.AddFloatProperty("WindAmplitude", "Amplitude Multiplier", "", ShaderControllerSettings.GetFloatFromMaterials(materials, "_WindAmplitudeMultiplier"), 0, 10);
  40. }
  41. public void UpdateMaterial(Material material, EnvironmentSettings environmentSettings)
  42. {
  43. if (Settings == null) return;
  44. material.SetFloat("_AmbientOcclusion", Settings.GetFloatPropertyValue("AmbientOcclusion"));
  45. material.SetFloat("_TransmissionAmount", Settings.GetFloatPropertyValue("TranslucencyAmount"));
  46. material.SetFloat("_TransmissionSize", Settings.GetFloatPropertyValue("TranslucencySize"));
  47. material.SetFloat("_MaxWindStrength", Settings.GetFloatPropertyValue("WindInfluence"));
  48. material.SetFloat("_GlobalWindMotion", Settings.GetFloatPropertyValue("GlobalWindMotion"));
  49. material.SetFloat("_LeafFlutter", Settings.GetFloatPropertyValue("LeafFlutter"));
  50. material.SetFloat("_WindSwinging", Settings.GetFloatPropertyValue("WindSwinging"));
  51. material.SetFloat("_WindAmplitudeMultiplier", Settings.GetFloatPropertyValue("WindAmplitude"));
  52. }
  53. public void UpdateWind(Material material, WindSettings windSettings)
  54. {
  55. }
  56. }
  57. }
  58. #endif