实例化海洋到主场景
This commit is contained in:
@@ -30,6 +30,9 @@ render_mode cull_disabled, diffuse_toon, specular_disabled;
|
||||
group_uniforms Shape;
|
||||
uniform float island_radius : hint_range(2.0, 60.0) = 15.0; // 米:陆地半径
|
||||
uniform float island_height : hint_range(0.5, 30.0) = 9.0; // 米:最高点高出水面多少
|
||||
// 平顶半径占 island_radius 的比例。0 = 锥形山(默认);0.7~0.85 = 台地岛。
|
||||
// 主场景要能在上面走人,必须开平顶 —— 锥形岛的斜坡无法用一块平板碰撞近似
|
||||
uniform float plateau : hint_range(0.0, 0.98) = 0.0;
|
||||
// 越小越像山、越大越像沙洲。调到 2 以上就成了一块浮在水上的饼
|
||||
uniform float profile_power : hint_range(0.5, 5.0) = 1.30;
|
||||
uniform float dip_depth : hint_range(0.0, 30.0) = 12.0; // 米:裙边扎到水下多深
|
||||
@@ -91,12 +94,14 @@ float island_at(vec2 p) {
|
||||
// 海岸线:按噪声推拉半径,否则是一个完美的圆
|
||||
r += (fbm2(p * coast_scale) - 0.5) * coast_warp;
|
||||
|
||||
// 径向剖面:山顶有平台、山脚收得快
|
||||
float prof = 1.0 - smoothstep(0.0, 1.0, clamp(r, 0.0, 1.0));
|
||||
// 径向剖面:plateau 以内是平顶,以外收到水线。
|
||||
// 注意海岸线噪声已经加进 r 了,所以平顶边缘也是弯的,不会是一个正圆
|
||||
float prof = 1.0 - smoothstep(plateau, 1.0, clamp(r, 0.0, 1.0));
|
||||
prof = pow(prof, max(profile_power, 0.001));
|
||||
float h = prof * island_height;
|
||||
|
||||
// 地表起伏:只作用在陆地上,海岸线附近淡出,否则海岸会碎成齿状
|
||||
// 地表起伏:只作用在陆地上,海岸线附近淡出,否则海岸会碎成齿状。
|
||||
// 主场景用平顶当可走地面时,这个值要压小 —— 碰撞是平的,起伏大了人会陷进坡里
|
||||
h += (fbm2(p * detail_scale) - 0.5) * detail_strength * smoothstep(1.0, 0.35, r);
|
||||
|
||||
// 裙边:岛外主动扎到水下,免得平面边缘悬空
|
||||
|
||||
Reference in New Issue
Block a user