[WL-816ze] 바다 바닥판(SpawnSeabed) — 데모 물 셰이더는 깊이로 색·거품을 정하는데 바닥이 없어 배경색이 비쳐 진파랑이던 것 → 물 아래 0.8 m 모래색 판 1장(삼각형 2 · 되돌리기 seabedEnabled 0) (#816)
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
parent
8c49c4ef16
commit
3752b0484c
|
|
@ -134,6 +134,7 @@ namespace WL.Look.Farm
|
|||
|
||||
// 🔴 816zf — 흙 데칼은 **풀보다 먼저** 만든다. 풀의 밭 제외가 이 마스크를 읽기 때문이다.
|
||||
if (cfg.softDirtEnabled != 0) SpawnSoftDirt(cfg, scene);
|
||||
if (cfg.seabedEnabled != 0) SpawnSeabed(cfg, scene);
|
||||
if (cfg.grassEnabled != 0) SpawnGrass(cfg, scene);
|
||||
if (cfg.shoreFoamEnabled != 0) SpawnShoreFoam(cfg, scene);
|
||||
|
||||
|
|
@ -305,6 +306,59 @@ namespace WL.Look.Farm
|
|||
SoftDirtSpawned = true;
|
||||
}
|
||||
|
||||
public static bool SeabedSpawned;
|
||||
public static string SeabedLog = "";
|
||||
|
||||
/// <summary>
|
||||
/// 2026-09-15 Lead 실측 — 데모 물 셰이더(`Farm_Water_Demo3` = 데모 `Water.mat`)는 **깊이**로 색·거품을 정한다.
|
||||
/// 데모 연못은 바닥이 1 m 안팎이라 청록 + 흰 물가가 나오지만, 우리 바다는 밑에 아무것도 없어 카메라 배경색이 비쳐
|
||||
/// 진파랑으로 찍혔다(PD 「데모와 느낌이 다르다」의 큰 몫). 물 아래 `seabedDepth` 에 모래색 언릿 판 1장(삼각형 2 · 드로우콜 1)을 깐다.
|
||||
/// 🔴 모바일 빌드: `Universal Render Pipeline/Unlit` 이 빌드에 포함되지 않으면 분홍 → Always Included 확인.
|
||||
/// </summary>
|
||||
public static void SpawnSeabed(WLIslandLookSettings cfg, Scene scene)
|
||||
{
|
||||
const string Name = "~WL_Seabed";
|
||||
float waterY = -1f; bool found = false;
|
||||
var mrs = Object.FindObjectsByType<MeshRenderer>(FindObjectsInactive.Include, FindObjectsSortMode.None);
|
||||
for (int i = 0; i < mrs.Length; i++)
|
||||
{
|
||||
var r = mrs[i];
|
||||
if (r == null || r.gameObject.name != "Water" || (scene.IsValid() && r.gameObject.scene != scene)) continue;
|
||||
waterY = r.transform.position.y; found = true; break;
|
||||
}
|
||||
GameObject go = null;
|
||||
for (int i = 0; i < mrs.Length; i++) if (mrs[i] != null && mrs[i].gameObject.name == Name) { go = mrs[i].gameObject; break; }
|
||||
if (go == null)
|
||||
{
|
||||
go = new GameObject(Name);
|
||||
if (scene.IsValid()) SceneManager.MoveGameObjectToScene(go, scene);
|
||||
var mf = go.AddComponent<MeshFilter>();
|
||||
var mesh = new Mesh { name = "WL_SeabedQuad" };
|
||||
mesh.vertices = new[] { new Vector3(-0.5f, 0f, -0.5f), new Vector3(-0.5f, 0f, 0.5f), new Vector3(0.5f, 0f, 0.5f), new Vector3(0.5f, 0f, -0.5f) };
|
||||
mesh.triangles = new[] { 0, 1, 2, 0, 2, 3 };
|
||||
mesh.normals = new[] { Vector3.up, Vector3.up, Vector3.up, Vector3.up };
|
||||
mesh.uv = new[] { Vector2.zero, Vector2.up, Vector2.one, Vector2.right };
|
||||
mesh.RecalculateBounds();
|
||||
mf.sharedMesh = mesh;
|
||||
var mr = go.AddComponent<MeshRenderer>();
|
||||
var sh = Shader.Find("Universal Render Pipeline/Unlit");
|
||||
var mat = new Material(sh != null ? sh : Shader.Find("Unlit/Color")) { name = "WL_Seabed(runtime)" };
|
||||
mr.sharedMaterial = mat;
|
||||
mr.shadowCastingMode = UnityEngine.Rendering.ShadowCastingMode.Off;
|
||||
mr.receiveShadows = false;
|
||||
mr.lightProbeUsage = UnityEngine.Rendering.LightProbeUsage.Off;
|
||||
}
|
||||
var m = go.GetComponent<MeshRenderer>().sharedMaterial;
|
||||
if (m.HasProperty("_BaseColor")) m.SetColor("_BaseColor", cfg.seabedColor);
|
||||
if (m.HasProperty("_Color")) m.SetColor("_Color", cfg.seabedColor);
|
||||
go.transform.position = new Vector3(0f, waterY - Mathf.Max(0.05f, cfg.seabedDepth), 0f);
|
||||
go.transform.rotation = Quaternion.identity;
|
||||
go.transform.localScale = new Vector3(Mathf.Max(1f, cfg.seabedSize), 1f, Mathf.Max(1f, cfg.seabedSize));
|
||||
go.SetActive(cfg.seabedEnabled != 0);
|
||||
SeabedSpawned = true;
|
||||
SeabedLog = "바다 바닥판 y=" + go.transform.position.y.ToString("F2") + (found ? "(물 " + waterY.ToString("F2") + ")" : "(물 미발견 · 기본 -1)") + " · 깊이 " + cfg.seabedDepth + " m";
|
||||
}
|
||||
|
||||
/// <summary>섬 둘레 거품 띠 — 풀과 같은 자리에서 만들고 같은 훅으로 다시 만든다(816j2).</summary>
|
||||
public static void SpawnShoreFoam(WLIslandLookSettings cfg, Scene scene)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -292,6 +292,20 @@ namespace WL.Look.Farm
|
|||
[Tooltip("흙 얼룩의 세기(0~1). 한 덩어리 단색으로 보이지 않게 밝기를 이만큼 흔든다.")]
|
||||
[Range(0f, 1f)] public float softDirtTexNoise = 0.08f;
|
||||
|
||||
// ───────────────────────────────── §0-b 바다 바닥 (2026-09-15 Lead 실측)
|
||||
[Header("§0-b — 물 밑 바닥판 (데모 연못은 바닥이 얕아 물이 청록 · 우리는 바닥이 없어 배경색이 비쳐 진파랑)")]
|
||||
[Tooltip("1 = 물 표면 아래에 모래색 바닥판 1장을 깐다. 데모 물 셰이더는 깊이로 색·거품을 정하므로 바닥이 있어야 데모처럼 청록 물 + 흰 물가가 나온다. 0 = 없음(배경색이 비침).")]
|
||||
public int seabedEnabled = 1;
|
||||
|
||||
[Tooltip("물 표면에서 바닥판까지 깊이(m). 얕을수록 청록·거품이 진해진다.")]
|
||||
public float seabedDepth = 0.8f;
|
||||
|
||||
[Tooltip("바닥판 한 변 길이(m). 카메라가 보는 범위만 덮으면 된다.")]
|
||||
public float seabedSize = 400f;
|
||||
|
||||
[Tooltip("바닥판 색(언릿 · sRGB). 기본 = 데모 모래색.")]
|
||||
public Color seabedColor = new Color(0.71f, 0.706f, 0.549f, 1f);
|
||||
|
||||
// ───────────────────────────────── §1 풀밭
|
||||
[Header("§1 — 섬 타일 위 풀밭 (데모와 같은 인스턴싱)")]
|
||||
[Tooltip("0 이면 풀을 깔지 않는다.")]
|
||||
|
|
|
|||
Loading…
Reference in New Issue