wip : Liminal spaces + Tidy up
This commit is contained in:
@@ -0,0 +1,77 @@
|
||||
// Place this file inside an Editor/ folder in your project
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
public class ToonBilalEditor : ShaderGUI
|
||||
{
|
||||
static readonly System.Collections.Generic.Dictionary<string, string> tooltips = new()
|
||||
{
|
||||
{ "_ToonEnabled", "Enables or disables the entire toon filter. When off, the original image is returned with no processing." },
|
||||
{ "_ShaderWeight", "Global blend weight of the shader. 0 = original image, 1 = full effect." },
|
||||
|
||||
{ "_ToonSteps", "Number of brightness bands. 2 = very graphic, 6+ = nearly smooth." },
|
||||
{ "_ShadowStrength", "Brightness of shadow areas. Lower = darker, moodier shadows like Bilal." },
|
||||
{ "_HighlightBoost", "Multiplier applied to bright areas. Higher = near-white blown-out highlights like Bilal's lit zones." },
|
||||
{ "_HighlightThreshold", "Brightness level above which highlights get blown out. Lower = more surfaces affected." },
|
||||
|
||||
{ "_OutlineThickness", "Base outline thickness in pixels." },
|
||||
{ "_OutlineThicknessVar", "World-space random thickness variation. 0 = uniform, 1 = organic hand-drawn look." },
|
||||
{ "_DepthThreshold", "Depth outline detection threshold in meters (linearized). Higher = only detects strong silhouettes, ignores polygon edges." },
|
||||
{ "_ColorThreshold", "Color outline detection threshold. Lower = more outlines detected." },
|
||||
{ "_DepthOutlineStrength", "Strength of depth-detected outlines (silhouettes, geometric edges)." },
|
||||
{ "_ColorOutlineStrength", "Strength of color-detected outlines (material changes)." },
|
||||
{ "_OutlineSoftness", "Blends between thin (0) and thick soft (1) outlines." },
|
||||
{ "_OutlineColorBlend", "How much surface color bleeds into the outline. 0 = black, 1 = colored." },
|
||||
{ "_OutlineDarken", "Darkens the surface color for the outline. 1 = fully black." },
|
||||
{ "_OutlineDistanceFade", "Distance in meters at which outlines fully fade out. Prevents polygon edges from showing on distant geometry." },
|
||||
|
||||
{ "_OutlineFadeStart", "Brightness at which outlines start fading on bright surfaces." },
|
||||
{ "_OutlineFadeEnd", "Brightness at which outlines are fully gone on bright surfaces." },
|
||||
{ "_OutlineFadeStrength", "Strength of outline fade on bright areas." },
|
||||
{ "_OutlineBrightMin", "Minimum outline visibility even on very bright surfaces." },
|
||||
|
||||
{ "_HatchTex", "Hatching texture (black strokes on white). Use a pencil or pen texture." },
|
||||
{ "_HatchScale", "World-space scale of hatching layer 1." },
|
||||
{ "_HatchStrength", "Global hatching intensity. 0 = none, 1 = full." },
|
||||
{ "_HatchThreshold", "Shadow threshold for hatching. Higher = hatching only in darkest zones." },
|
||||
{ "_CurvatureStrength", "Amplifies detected curvature. Higher = more hatching on rounded surfaces." },
|
||||
{ "_FlatSurface", "Minimum hatching on flat surfaces. 0 = flat surfaces fully hatched too." },
|
||||
|
||||
{ "_HatchScale2", "Scale of cross-hatch layer 2, rotated to a different angle." },
|
||||
{ "_HatchScale3", "Scale of third hatch layer, used in very dark and curved zones." },
|
||||
{ "_HatchRotation", "Rotation angle in radians between hatch layers. 0.785 ≈ 45°." },
|
||||
{ "_HatchLayerBlend", "Base blend toward cross-hatch. Increases automatically in darker zones." },
|
||||
{ "_HatchOrganicNoise", "Organic deformation via FBM noise. 0 = rigid, 1 = wavy hand-drawn." },
|
||||
{ "_HatchOrganicScale", "Scale of organic deformation noise." },
|
||||
{ "_HatchDensityCurve", "Density curve shape. Lower = wider shadow coverage." },
|
||||
{ "_TriplanarSharpness", "Sharpness of triplanar projection blending." },
|
||||
|
||||
{ "_HatchColorBlend", "Surface color blend into hatching. 0 = black strokes, 1 = colored strokes." },
|
||||
{ "_HatchDarken", "Darkens surface color for hatching strokes." },
|
||||
{ "_HatchGrainScale", "Scale of world-space paper grain on hatching." },
|
||||
{ "_HatchGrainStrength", "Strength of paper grain blended into hatching." },
|
||||
{ "_HatchPressure", "Simulated pen pressure variation. 0 = uniform, 1 = irregular." },
|
||||
|
||||
{ "_BrushTex", "Brush texture for gouache shadow areas." },
|
||||
{ "_GouacheScale", "World-space scale of gouache brush texture." },
|
||||
{ "_GouacheStrength", "Strength of gouache effect in shadow areas." },
|
||||
{ "_GouacheThreshold", "Brightness below which gouache activates." },
|
||||
{ "_GouacheSaturation", "Saturation boost in gouache areas. >1 = richer colors." },
|
||||
{ "_GouachePosterize", "Posterization steps for gouache. 1 = flat, 6 = continuous." },
|
||||
{ "_GouacheBlend", "Blend between hatching and gouache in dark zones." },
|
||||
};
|
||||
|
||||
public override void OnGUI(MaterialEditor editor, MaterialProperty[] props)
|
||||
{
|
||||
foreach (var prop in props)
|
||||
{
|
||||
string tooltip = tooltips.ContainsKey(prop.name) ? tooltips[prop.name] : prop.displayName;
|
||||
GUIContent label = new GUIContent(prop.displayName, tooltip);
|
||||
editor.ShaderProperty(prop, label);
|
||||
}
|
||||
|
||||
EditorGUILayout.Space();
|
||||
editor.RenderQueueField();
|
||||
editor.EnableInstancingField();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7439eb45dacc6d94a974b63ec94e8255
|
||||
+30
-29
@@ -3,11 +3,11 @@ using UnityEngine;
|
||||
namespace Unheimlich.World.HouseOfLeaves
|
||||
{
|
||||
/// <summary>
|
||||
/// Animates the sand terrain rising from below the corridor floor
|
||||
/// based on the player's progression through the corridor.
|
||||
/// Animates the sand terrain shader progression based on the player's
|
||||
/// advancement through the corridor.
|
||||
///
|
||||
/// The terrain starts buried underground and slowly emerges as the
|
||||
/// player advances, simulating sand flooding the corridor from below.
|
||||
/// Drives the _Progression float on the sand material from 0 to 1,
|
||||
/// simulating sand flooding the corridor as the player advances.
|
||||
/// </summary>
|
||||
public class SandTerrainController : MonoBehaviour
|
||||
{
|
||||
@@ -19,23 +19,22 @@ namespace Unheimlich.World.HouseOfLeaves
|
||||
[Tooltip("The HouseOfLeavesController driving the progression value.")]
|
||||
[SerializeField] private HouseOfLeavesController _controller;
|
||||
|
||||
[Tooltip("The sand terrain Transform to animate.")]
|
||||
[Tooltip("The sand terrain Transform holding the sand material.")]
|
||||
[SerializeField] private Transform _sandTerrain;
|
||||
|
||||
[Header("Rise Settings")]
|
||||
[Tooltip("Y position of the terrain at the start (buried underground).")]
|
||||
[SerializeField] private float _startY = -4f;
|
||||
|
||||
[Tooltip("Y position of the terrain at full progression (emerged).")]
|
||||
[SerializeField] private float _endY = 0.5f;
|
||||
|
||||
[Tooltip("Lerp speed applied to the vertical movement each frame.")]
|
||||
[SerializeField] private float _lerpSpeed = 2f;
|
||||
|
||||
[Tooltip("Animation curve mapping progression [0,1] to rise amount [0,1]. " +
|
||||
"Use this to delay the rise until mid-corridor for example.")]
|
||||
[Header("Progression Settings")]
|
||||
[Tooltip("Animation curve mapping progression [0,1] to shader value [0,1]. " +
|
||||
"Use this to delay or ease the sand appearance.")]
|
||||
[SerializeField] private AnimationCurve _riseCurve = AnimationCurve.EaseInOut(0f, 0f, 1f, 1f);
|
||||
|
||||
// ─────────────────────────────────────────────────────────────────────────
|
||||
// Private Fields
|
||||
// ─────────────────────────────────────────────────────────────────────────
|
||||
|
||||
private Renderer _renderer;
|
||||
|
||||
private static readonly int ProgressionID = Shader.PropertyToID("_Progression");
|
||||
|
||||
// ─────────────────────────────────────────────────────────────────────────
|
||||
// Unity Messages
|
||||
// ─────────────────────────────────────────────────────────────────────────
|
||||
@@ -54,22 +53,24 @@ namespace Unheimlich.World.HouseOfLeaves
|
||||
return;
|
||||
}
|
||||
|
||||
// Initialize position immediately without lerp.
|
||||
Vector3 startPos = _sandTerrain.position;
|
||||
startPos.y = _startY;
|
||||
_sandTerrain.position = startPos;
|
||||
_renderer = _sandTerrain.GetComponent<Renderer>();
|
||||
|
||||
if (_renderer == null)
|
||||
{
|
||||
Debug.LogError("[SandTerrainController] No Renderer found on sand terrain.");
|
||||
return;
|
||||
}
|
||||
|
||||
// Initialize shader progression to zero.
|
||||
_renderer.material.SetFloat(ProgressionID, 0f);
|
||||
}
|
||||
|
||||
private void Update()
|
||||
{
|
||||
if (_controller == null || _sandTerrain == null) return;
|
||||
if (_controller == null || _renderer == null) return;
|
||||
|
||||
float t = _riseCurve.Evaluate(_controller.Progression);
|
||||
float targetY = Mathf.Lerp(_startY, _endY, t);
|
||||
|
||||
Vector3 pos = _sandTerrain.position;
|
||||
pos.y = Mathf.Lerp(pos.y, targetY, Time.deltaTime * _lerpSpeed);
|
||||
_sandTerrain.position = pos;
|
||||
float t = _riseCurve.Evaluate(_controller.Progression);
|
||||
_renderer.material.SetFloat(ProgressionID, t);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -175,7 +175,7 @@ public class ScarecrowFire : MonoBehaviour
|
||||
|
||||
el.VFX.SetActive(true);
|
||||
|
||||
Vector3 startScale = el.VFX.transform.localScale;
|
||||
Vector3 startScale = Vector3.zero;
|
||||
Vector3 targetScale = el.OriginalScale;
|
||||
float elapsed = 0f;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user