升级6.4.升级水,升级天气
This commit is contained in:
@@ -7,6 +7,7 @@ using UnityEditor;
|
||||
using UnityEditor.Rendering;
|
||||
using UnityEditor.Rendering.HighDefinition;
|
||||
using UnityEngine;
|
||||
using WaveHarmonic.Crest.Editor.Settings;
|
||||
|
||||
namespace WaveHarmonic.Crest.Editor
|
||||
{
|
||||
@@ -27,6 +28,13 @@ namespace WaveHarmonic.Crest.Editor
|
||||
{ "_Crest_HeightsOnly", "Treats the texture as a heightmap and reads from the R channel" },
|
||||
}
|
||||
},
|
||||
{
|
||||
"Crest/Inputs/Dynamic Waves/Add Bump", new()
|
||||
{
|
||||
{ "_Crest_Amplitude", "The vertical radius of the bump. How much the surface will rise or fall." },
|
||||
{ "_Crest_Radius", "The horizontal radius of the bump." },
|
||||
}
|
||||
},
|
||||
{
|
||||
"Crest/Inputs/Flow/Add From Texture", new()
|
||||
{
|
||||
@@ -66,16 +74,24 @@ namespace WaveHarmonic.Crest.Editor
|
||||
WaterShaderUtility.k_ShaderName, new()
|
||||
{
|
||||
{ "_Crest_NormalsStrengthOverall", "Strength of the final surface normal (both wave normal and normal map)" },
|
||||
{ "_Crest_ApplyDisplacementNormals", "Whether to sample the displacement maps (Animated Waves and Dynamic Waves) for normal contributions." },
|
||||
{ "_Crest_NormalMapEnabled", "Whether to add normal detail from a texture. Can be used to add visual detail to the water surface" },
|
||||
{ "_Crest_NormalMapTexture", "Normal map texture" },
|
||||
{ "_Crest_NormalMapStrength", "Strength of normal map influence" },
|
||||
{ "_Crest_NormalMapScale", "Base scale of multi-scale normal map texture" },
|
||||
{ "_Crest_NormalMapScrollSpeed", "Speed of the normal maps scrolling" },
|
||||
{ "_Crest_NormalMapTurbulenceEnabled", "Increase chance of sparkles where water is turbulent" },
|
||||
{ "_Crest_NormalMapTurbulenceStrength", "Strength of the normal map influence where turbulent" },
|
||||
{ "_Crest_NormalMapTurbulenceCoverage", "The threshold where turbulence triggers this effect.\n\nValues above 0.9 may be too high for calmer wave conditions, as it will trigger the effect where water is not turbulent. Furthermore, a value of one or very close one can cause a pop when weighing out waves to zero" },
|
||||
{ "_Crest_AbsorptionColor", "Works as a color (ie red adds red rather than subtracts red). This value is converted to real absorption values (proportion of light getting absorbed by water in atoms per meter). Alpha channel is for density. High alpha and darker color reduces transparency" },
|
||||
{ "_Crest_Scattering", "Light scattered by the water towards the viewer (in-scattered) per meter. Brighter color reduces transparency" },
|
||||
{ "_Crest_Anisotropy", "The directionality of the scattering where zero means scattered in all directions. The further towards one, the less visible soft shadows will be" },
|
||||
{ "_Crest_DirectTerm", "Scale direct light contribution to volume lighting" },
|
||||
{ "_Crest_DirectTermAdditional", "Scale additional lights contribution to volume lighting" },
|
||||
{ "_Crest_AmbientTerm", "Scale ambient light contribution to volume lighting" },
|
||||
{ "_Crest_ShadowsAffectsAmbientFactor", "How much shadows affect ambient lighting. Typically this not required, but can help scenes with large shadowed areas" },
|
||||
{ "_Crest_AdditionalLightsBlend", "How much the additional light contributions blend with scattering." },
|
||||
{ "_Crest_ApplyFresnelToVolumeLighting", "Applies the fresnel to volume lighting to help the surface blend with the horizon in the form of being a mirror. Typically, only suitable with full smoothness (unless skybox is designed for water rather than earth)." },
|
||||
{ "_Crest_SSSEnabled", "Whether to to emulate light scattering through waves" },
|
||||
{ "_Crest_SSSIntensity", "Direct light contribution intensity. Applied to the scattering color. This effect is best if subtle" },
|
||||
{ "_Crest_SSSPinchMinimum", "Higher the value the more scattering is towards the peaks of the waves" },
|
||||
@@ -85,6 +101,7 @@ namespace WaveHarmonic.Crest.Editor
|
||||
{ "_Crest_Specular", "Strength of specular lighting response" },
|
||||
{ "_Crest_Occlusion", "Strength of reflection" },
|
||||
{ "_Crest_OcclusionUnderwater", "Strength of reflection when underwater. Keep this at zero to avoid skybox reflections which look incorrect when underwater, unless you want reflections from Planar Reflections or probes" },
|
||||
{ "_Crest_Fresnel", "The fresnel power. Decrease to increase strength of reflections." },
|
||||
{ "_Crest_Smoothness", "Smoothness of surface. A value of one is ideal for flat water only" },
|
||||
{ "_Crest_SmoothnessFar", "Material smoothness at far distance from camera. Helps to spread out specular highlight in mid-to-background. From a theory point of view, models transfer of normal detail to microfacets in BRDF" },
|
||||
{ "_Crest_SmoothnessFarDistance", "Definition of far distance" },
|
||||
@@ -93,6 +110,7 @@ namespace WaveHarmonic.Crest.Editor
|
||||
{ "_Crest_PlanarReflectionsEnabled", "Dynamically rendered 'reflection plane' style reflections. Requires Reflections to be enabled on the Water Renderer" },
|
||||
{ "_Crest_PlanarReflectionsIntensity", "Intensity of the planar reflections" },
|
||||
{ "_Crest_PlanarReflectionsDistortion", "How much the water normal affects the planar reflection" },
|
||||
{ "_Crest_PlanarReflectionsApplySmoothness", "Whether to apply smoothness to planar reflection sample via mip-map blending. Enabling will likely incur artifacts with most perturbed water" },
|
||||
{ "_Crest_PlanarReflectionsRoughness", "Controls the mipmap range" },
|
||||
{ "_Crest_RefractionStrength", "How strongly light is refracted when passing through water surface" },
|
||||
{ "_Crest_RefractiveIndexOfWater", "Index of refraction of water - typically left at 1.333. Changing this value can increase/decrease the size of the Snell's window" },
|
||||
@@ -107,6 +125,16 @@ namespace WaveHarmonic.Crest.Editor
|
||||
{ "_Crest_FoamIntensityAlbedo", "Scale intensity of diffuse lighting" },
|
||||
{ "_Crest_FoamSmoothness", "Smoothness of foam material" },
|
||||
{ "_Crest_FoamNormalStrength", "Strength of the generated normals" },
|
||||
{ "_Crest_FoamBioluminescenceEnabled", "Enables a foam-based bioluminescence. This reuses the foam sample" },
|
||||
{ "_Crest_FoamBioluminescenceColor", "The color and intensity of the bioluminescence" },
|
||||
{ "_Crest_FoamBioluminescenceIntensity", "The intensity of the bioluminescent foam" },
|
||||
{ "_Crest_FoamBioluminescenceMaximumDepth", "The maximum water depth where bioluminescence can appear. This can be used to keep bioluminescence localized to the shoreline" },
|
||||
{ "_Crest_FoamBioluminescenceSeaLevelOnly", "Only render foam bioluminescence at sea level. This will fade bioluminescence to be fully gone at 1m from sea level." },
|
||||
{ "_Crest_FoamBioluminescenceGlowIntensity", "The intensity of the bioluminescent glow" },
|
||||
{ "_Crest_FoamBioluminescenceGlowCoverage", "The coverage of the bioluminescent glow. Glow is based on raw foam data which makes it more present than foam" },
|
||||
{ "_Crest_FoamBioluminescenceSparklesEnabled", "Whether to apply bioluminescent sparkles. This uses the green channel of the foam texture as an emissive map" },
|
||||
{ "_Crest_FoamBioluminescenceSparklesIntensity", "The intensity of the bioluminescent sparkles" },
|
||||
{ "_Crest_FoamBioluminescenceSparklesCoverage", "The coverage of the bioluminescent sparkles. Sparkles placement is based on raw foam data which makes it more present than foam" },
|
||||
{ "_Crest_CausticsEnabled", "Approximate rays being focused/defocused on underwater surfaces" },
|
||||
{ "_Crest_CausticsTexture", "Caustics texture" },
|
||||
{ "_Crest_CausticsStrength", "Intensity of caustics effect" },
|
||||
@@ -115,13 +143,15 @@ namespace WaveHarmonic.Crest.Editor
|
||||
{ "_Crest_CausticsTextureAverage", "The 'mid' value of the caustics texture, around which the caustic texture values are scaled. Decreasing this value will reduce the caustics darkening underwater surfaces" },
|
||||
{ "_Crest_CausticsFocalDepth", "The depth at which the caustics are in focus" },
|
||||
{ "_Crest_CausticsDepthOfField", "The range of depths over which the caustics are in focus" },
|
||||
{ "_Crest_CausticsForceDistortion", "Forces the distortion texture to be applied for above water. This can be used to distort caustics even when there is no waves" },
|
||||
{ "_Crest_CausticsDistortionTexture", "Texture to distort caustics. Only applicable to underwater effect for now" },
|
||||
{ "_Crest_CausticsDistortionStrength", "How much the caustics texture is distorted" },
|
||||
{ "_Crest_CausticsDistortionScale", "The scale of the distortion pattern used to distort the caustics" },
|
||||
{ "_Crest_CausticsMotionBlur", "How much caustics are blurred when advected by flow" },
|
||||
{ "CREST_FLOW", "Flow is horizontal motion of water. Flow must be enabled on the Water Renderer to generate flow data" },
|
||||
{ "_CREST_FLOW_LOD", "Flow is horizontal motion of water. Flow must be enabled on the Water Renderer to generate flow data" },
|
||||
{ "_Crest_AlbedoEnabled", "Enable the Albedo simulation layer. Albedo must be enabled on the Water" },
|
||||
{ "_Crest_AlbedoIgnoreFoam", "Whether Albedo renders over the top of foam or not." },
|
||||
{ "_Crest_TransparencyMinimumAlpha", "The minimum alpha value for transparency. Makes water contribution to the final image stronger instead of the scene behind it" },
|
||||
}
|
||||
},
|
||||
};
|
||||
@@ -147,6 +177,25 @@ namespace WaveHarmonic.Crest.Editor
|
||||
}
|
||||
}
|
||||
|
||||
internal static readonly List<string> s_HiddenCategories = new();
|
||||
static bool s_Initialized;
|
||||
internal static void FilterCategories()
|
||||
{
|
||||
// Only need to do it once after compile.
|
||||
if (s_Initialized)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var settings = ProjectSettings.Instance.CurrentPlatformSettings;
|
||||
s_HiddenCategories.Clear();
|
||||
if (!settings.AlbedoSimulation) s_HiddenCategories.Add("Albedo");
|
||||
if (!settings.FoamBioluminescence) s_HiddenCategories.Add("Bioluminescence");
|
||||
if (!settings.PlanarReflections) s_HiddenCategories.Add("Reflections (Planar)");
|
||||
if (!settings.SimpleTransparency) s_HiddenCategories.Add("Simple Transparency");
|
||||
s_Initialized = true;
|
||||
}
|
||||
|
||||
internal static MaterialProperty[] FilterProperties(MaterialProperty[] properties)
|
||||
{
|
||||
// Show specular control.
|
||||
@@ -166,9 +215,25 @@ namespace WaveHarmonic.Crest.Editor
|
||||
}
|
||||
#endif
|
||||
|
||||
return properties
|
||||
.Where(x => (specular || x.name != "_Crest_Specular") && x.name != "_Crest_Absorption")
|
||||
.ToArray();
|
||||
var settings = ProjectSettings.Instance.CurrentPlatformSettings;
|
||||
var filtered = properties.Where(x => (specular || x.name != "_Crest_Specular") && x.name != "_Crest_Absorption");
|
||||
|
||||
if (!settings.CausticsForceDistortion)
|
||||
{
|
||||
filtered = filtered.Where(x => x.name != "_Crest_CausticsForceDistortion");
|
||||
}
|
||||
|
||||
if (!settings.NormalMaps)
|
||||
{
|
||||
filtered = filtered.Where(x => !x.name.StartsWithNoAlloc("_Crest_NormalMap"));
|
||||
}
|
||||
|
||||
if (!settings.ShadowSimulation)
|
||||
{
|
||||
filtered = filtered.Where(x => x.name != "_Crest_ShadowsAffectsAmbientFactor");
|
||||
}
|
||||
|
||||
return filtered.ToArray();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -232,7 +297,8 @@ namespace WaveHarmonic.Crest.Editor
|
||||
|
||||
protected override void DrawSurfaceInputs(Material material)
|
||||
{
|
||||
ShaderGraphPropertyDrawers.DrawShaderGraphGUI(_Editor, _Properties, MaterialTooltips.s_Grouped[_ShaderName]);
|
||||
WaterShaderUtility.FilterCategories();
|
||||
ShaderGraphPropertyDrawers.DrawShaderGraphGUI(_Editor, _Properties, MaterialTooltips.s_Grouped[_ShaderName], WaterShaderUtility.s_HiddenCategories);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -274,7 +340,8 @@ namespace WaveHarmonic.Crest.Editor
|
||||
|
||||
public override void DrawSurfaceInputs(Material material)
|
||||
{
|
||||
ShaderGraphPropertyDrawers.DrawShaderGraphGUI(_Editor, _Properties, MaterialTooltips.s_Grouped[_ShaderName]);
|
||||
WaterShaderUtility.FilterCategories();
|
||||
ShaderGraphPropertyDrawers.DrawShaderGraphGUI(_Editor, _Properties, MaterialTooltips.s_Grouped[_ShaderName], WaterShaderUtility.s_HiddenCategories);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -307,8 +374,10 @@ namespace WaveHarmonic.Crest.Editor
|
||||
return;
|
||||
}
|
||||
|
||||
WaterShaderUtility.FilterCategories();
|
||||
|
||||
var name = (materialEditor.customShaderGUI as HighDefinitionCustomShaderGUI)._ShaderName;
|
||||
ShaderGraphPropertyDrawers.DrawShaderGraphGUI(materialEditor, properties, MaterialTooltips.s_Grouped[name]);
|
||||
ShaderGraphPropertyDrawers.DrawShaderGraphGUI(materialEditor, properties, MaterialTooltips.s_Grouped[name], WaterShaderUtility.s_HiddenCategories);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user