feat: 更新 IntoHole 的球体、滑槽和环境资产
- 为铁球、陶瓷球和木球制作风格化材质,归档 CC0 原始参考 - 更新方形球洞和实心滑槽,统一 90° 弯槽并兼容旧存档 - 用顺流泡沫表示水流方向,为冰块制作三种交错的裂纹 - 同步 Blender 源资产、Godot 加载、工坊和试玩预览
@@ -21,11 +21,11 @@
|
|||||||
```sh
|
```sh
|
||||||
./scripts/workshop.zsh
|
./scripts/workshop.zsh
|
||||||
./scripts/showcase.zsh
|
./scripts/showcase.zsh
|
||||||
./scripts/underpass.zsh
|
./scripts/materials.zsh
|
||||||
./scripts/playtest.zsh
|
./scripts/playtest.zsh
|
||||||
```
|
```
|
||||||
|
|
||||||
四个 `.command` 双击快捷方式也在 `scripts/`,仅转调对应 zsh 文件。复杂调度在 [studio.py](scripts/python/studio.py) 和 [baseline.py](scripts/python/baseline.py),它们是开发工具,不是游戏主体。
|
`.command` 双击快捷方式也在 `scripts/`,仅转调对应 zsh 文件。复杂调度在 [studio.py](scripts/python/studio.py) 和 [baseline.py](scripts/python/baseline.py),它们是开发工具,不是游戏主体。
|
||||||
|
|
||||||
## Godot 工程
|
## Godot 工程
|
||||||
|
|
||||||
@@ -53,13 +53,13 @@ assets/blocks/directional_boost/
|
|||||||
|
|
||||||
| 类型 | 资源 |
|
| 类型 | 资源 |
|
||||||
| --- | --- |
|
| --- | --- |
|
||||||
| [chutes](assets/chutes) | `straight`、`turn_cw`、`turn_ccw`、`gentle`、`steep`、`y_merge`。 |
|
| [chutes](assets/chutes) | `straight`、`turn_90`、`gentle`、`steep`、`y_merge`。 |
|
||||||
| [balls](assets/balls) | `iron_ball`,物理行为在 [physics.gd](assets/balls/iron_ball/physics.gd)。 |
|
| [balls](assets/balls) | `wood_ball`、`ceramic_ball`、`iron_ball`,共享物理行为在 [physics.gd](assets/balls/shared/physics.gd)。 |
|
||||||
| [blocks](assets/blocks) | `wall`、`directional_boost`。 |
|
| [blocks](assets/blocks) | `wall`、`directional_boost`、`water`、`ice`。 |
|
||||||
| [goals](assets/goals) | `goal_hole`。 |
|
| [goals](assets/goals) | `goal_hole`。 |
|
||||||
| [collections](assets/collections) | `baseline` 与 `storybook` 两个资源集合,保存目录配置、共享制作代码和整套源文件。 |
|
| [collections](assets/collections) | `baseline` 与 `storybook` 两个资源集合,保存目录配置、共享制作代码和整套源文件。 |
|
||||||
|
|
||||||
当前模型直接放在资源目录,早期模型变体在相同资源的 `baseline/`。每个资源的 `source/build.py` 是制作入口,复用 [集合制作代码](assets/collections/storybook/source/build.py),只导出目标资源。所有实际制作代码均在 `assets/`;[asset.zsh](scripts/asset.zsh) 只负责执行。
|
当前模型直接放在资源目录,早期模型变体在相同资源的 `baseline/`。每个资源的 `source/build.py` 是制作入口,复用 [集合制作代码](assets/collections/storybook/source/build.py),只导出目标资源。原木球和陶瓷球由 [球材质制作代码](assets/balls/shared/source/build_materials.py) 复用铁球网格,贴图与独立源文件留在各球目录。所有实际制作代码均在 `assets/`;[asset.zsh](scripts/asset.zsh) 只负责执行。
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
./scripts/asset.zsh directional_boost
|
./scripts/asset.zsh directional_boost
|
||||||
@@ -75,12 +75,37 @@ assets/blocks/directional_boost/
|
|||||||
|
|
||||||
- 工坊:[workshop.tscn](designer/scenes/workshop.tscn)。编辑编排:[studio.gd](designer/scripts/studio.gd);摆放:[placement.gd](designer/scripts/placement.gd);存档:[level_data.gd](designer/scripts/level_data.gd)。
|
- 工坊:[workshop.tscn](designer/scenes/workshop.tscn)。编辑编排:[studio.gd](designer/scripts/studio.gd);摆放:[placement.gd](designer/scripts/placement.gd);存档:[level_data.gd](designer/scripts/level_data.gd)。
|
||||||
- 工坊默认空白,保存到 [designer/drafts](designer/drafts)。内置示例从 `playtest/` 读取,保存时写入草稿副本,不直接覆盖实验原件。
|
- 工坊默认空白,保存到 [designer/drafts](designer/drafts)。内置示例从 `playtest/` 读取,保存时写入草稿副本,不直接覆盖实验原件。
|
||||||
- 展示:[showcase.tscn](playtest/showcase/scenes/showcase.tscn);通孔:[underpass.tscn](playtest/underpass/scenes/underpass.tscn);早期试玩:[main.tscn](playtest/baseline/scenes/main.tscn)。
|
- 展示:[showcase.tscn](playtest/showcase/scenes/showcase.tscn);早期试玩:[main.tscn](playtest/baseline/scenes/main.tscn)。
|
||||||
- `levels/` 仅用于明确发布的正式关卡。不要把试跑成功、示例或工坊草稿自动当作正式关卡。
|
- `levels/` 仅用于明确发布的正式关卡。不要把试跑成功、示例或工坊草稿自动当作正式关卡。
|
||||||
- [blocks.md](references/design/blocks.md) 是方块完整规则的唯一维护文档,保留“滑槽 / 实体”结构;[physics_system.md](references/design/physics_system.md) 管理物理和小球数据;[game_reference.md](references/design/game_reference.md) 管理整体玩法及参考方向。
|
- [blocks.md](references/design/blocks.md) 是方块完整规则的唯一维护文档,保留“滑槽 / 实体”结构;[physics_system.md](references/design/physics_system.md) 管理物理和小球数据;[game_reference.md](references/design/game_reference.md) 管理整体玩法及参考方向。
|
||||||
- 外部游戏资料在 `references/games/`,机械笔记在 `references/mechanics/`。区分资料中的建议、用户指令与已确认规则。
|
- 外部游戏资料在 `references/games/`,机械笔记在 `references/mechanics/`。区分资料中的建议、用户指令与已确认规则。
|
||||||
|
- 原木球、陶瓷球、铁球半径均为 0.3 m;质量和空气响应来自物理预设。当前木球 60 kg、陶瓷球 330 kg、铁球约 890.08 kg;`dragCoefficient` 分别为 0.47 / 0.04 / 0.47。铁球与其他球使用同一空气力公式;当前风场下因质量和正常接触阻力而难以推动。禁止为铁球设置风力豁免、零阻力特例或速度/位置锁定,也不得在验证中覆盖真实铁球配置来掩盖问题。
|
||||||
|
- 小球对照入口:[materials.tscn](playtest/materials/scenes/materials.tscn),支持滚动入洞、同风场和定向加速三种场景;`./scripts/run.zsh test-balls` 运行专项检查。
|
||||||
|
- 弯槽统一为一种 **90°弯槽**(`turn_90`),双向通行,保留 0° / 90° / 180° / 270° 四个旋转朝向。菜单、库存和新存档不得再区分左右弯槽;左转/右转仅描述球的行进方向。旧存档载入时,`turn_cw` 保持角度,`turn_ccw` 额外顺时针转 90°;V1 槽上起点的路径参数反转以保持原球心与来向。保留旧源文件和历史快照,不自动改写用户草稿。
|
||||||
|
- 五种滑槽均采用实心底座,仅保留顶部滚动槽;模型和碰撞体中不得恢复底部通孔。底孔实验场景与入口已删除。
|
||||||
- 定向加速方块每次固定增加 **5 m/s**,工坊与运行中均不可调;旧存档的 `speedGain` 不得覆盖该规则。
|
- 定向加速方块每次固定增加 **5 m/s**,工坊与运行中均不可调;旧存档的 `speedGain` 不得覆盖该规则。
|
||||||
|
|
||||||
|
- 滑槽以静态碰撞体存在,不受重力或球撞击推动,**可以悬空,不需要在路线下方铺墙承托**。玩家摆放的一面依附条件属于搭建规则,不是重力支撑条件。空中点选格和预览只用于显示/选取,不得添加隐藏承托碰撞体。
|
||||||
|
- 普通教学关的小球放在固定的定向加速方块上,从静止释放并经真实顶面接触起步;不要专门铺起跑斜坡或直接设置球的初速度。缓坡、急坡用于教学路线的高差衔接。受控物理验证中的自由落体等对照球按其验证目标设置。
|
||||||
|
- 工坊侧面拼接与玩家格位放置共用 [placement.gd](designer/scripts/placement.gd) 的 `align_surfaces()`,预览和提交均按资产槽口的实际滚动面连接;禁止另写同底对齐或将 Y 强制取整至 0.5 m。X/Z 保持网格,Y 保留连接精度。顶面点击仍用于叠放,手动坐标和旧存档不自动吸附;专项入口为 `./scripts/run.zsh test-alignment`。
|
||||||
|
|
||||||
|
## 玩家操作:减少非思考时间
|
||||||
|
|
||||||
|
- 玩家关卡使用**屏幕正下方的方块模型缩略图栏**,缩略图需清楚表达滑槽形状和当前朝向,不能只用文字按钮代替。
|
||||||
|
- 后续新建的玩家测试关从零预铺滑槽开始。关卡的标准解单独保存,供验收和玩家主动查阅。水、冰各五个独立场景分别在 [水关](playtest/water/scenes) 和 [冰关](playtest/ice/scenes),入口为 `./scripts/water.zsh` 与 `./scripts/ice.zsh`。
|
||||||
|
- 玩家测试关从场上已有方块动态生成可依附的空格,允许向参考路线以外延伸。参考解仅供验收,关卡数据不设可放位置白名单。
|
||||||
|
- **点击缩略图选中类型,再点击场景格子立即放置**;不增加“选中位置 → 放置/确认”步骤。放置后保留当前类型与朝向,支持连续铺设。
|
||||||
|
- **重复点击当前选中的同一个缩略图,顺时针旋转 90°**;缩略图与待放预览同步显示朝向。旋转不消耗库存,不直接改动已放置的滑槽。
|
||||||
|
- 缩略图栏附带**擦除选项**。点击后进入持续擦除状态,再点击玩家放置的滑槽立即消除并回收对应库存;点击方块缩略图退出擦除状态。固定地图、起点、球洞和小球不可擦除,点空格不产生库存。
|
||||||
|
- 库存与关卡配额仍需检查,释放后和暂停期间均锁定搭建/擦除。缩略图、擦除工具等 UI 点击不得同时触发场景操作。
|
||||||
|
- 此约定适用于玩家体验及教学关。关卡制作工坊可以保留精确编辑控件;不要把制作工具的多次确认流程套用到玩家关卡。
|
||||||
|
|
||||||
|
## 工坊编辑工具
|
||||||
|
|
||||||
|
- “重置”替代原“重做”按钮,一次点击清空本关全部方块、小球和球洞,运行/暂停中也可停止并清空;清空可撤销。不再提供“新建空白”入口。
|
||||||
|
- 橡皮擦在工坊素材分类下方,选中后单击任意方块立即删除并保持擦除模式,包括水、冰和球洞;空地和小球不删除。再次点击橡皮擦或点击素材/分类退出,模拟运行/暂停期间禁止擦除。
|
||||||
|
- “重试 / 返回编辑”保留当前布局;重置和擦除不自动改写磁盘存档。玩家教学关仍按上面的固定地图/库存保护规则执行。
|
||||||
|
|
||||||
## 验证与迁移记录
|
## 验证与迁移记录
|
||||||
|
|
||||||
- 检查脚本在 `playtest/checks/`,早期专项在 `playtest/baseline/checks/`,截图脚本在 `playtest/captures/`。
|
- 检查脚本在 `playtest/checks/`,早期专项在 `playtest/baseline/checks/`,截图脚本在 `playtest/captures/`。
|
||||||
|
|||||||
@@ -6,6 +6,8 @@
|
|||||||
./scripts/workshop.zsh
|
./scripts/workshop.zsh
|
||||||
```
|
```
|
||||||
|
|
||||||
|
工坊中,“重置”清空当前关卡全部内容;选择“橡皮擦”后单击方块可连续删除,两者都支持撤销。
|
||||||
|
|
||||||
也可双击 [scripts/Workshop.command](scripts/Workshop.command)。完整文件索引与归档规则见 [AGENTS.md](AGENTS.md)。
|
也可双击 [scripts/Workshop.command](scripts/Workshop.command)。完整文件索引与归档规则见 [AGENTS.md](AGENTS.md)。
|
||||||
|
|
||||||
| 目录 | 用途 |
|
| 目录 | 用途 |
|
||||||
@@ -24,7 +26,10 @@
|
|||||||
|
|
||||||
```sh
|
```sh
|
||||||
./scripts/showcase.zsh
|
./scripts/showcase.zsh
|
||||||
./scripts/underpass.zsh
|
./scripts/materials.zsh
|
||||||
|
./scripts/tutorial.zsh
|
||||||
|
./scripts/water.zsh
|
||||||
|
./scripts/ice.zsh
|
||||||
./scripts/playtest.zsh
|
./scripts/playtest.zsh
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -32,4 +37,16 @@ Godot 工程入口是 [godot_engine/project.godot](godot_engine/project.godot)
|
|||||||
|
|
||||||
定向加速方块固定增加 **5 m/s**,工坊与运行中均不可调;见 [方块设定](references/design/blocks.md#定向加速方块)。
|
定向加速方块固定增加 **5 m/s**,工坊与运行中均不可调;见 [方块设定](references/design/blocks.md#定向加速方块)。
|
||||||
|
|
||||||
|
工坊「小球」菜单可选原木球、陶瓷球和铁球,尺寸相同、质量及受风程度不同。[三球对照场景与验证](playtest/materials/README.md)。
|
||||||
|
|
||||||
|
[等级一:滑槽入门](playtest/tutorial/README.md) 包含五个可操作教学关,逐步练习直槽/缓坡、转弯、旋转、急缓坡搭配与综合通道。双击 `scripts/Tutorial.command`,从未完成布局开始搭建,真实入洞后进入下一关;它们仍是 `playtest/` 实验关卡。
|
||||||
|
|
||||||
|
玩家操作采用底部模型缩略图:点击选块,重复点击同一缩略图旋转,点击场景格子立即放置;擦除工具支持连续删除并回收滑槽。
|
||||||
|
|
||||||
|
全部滑槽现为实心底座,仅保留顶部槽面。底孔实验场景及入口已删除;模型、源文件与碰撞体同步更新,[检查结果与截图](playtest/README.md) 已记录。
|
||||||
|
|
||||||
2026-11-16 目录整理进行了文件/链接检查、Godot 导入和四场景短启动检查,没有重建模型或重跑整套物理实验。原始产物保存在 [playtest/artifacts](playtest/artifacts),旧路径、新路径及原始校验值见 [迁移清单](playtest/artifacts/reorganization/files.json)。
|
2026-11-16 目录整理进行了文件/链接检查、Godot 导入和四场景短启动检查,没有重建模型或重跑整套物理实验。原始产物保存在 [playtest/artifacts](playtest/artifacts),旧路径、新路径及原始校验值见 [迁移清单](playtest/artifacts/reorganization/files.json)。
|
||||||
|
|
||||||
|
弯槽已统一为一种“90°弯槽”,保留四个旋转朝向;教学关与工坊共用该类型,旧左右弯槽存档可兼容载入。
|
||||||
|
|
||||||
|
五个教学关现采用悬空路线与定向加速起点:无下方承托墙,空中格仅用于选取;每颗球由加速方块真实接触起步。悬空专项入口为 `./scripts/run.zsh test-floating`。
|
||||||
|
|||||||
@@ -4,16 +4,28 @@
|
|||||||
|
|
||||||
| 类型 | 资源 |
|
| 类型 | 资源 |
|
||||||
| --- | --- |
|
| --- | --- |
|
||||||
| [chutes](chutes) | 直行、两种拐弯、缓坡、陡坡、Y 汇流。 |
|
| [chutes](chutes) | 直行、90°弯槽、缓坡、陡坡、Y 汇流。 |
|
||||||
| [balls](balls) | 铁球模型及物理行为。 |
|
| [balls](balls) | 原木、陶瓷、铁三种独立模型,统一球面几何;共享物理行为在 `balls/shared/`。 |
|
||||||
| [blocks](blocks) | 标准墙壁、定向加速方块。 |
|
| [blocks](blocks) | 标准墙壁、定向加速方块、水方块、易碎冰块。 |
|
||||||
| [goals](goals) | 锥口球洞。 |
|
| [goals](goals) | 墙壁方块外形的球洞,顶部保留锥形导入口。 |
|
||||||
| [collections](collections) | 基础集合与当前画风集合的共享制作代码、参数、整套源文件和快照。 |
|
| [collections](collections) | 基础集合与当前画风集合的共享制作代码、参数、整套源文件和快照。 |
|
||||||
|
|
||||||
|
五种滑槽在基础版与画风版中均为实心底座,仅顶部开槽。共享制作代码和画风来源快照同步使用该结构,不再生成底部通孔。
|
||||||
|
|
||||||
`model.glb` 用于运行;`source/model.blend` 用于编辑,`source/build.py` 是制作入口;`baseline/model.glb` 为早期变体。`source/.gdignore` 使 Godot 跳过制作源文件。
|
`model.glb` 用于运行;`source/model.blend` 用于编辑,`source/build.py` 是制作入口;`baseline/model.glb` 为早期变体。`source/.gdignore` 使 Godot 跳过制作源文件。
|
||||||
|
|
||||||
例如定向加速方块:[模型](blocks/directional_boost/model.glb)、[源文件](blocks/directional_boost/source/model.blend)、[制作入口](blocks/directional_boost/source/build.py)、[行为](blocks/directional_boost/behavior.gd)。
|
例如定向加速方块:[模型](blocks/directional_boost/model.glb)、[源文件](blocks/directional_boost/source/model.blend)、[制作入口](blocks/directional_boost/source/build.py)、[行为](blocks/directional_boost/behavior.gd)。
|
||||||
|
|
||||||
从根目录运行 `./scripts/asset.zsh directional_boost` 可制作指定资源;`all` 制作当前画风整套,`baseline` 制作基础整套。单资源入口复用集合代码,只导出目标资源。参数化重建会重新生成相应源文件,手工修改模型后先决定是否继续使用生成器。
|
从根目录运行 `./scripts/asset.zsh directional_boost` 可制作指定资源,`all` 制作当前画风整套,`baseline` 制作基础整套。三种球可分别使用 `./scripts/asset.zsh iron_ball`、`ceramic_ball` 和 `wood_ball` 独立重建。各球的 `textures/albedo.png` 和 `textures/roughness.png` 会打包进 GLB 和 Blender 源文件。模型重建读取现有贴图。需要从参考重新生成贴图时,用 Blender 后台运行 [material_style.py](balls/shared/source/material_style.py)。
|
||||||
|
|
||||||
当前资产目录:[catalog.json](collections/storybook/catalog.json);物理参数:[physics.json](collections/storybook/physics.json);实体分类:[entities.json](collections/storybook/entities.json)。[来源快照](collections/storybook/source/snapshot) 是生成输入,不是可随意删除的缓存。
|
当前资产目录:[catalog.json](collections/storybook/catalog.json);物理参数:[physics.json](collections/storybook/physics.json);实体分类:[entities.json](collections/storybook/entities.json)。[来源快照](collections/storybook/source/snapshot) 是生成输入,不是可随意删除的缓存。
|
||||||
|
|
||||||
|
三种球的第一版风格化材质使用同一平滑球面与 1024×512 的颜色和粗糙度贴图。铁球以 Metal 032 的冷灰缎面和 Metal 009 的细磨痕为参考。陶瓷球用白瓷釉色与 Porcelain 001 的钴蓝弧纹。木球结合 Wood 092 的暖木面与 DeadKir 的宽木纹。原始图像和 CC0 授权见 [参考库](../references/materials/ball-materials/README.md)。[Godot 改造前后对比](balls/shared/previews/material-style-v1/comparison.png)上、下两行使用教学关镜头、光照和同一组三条直槽,顺序是铁球、陶瓷球、木球。
|
||||||
|
|
||||||
|
球洞外壳现为与墙壁同材质的 1×1×1 方块,内部保留原有锥面和落球通道,碰撞由实际带孔网格生成。制作入口为 `./scripts/asset.zsh goal_hole`;[外观对照](../playtest/artifacts/styled/goal_block/wall_comparison.png)、[入洞与侧壁专项](../playtest/checks/validate_goal_block.gd)及其[36 项检查结果](../playtest/artifacts/styled/goal_block/physics.json)记录此次修改,完整规则见[方块文档](../references/design/blocks.md#非触发方块)。
|
||||||
|
|
||||||
|
90°弯槽的现用资源为 [turn_90](chutes/turn_90/README.md)。旧 `turn_cw` / `turn_ccw` 文件仅保留作历史源资产,不在现用目录配置中注册,不再出现在素材菜单;旧制作入口转调统一资源。来源快照保留原名称,制作器显式映射为统一类型。
|
||||||
|
|
||||||
|
水与冰的源模型分别位于 [water](blocks/water/source/model.blend)、[ice](blocks/ice/source/model.blend),可用 `./scripts/asset.zsh water` / `ice` 独立重建。水模型顶面使用独立材质槽,Godot 通过 [水面着色器](blocks/water/surface.gdshader) 让泡沫沿方块流向漂动。水的物理作用与冰块破碎行为随各自资源保存在 `behavior.gd`。实验与参数见 [水与冰实验](../playtest/environment/README.md)。墙壁与冰面的三球接触对统一保存在现用集合 `physics.json`。
|
||||||
|
|
||||||
|
冰块使用 [顶面和侧面颜色贴图](blocks/ice/textures/)。顶面有三种裂纹,Godot 按所在格子选用图案,使同一排和同一列的相邻冰块错开。用 Blender 后台运行 [material_style.py](blocks/ice/source/material_style.py) 可从 [CC0 参考](../references/materials/ice/README.md) 重新烘焙贴图,再用 `./scripts/asset.zsh ice` 打包模型。画面见 [冰关第一课的裂纹变体](../playtest/artifacts/styled/ice_material/variants.png)。
|
||||||
|
|||||||
@@ -0,0 +1,45 @@
|
|||||||
|
[remap]
|
||||||
|
|
||||||
|
importer="scene"
|
||||||
|
importer_version=1
|
||||||
|
type="PackedScene"
|
||||||
|
uid="uid://ya78fw358e75"
|
||||||
|
path="res://.godot/imported/model.glb-6cc90efe6822b1a635856ea7d3d3a204.scn"
|
||||||
|
|
||||||
|
[deps]
|
||||||
|
|
||||||
|
source_file="res://assets/balls/ceramic_ball/model.glb"
|
||||||
|
dest_files=["res://.godot/imported/model.glb-6cc90efe6822b1a635856ea7d3d3a204.scn"]
|
||||||
|
|
||||||
|
[params]
|
||||||
|
|
||||||
|
nodes/root_type=""
|
||||||
|
nodes/root_name=""
|
||||||
|
nodes/root_script=null
|
||||||
|
mesh_library/use_node_names_as_mesh_names=false
|
||||||
|
array_mesh/deduplicate_surfaces=true
|
||||||
|
nodes/apply_root_scale=true
|
||||||
|
nodes/root_scale=1.0
|
||||||
|
nodes/import_as_skeleton_bones=false
|
||||||
|
nodes/use_name_suffixes=true
|
||||||
|
nodes/use_node_type_suffixes=true
|
||||||
|
meshes/ensure_tangents=true
|
||||||
|
meshes/generate_lods=true
|
||||||
|
meshes/create_shadow_meshes=true
|
||||||
|
meshes/light_baking=1
|
||||||
|
meshes/lightmap_texel_size=0.2
|
||||||
|
meshes/force_disable_compression=false
|
||||||
|
skins/use_named_skins=true
|
||||||
|
animation/import=true
|
||||||
|
animation/fps=30
|
||||||
|
animation/trimming=false
|
||||||
|
animation/remove_immutable_tracks=true
|
||||||
|
animation/import_rest_as_RESET=false
|
||||||
|
import_script/path=""
|
||||||
|
materials/extract=0
|
||||||
|
materials/extract_format=0
|
||||||
|
materials/extract_path=""
|
||||||
|
_subresources={}
|
||||||
|
gltf/naming_version=2
|
||||||
|
gltf/embedded_image_handling=1
|
||||||
|
gltf/texture_map_mode=1
|
||||||
|
After Width: | Height: | Size: 65 KiB |
@@ -0,0 +1,43 @@
|
|||||||
|
[remap]
|
||||||
|
|
||||||
|
importer="texture"
|
||||||
|
type="CompressedTexture2D"
|
||||||
|
uid="uid://0k2c3xdgqiva"
|
||||||
|
path="res://.godot/imported/model_albedo.png-82d35f3b3660dd164d75f2c3b226773a.ctex"
|
||||||
|
metadata={
|
||||||
|
"vram_texture": false
|
||||||
|
}
|
||||||
|
generator_parameters={
|
||||||
|
"md5": "06016bbe6f96a4e419fc20a3fa710152"
|
||||||
|
}
|
||||||
|
|
||||||
|
[deps]
|
||||||
|
|
||||||
|
source_file="res://assets/balls/ceramic_ball/model_albedo.png"
|
||||||
|
dest_files=["res://.godot/imported/model_albedo.png-82d35f3b3660dd164d75f2c3b226773a.ctex"]
|
||||||
|
|
||||||
|
[params]
|
||||||
|
|
||||||
|
compress/mode=0
|
||||||
|
compress/high_quality=false
|
||||||
|
compress/lossy_quality=0.7
|
||||||
|
compress/uastc_level=0
|
||||||
|
compress/rdo_quality_loss=0.0
|
||||||
|
compress/hdr_compression=1
|
||||||
|
compress/normal_map=0
|
||||||
|
compress/channel_pack=0
|
||||||
|
mipmaps/generate=true
|
||||||
|
mipmaps/limit=-1
|
||||||
|
roughness/mode=0
|
||||||
|
roughness/src_normal=""
|
||||||
|
process/channel_remap/red=0
|
||||||
|
process/channel_remap/green=1
|
||||||
|
process/channel_remap/blue=2
|
||||||
|
process/channel_remap/alpha=3
|
||||||
|
process/fix_alpha_border=true
|
||||||
|
process/premult_alpha=false
|
||||||
|
process/normal_map_invert_y=false
|
||||||
|
process/hdr_as_srgb=false
|
||||||
|
process/hdr_clamp_exposure=false
|
||||||
|
process/size_limit=0
|
||||||
|
detect_3d/compress_to=1
|
||||||
|
After Width: | Height: | Size: 49 KiB |
@@ -0,0 +1,43 @@
|
|||||||
|
[remap]
|
||||||
|
|
||||||
|
importer="texture"
|
||||||
|
type="CompressedTexture2D"
|
||||||
|
uid="uid://fhyfxaf5asrh"
|
||||||
|
path="res://.godot/imported/model_roughness.png-59be5e931d9c533b6f842243cf09d23d.ctex"
|
||||||
|
metadata={
|
||||||
|
"vram_texture": false
|
||||||
|
}
|
||||||
|
generator_parameters={
|
||||||
|
"md5": "e4ec04fab38c2e44ae38db1e67d598be"
|
||||||
|
}
|
||||||
|
|
||||||
|
[deps]
|
||||||
|
|
||||||
|
source_file="res://assets/balls/ceramic_ball/model_roughness.png"
|
||||||
|
dest_files=["res://.godot/imported/model_roughness.png-59be5e931d9c533b6f842243cf09d23d.ctex"]
|
||||||
|
|
||||||
|
[params]
|
||||||
|
|
||||||
|
compress/mode=0
|
||||||
|
compress/high_quality=false
|
||||||
|
compress/lossy_quality=0.7
|
||||||
|
compress/uastc_level=0
|
||||||
|
compress/rdo_quality_loss=0.0
|
||||||
|
compress/hdr_compression=1
|
||||||
|
compress/normal_map=0
|
||||||
|
compress/channel_pack=0
|
||||||
|
mipmaps/generate=true
|
||||||
|
mipmaps/limit=-1
|
||||||
|
roughness/mode=0
|
||||||
|
roughness/src_normal=""
|
||||||
|
process/channel_remap/red=0
|
||||||
|
process/channel_remap/green=1
|
||||||
|
process/channel_remap/blue=2
|
||||||
|
process/channel_remap/alpha=3
|
||||||
|
process/fix_alpha_border=true
|
||||||
|
process/premult_alpha=false
|
||||||
|
process/normal_map_invert_y=false
|
||||||
|
process/hdr_as_srgb=false
|
||||||
|
process/hdr_clamp_exposure=false
|
||||||
|
process/size_limit=0
|
||||||
|
detect_3d/compress_to=1
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
"""Run with Blender to rebuild this resource only."""
|
||||||
|
from pathlib import Path
|
||||||
|
import runpy
|
||||||
|
runpy.run_path(str(Path(__file__).resolve().parents[2]/'shared/source/build_materials.py'),
|
||||||
|
init_globals={'ONLY_BALL':'ceramic_ball'})
|
||||||
|
After Width: | Height: | Size: 65 KiB |
@@ -0,0 +1,40 @@
|
|||||||
|
[remap]
|
||||||
|
|
||||||
|
importer="texture"
|
||||||
|
type="CompressedTexture2D"
|
||||||
|
uid="uid://kh3aww7nd6d6"
|
||||||
|
path="res://.godot/imported/albedo.png-33c6f966abe43a11068e69052ecdb175.ctex"
|
||||||
|
metadata={
|
||||||
|
"vram_texture": false
|
||||||
|
}
|
||||||
|
|
||||||
|
[deps]
|
||||||
|
|
||||||
|
source_file="res://assets/balls/ceramic_ball/textures/albedo.png"
|
||||||
|
dest_files=["res://.godot/imported/albedo.png-33c6f966abe43a11068e69052ecdb175.ctex"]
|
||||||
|
|
||||||
|
[params]
|
||||||
|
|
||||||
|
compress/mode=0
|
||||||
|
compress/high_quality=false
|
||||||
|
compress/lossy_quality=0.7
|
||||||
|
compress/uastc_level=0
|
||||||
|
compress/rdo_quality_loss=0.0
|
||||||
|
compress/hdr_compression=1
|
||||||
|
compress/normal_map=0
|
||||||
|
compress/channel_pack=0
|
||||||
|
mipmaps/generate=false
|
||||||
|
mipmaps/limit=-1
|
||||||
|
roughness/mode=0
|
||||||
|
roughness/src_normal=""
|
||||||
|
process/channel_remap/red=0
|
||||||
|
process/channel_remap/green=1
|
||||||
|
process/channel_remap/blue=2
|
||||||
|
process/channel_remap/alpha=3
|
||||||
|
process/fix_alpha_border=true
|
||||||
|
process/premult_alpha=false
|
||||||
|
process/normal_map_invert_y=false
|
||||||
|
process/hdr_as_srgb=false
|
||||||
|
process/hdr_clamp_exposure=false
|
||||||
|
process/size_limit=0
|
||||||
|
detect_3d/compress_to=1
|
||||||
|
After Width: | Height: | Size: 18 KiB |
@@ -0,0 +1,40 @@
|
|||||||
|
[remap]
|
||||||
|
|
||||||
|
importer="texture"
|
||||||
|
type="CompressedTexture2D"
|
||||||
|
uid="uid://d6unrrm6kef8"
|
||||||
|
path="res://.godot/imported/roughness.png-b8f7c08e3553b28c39cc3b9fc3edffb5.ctex"
|
||||||
|
metadata={
|
||||||
|
"vram_texture": false
|
||||||
|
}
|
||||||
|
|
||||||
|
[deps]
|
||||||
|
|
||||||
|
source_file="res://assets/balls/ceramic_ball/textures/roughness.png"
|
||||||
|
dest_files=["res://.godot/imported/roughness.png-b8f7c08e3553b28c39cc3b9fc3edffb5.ctex"]
|
||||||
|
|
||||||
|
[params]
|
||||||
|
|
||||||
|
compress/mode=0
|
||||||
|
compress/high_quality=false
|
||||||
|
compress/lossy_quality=0.7
|
||||||
|
compress/uastc_level=0
|
||||||
|
compress/rdo_quality_loss=0.0
|
||||||
|
compress/hdr_compression=1
|
||||||
|
compress/normal_map=0
|
||||||
|
compress/channel_pack=0
|
||||||
|
mipmaps/generate=false
|
||||||
|
mipmaps/limit=-1
|
||||||
|
roughness/mode=0
|
||||||
|
roughness/src_normal=""
|
||||||
|
process/channel_remap/red=0
|
||||||
|
process/channel_remap/green=1
|
||||||
|
process/channel_remap/blue=2
|
||||||
|
process/channel_remap/alpha=3
|
||||||
|
process/fix_alpha_border=true
|
||||||
|
process/premult_alpha=false
|
||||||
|
process/normal_map_invert_y=false
|
||||||
|
process/hdr_as_srgb=false
|
||||||
|
process/hdr_clamp_exposure=false
|
||||||
|
process/size_limit=0
|
||||||
|
detect_3d/compress_to=1
|
||||||
|
After Width: | Height: | Size: 258 KiB |
@@ -0,0 +1,43 @@
|
|||||||
|
[remap]
|
||||||
|
|
||||||
|
importer="texture"
|
||||||
|
type="CompressedTexture2D"
|
||||||
|
uid="uid://w4phnx0taeuv"
|
||||||
|
path="res://.godot/imported/model_albedo.png-730be8bbbc048f7984a134257e196849.ctex"
|
||||||
|
metadata={
|
||||||
|
"vram_texture": false
|
||||||
|
}
|
||||||
|
generator_parameters={
|
||||||
|
"md5": "9ccb02b2674bc87a3626a9e43794a3b2"
|
||||||
|
}
|
||||||
|
|
||||||
|
[deps]
|
||||||
|
|
||||||
|
source_file="res://assets/balls/iron_ball/model_albedo.png"
|
||||||
|
dest_files=["res://.godot/imported/model_albedo.png-730be8bbbc048f7984a134257e196849.ctex"]
|
||||||
|
|
||||||
|
[params]
|
||||||
|
|
||||||
|
compress/mode=0
|
||||||
|
compress/high_quality=false
|
||||||
|
compress/lossy_quality=0.7
|
||||||
|
compress/uastc_level=0
|
||||||
|
compress/rdo_quality_loss=0.0
|
||||||
|
compress/hdr_compression=1
|
||||||
|
compress/normal_map=0
|
||||||
|
compress/channel_pack=0
|
||||||
|
mipmaps/generate=true
|
||||||
|
mipmaps/limit=-1
|
||||||
|
roughness/mode=0
|
||||||
|
roughness/src_normal=""
|
||||||
|
process/channel_remap/red=0
|
||||||
|
process/channel_remap/green=1
|
||||||
|
process/channel_remap/blue=2
|
||||||
|
process/channel_remap/alpha=3
|
||||||
|
process/fix_alpha_border=true
|
||||||
|
process/premult_alpha=false
|
||||||
|
process/normal_map_invert_y=false
|
||||||
|
process/hdr_as_srgb=false
|
||||||
|
process/hdr_clamp_exposure=false
|
||||||
|
process/size_limit=0
|
||||||
|
detect_3d/compress_to=1
|
||||||
|
After Width: | Height: | Size: 235 KiB |
@@ -0,0 +1,43 @@
|
|||||||
|
[remap]
|
||||||
|
|
||||||
|
importer="texture"
|
||||||
|
type="CompressedTexture2D"
|
||||||
|
uid="uid://bttrpxg3ae8c8"
|
||||||
|
path="res://.godot/imported/model_roughness.png-f791fbe23d9aa82d833832823b0cfcca.ctex"
|
||||||
|
metadata={
|
||||||
|
"vram_texture": false
|
||||||
|
}
|
||||||
|
generator_parameters={
|
||||||
|
"md5": "b60b5c6f56f5e63d1bb707f61491184b"
|
||||||
|
}
|
||||||
|
|
||||||
|
[deps]
|
||||||
|
|
||||||
|
source_file="res://assets/balls/iron_ball/model_roughness.png"
|
||||||
|
dest_files=["res://.godot/imported/model_roughness.png-f791fbe23d9aa82d833832823b0cfcca.ctex"]
|
||||||
|
|
||||||
|
[params]
|
||||||
|
|
||||||
|
compress/mode=0
|
||||||
|
compress/high_quality=false
|
||||||
|
compress/lossy_quality=0.7
|
||||||
|
compress/uastc_level=0
|
||||||
|
compress/rdo_quality_loss=0.0
|
||||||
|
compress/hdr_compression=1
|
||||||
|
compress/normal_map=0
|
||||||
|
compress/channel_pack=0
|
||||||
|
mipmaps/generate=true
|
||||||
|
mipmaps/limit=-1
|
||||||
|
roughness/mode=0
|
||||||
|
roughness/src_normal=""
|
||||||
|
process/channel_remap/red=0
|
||||||
|
process/channel_remap/green=1
|
||||||
|
process/channel_remap/blue=2
|
||||||
|
process/channel_remap/alpha=3
|
||||||
|
process/fix_alpha_border=true
|
||||||
|
process/premult_alpha=false
|
||||||
|
process/normal_map_invert_y=false
|
||||||
|
process/hdr_as_srgb=false
|
||||||
|
process/hdr_clamp_exposure=false
|
||||||
|
process/size_limit=0
|
||||||
|
detect_3d/compress_to=1
|
||||||
@@ -1,70 +0,0 @@
|
|||||||
extends RigidBody3D
|
|
||||||
|
|
||||||
const Booster = preload("res://assets/blocks/directional_boost/behavior.gd")
|
|
||||||
var boost_controller = Booster.new()
|
|
||||||
var radius: float = 0.3
|
|
||||||
var drag_coefficient: float = 0.47
|
|
||||||
var air_density: float = 1.225
|
|
||||||
var wind_velocity := Vector3.ZERO
|
|
||||||
var mu_static: float = 0.42
|
|
||||||
var mu_dynamic: float = 0.32
|
|
||||||
var rolling_resistance: float = 0.025
|
|
||||||
var friction_enabled := true
|
|
||||||
var rolling_enabled := true
|
|
||||||
var drag_enabled := true
|
|
||||||
var contact_count := 0
|
|
||||||
var ball_contact_count := 0
|
|
||||||
var contact_slip := 0.0
|
|
||||||
var air_force := Vector3.ZERO
|
|
||||||
var rolling_torque := Vector3.ZERO
|
|
||||||
var travelled := 0.0
|
|
||||||
var previous_position := Vector3.ZERO
|
|
||||||
var tracking_started := false
|
|
||||||
|
|
||||||
func _ready() -> void:
|
|
||||||
continuous_cd = true
|
|
||||||
contact_monitor = true
|
|
||||||
max_contacts_reported = 12
|
|
||||||
can_sleep = false
|
|
||||||
linear_damp_mode = RigidBody3D.DAMP_MODE_REPLACE
|
|
||||||
angular_damp_mode = RigidBody3D.DAMP_MODE_REPLACE
|
|
||||||
linear_damp = 0.0
|
|
||||||
angular_damp = 0.0
|
|
||||||
|
|
||||||
func _integrate_forces(state: PhysicsDirectBodyState3D) -> void:
|
|
||||||
if freeze:
|
|
||||||
return
|
|
||||||
contact_count = state.get_contact_count()
|
|
||||||
ball_contact_count = 0
|
|
||||||
contact_slip = 0.0
|
|
||||||
var support_normal := Vector3.ZERO
|
|
||||||
for i in range(contact_count):
|
|
||||||
if state.get_contact_collider_object(i) is RigidBody3D:ball_contact_count+=1
|
|
||||||
# Contact positions are global; the sphere's radial direction is unambiguous.
|
|
||||||
var n := (state.transform.origin - state.get_contact_local_position(i)).normalized()
|
|
||||||
var relative := state.get_contact_local_velocity_at_position(i) - state.get_contact_collider_velocity_at_position(i)
|
|
||||||
var slip := relative - n * relative.dot(n)
|
|
||||||
contact_slip = maxf(contact_slip, slip.length())
|
|
||||||
if n.dot(Vector3.UP) > 0.15:
|
|
||||||
support_normal += n
|
|
||||||
# Godot exposes one native friction coefficient. Select a slip-dependent
|
|
||||||
# coefficient; native contact solver still owns the friction impulse.
|
|
||||||
physics_material_override.friction = (mu_static if contact_slip < 0.035 else mu_dynamic) if friction_enabled else 0.0
|
|
||||||
boost_controller.integrate(state, radius)
|
|
||||||
var relative_air := state.linear_velocity - wind_velocity
|
|
||||||
air_force = -0.5 * air_density * drag_coefficient * PI * radius * radius * relative_air.length() * relative_air if drag_enabled else Vector3.ZERO
|
|
||||||
state.apply_central_force(air_force)
|
|
||||||
rolling_torque = Vector3.ZERO
|
|
||||||
if rolling_enabled and support_normal.length_squared() > 0.001:
|
|
||||||
var n := support_normal.normalized()
|
|
||||||
var roll := state.angular_velocity - n * state.angular_velocity.dot(n)
|
|
||||||
if roll.length() > 0.0001:
|
|
||||||
var support := maxf(0.0, -(mass * state.total_gravity + air_force).dot(n))
|
|
||||||
var moment := 0.4 * mass * radius * radius
|
|
||||||
var limit := roll.length() * moment / state.step
|
|
||||||
rolling_torque = -roll.normalized() * minf(rolling_resistance * support * radius, limit)
|
|
||||||
state.apply_torque(rolling_torque)
|
|
||||||
if tracking_started:
|
|
||||||
travelled += state.transform.origin.distance_to(previous_position)
|
|
||||||
previous_position = state.transform.origin
|
|
||||||
tracking_started = true
|
|
||||||
|
After Width: | Height: | Size: 258 KiB |
@@ -0,0 +1,40 @@
|
|||||||
|
[remap]
|
||||||
|
|
||||||
|
importer="texture"
|
||||||
|
type="CompressedTexture2D"
|
||||||
|
uid="uid://c524j5jnn6syn"
|
||||||
|
path="res://.godot/imported/albedo.png-52a28122060bfc7a8ebbba40cba00af1.ctex"
|
||||||
|
metadata={
|
||||||
|
"vram_texture": false
|
||||||
|
}
|
||||||
|
|
||||||
|
[deps]
|
||||||
|
|
||||||
|
source_file="res://assets/balls/iron_ball/textures/albedo.png"
|
||||||
|
dest_files=["res://.godot/imported/albedo.png-52a28122060bfc7a8ebbba40cba00af1.ctex"]
|
||||||
|
|
||||||
|
[params]
|
||||||
|
|
||||||
|
compress/mode=0
|
||||||
|
compress/high_quality=false
|
||||||
|
compress/lossy_quality=0.7
|
||||||
|
compress/uastc_level=0
|
||||||
|
compress/rdo_quality_loss=0.0
|
||||||
|
compress/hdr_compression=1
|
||||||
|
compress/normal_map=0
|
||||||
|
compress/channel_pack=0
|
||||||
|
mipmaps/generate=false
|
||||||
|
mipmaps/limit=-1
|
||||||
|
roughness/mode=0
|
||||||
|
roughness/src_normal=""
|
||||||
|
process/channel_remap/red=0
|
||||||
|
process/channel_remap/green=1
|
||||||
|
process/channel_remap/blue=2
|
||||||
|
process/channel_remap/alpha=3
|
||||||
|
process/fix_alpha_border=true
|
||||||
|
process/premult_alpha=false
|
||||||
|
process/normal_map_invert_y=false
|
||||||
|
process/hdr_as_srgb=false
|
||||||
|
process/hdr_clamp_exposure=false
|
||||||
|
process/size_limit=0
|
||||||
|
detect_3d/compress_to=1
|
||||||
|
After Width: | Height: | Size: 96 KiB |
@@ -0,0 +1,40 @@
|
|||||||
|
[remap]
|
||||||
|
|
||||||
|
importer="texture"
|
||||||
|
type="CompressedTexture2D"
|
||||||
|
uid="uid://bqgoffuomxwr4"
|
||||||
|
path="res://.godot/imported/roughness.png-2a435370a2fb0da58c9b9262c3a9f719.ctex"
|
||||||
|
metadata={
|
||||||
|
"vram_texture": false
|
||||||
|
}
|
||||||
|
|
||||||
|
[deps]
|
||||||
|
|
||||||
|
source_file="res://assets/balls/iron_ball/textures/roughness.png"
|
||||||
|
dest_files=["res://.godot/imported/roughness.png-2a435370a2fb0da58c9b9262c3a9f719.ctex"]
|
||||||
|
|
||||||
|
[params]
|
||||||
|
|
||||||
|
compress/mode=0
|
||||||
|
compress/high_quality=false
|
||||||
|
compress/lossy_quality=0.7
|
||||||
|
compress/uastc_level=0
|
||||||
|
compress/rdo_quality_loss=0.0
|
||||||
|
compress/hdr_compression=1
|
||||||
|
compress/normal_map=0
|
||||||
|
compress/channel_pack=0
|
||||||
|
mipmaps/generate=false
|
||||||
|
mipmaps/limit=-1
|
||||||
|
roughness/mode=0
|
||||||
|
roughness/src_normal=""
|
||||||
|
process/channel_remap/red=0
|
||||||
|
process/channel_remap/green=1
|
||||||
|
process/channel_remap/blue=2
|
||||||
|
process/channel_remap/alpha=3
|
||||||
|
process/fix_alpha_border=true
|
||||||
|
process/premult_alpha=false
|
||||||
|
process/normal_map_invert_y=false
|
||||||
|
process/hdr_as_srgb=false
|
||||||
|
process/hdr_clamp_exposure=false
|
||||||
|
process/size_limit=0
|
||||||
|
detect_3d/compress_to=1
|
||||||
@@ -0,0 +1,122 @@
|
|||||||
|
extends RigidBody3D
|
||||||
|
|
||||||
|
const Water = preload("res://assets/blocks/water/behavior.gd")
|
||||||
|
const Booster = preload("res://assets/blocks/directional_boost/behavior.gd")
|
||||||
|
var boost_controller = Booster.new()
|
||||||
|
var surface_pairs: Dictionary={}
|
||||||
|
var base_bounce := 0.08
|
||||||
|
var active_surface := "painted_wood"
|
||||||
|
var submerged_fraction := 0.0
|
||||||
|
var water_velocity := Vector3.ZERO
|
||||||
|
var buoyancy_force := Vector3.ZERO
|
||||||
|
var water_drag_force := Vector3.ZERO
|
||||||
|
var impact_contacts: Dictionary={}
|
||||||
|
var last_linear_velocity := Vector3.ZERO
|
||||||
|
var radius: float = 0.3
|
||||||
|
var drag_coefficient: float = 0.47
|
||||||
|
var air_density: float = 1.225
|
||||||
|
var wind_velocity := Vector3.ZERO
|
||||||
|
var mu_static: float = 0.42
|
||||||
|
var mu_dynamic: float = 0.32
|
||||||
|
var rolling_resistance: float = 0.025
|
||||||
|
var friction_enabled := true
|
||||||
|
var rolling_enabled := true
|
||||||
|
var drag_enabled := true
|
||||||
|
var contact_count := 0
|
||||||
|
var ball_contact_count := 0
|
||||||
|
var contact_slip := 0.0
|
||||||
|
var air_force := Vector3.ZERO
|
||||||
|
var rolling_torque := Vector3.ZERO
|
||||||
|
var travelled := 0.0
|
||||||
|
var previous_position := Vector3.ZERO
|
||||||
|
var tracking_started := false
|
||||||
|
|
||||||
|
func _ready() -> void:
|
||||||
|
continuous_cd = true
|
||||||
|
contact_monitor = true
|
||||||
|
max_contacts_reported = 12
|
||||||
|
can_sleep = false
|
||||||
|
linear_damp_mode = RigidBody3D.DAMP_MODE_REPLACE
|
||||||
|
angular_damp_mode = RigidBody3D.DAMP_MODE_REPLACE
|
||||||
|
linear_damp = 0.0
|
||||||
|
angular_damp = 0.0
|
||||||
|
|
||||||
|
func _integrate_forces(state: PhysicsDirectBodyState3D) -> void:
|
||||||
|
if freeze:
|
||||||
|
return
|
||||||
|
contact_count = state.get_contact_count()
|
||||||
|
ball_contact_count = 0
|
||||||
|
contact_slip = 0.0
|
||||||
|
var support_normal := Vector3.ZERO
|
||||||
|
var active_pair: Dictionary={}
|
||||||
|
var impacts: Dictionary={}
|
||||||
|
active_surface="painted_wood"
|
||||||
|
for i in range(contact_count):
|
||||||
|
var collider: Node=state.get_contact_collider_object(i)
|
||||||
|
if collider is RigidBody3D:ball_contact_count+=1
|
||||||
|
var surface: String=collider.get_meta("piece_type","") if collider!=null else ""
|
||||||
|
if surface_pairs.has(surface):
|
||||||
|
var pair: Dictionary=surface_pairs[surface]
|
||||||
|
if active_pair.is_empty() or pair.dynamicFriction>active_pair.dynamicFriction:
|
||||||
|
active_pair=pair;active_surface=surface
|
||||||
|
# Contact positions are global; the sphere's radial direction is unambiguous.
|
||||||
|
var n := (state.transform.origin - state.get_contact_local_position(i)).normalized()
|
||||||
|
var relative := state.get_contact_local_velocity_at_position(i) - state.get_contact_collider_velocity_at_position(i)
|
||||||
|
var slip := relative - n * relative.dot(n)
|
||||||
|
contact_slip = maxf(contact_slip, slip.length())
|
||||||
|
if surface=="ice":
|
||||||
|
var block: Node=collider
|
||||||
|
while block!=null and not block.has_method("receive_impact"):block=block.get_parent()
|
||||||
|
if block!=null:
|
||||||
|
var id:=block.get_instance_id()
|
||||||
|
if not impacts.has(id):impacts[id]={"block":block,"impulse":0.0,"approach":0.0}
|
||||||
|
impacts[id].impulse+=absf(state.get_contact_impulse(i).dot(n))
|
||||||
|
impacts[id].approach=maxf(impacts[id].approach,maxf(-relative.dot(n),-last_linear_velocity.dot(n)))
|
||||||
|
if n.dot(Vector3.UP) > 0.15 or (surface=="wall" and (mass*state.total_gravity+constant_force+air_force+buoyancy_force+water_drag_force).dot(n)<-.01):
|
||||||
|
support_normal += n
|
||||||
|
# Godot exposes one native friction coefficient. Select a slip-dependent
|
||||||
|
# coefficient; native contact solver still owns the friction impulse.
|
||||||
|
for id in impacts:
|
||||||
|
if not impact_contacts.has(id):
|
||||||
|
var impact: Dictionary=impacts[id]
|
||||||
|
# Jolt may report a speculative contact before the actual impact.
|
||||||
|
# Arm only after a real approach/impulse; resting contact never accumulates.
|
||||||
|
if impact.approach>=impact.block.MIN_APPROACH_SPEED and impact.impulse>0:
|
||||||
|
impact.block.receive_impact(str(get_meta("ball_id",name)),impact.impulse,impact.approach)
|
||||||
|
impact_contacts[id]=true
|
||||||
|
for id in impact_contacts.keys():
|
||||||
|
if not impacts.has(id):impact_contacts.erase(id)
|
||||||
|
var contact_static: float=active_pair.get("staticFriction",mu_static)
|
||||||
|
var contact_dynamic: float=active_pair.get("dynamicFriction",mu_dynamic)
|
||||||
|
var contact_rolling: float=active_pair.get("rollingResistance",rolling_resistance)
|
||||||
|
physics_material_override.friction = (contact_static if contact_slip < 0.035 else contact_dynamic) if friction_enabled else 0.0
|
||||||
|
physics_material_override.bounce=active_pair.get("restitution",base_bounce)
|
||||||
|
boost_controller.integrate(state, radius)
|
||||||
|
var water: Dictionary=Water.sample(state.transform.origin,radius,get_tree().get_nodes_in_group("water_blocks"))
|
||||||
|
submerged_fraction=water.fraction;water_velocity=water.velocity
|
||||||
|
var volume:=4.0/3.0*PI*radius*radius*radius*submerged_fraction
|
||||||
|
buoyancy_force=-state.total_gravity*Water.DENSITY*volume
|
||||||
|
var relative_water:=state.linear_velocity-water_velocity
|
||||||
|
water_drag_force=-.5*Water.DENSITY*Water.DRAG_COEFFICIENT*PI*radius*radius*submerged_fraction*relative_water.length()*relative_water
|
||||||
|
# Bound only the numerical drag step; never teleport or set a target speed.
|
||||||
|
var drag_limit:=relative_water.length()*mass/state.step
|
||||||
|
if water_drag_force.length()>drag_limit:water_drag_force=water_drag_force.normalized()*drag_limit
|
||||||
|
state.apply_central_force(buoyancy_force+water_drag_force)
|
||||||
|
var relative_air := state.linear_velocity - wind_velocity
|
||||||
|
air_force = -0.5 * air_density * drag_coefficient * PI * radius * radius * relative_air.length() * relative_air * (1.0-submerged_fraction) if drag_enabled else Vector3.ZERO
|
||||||
|
state.apply_central_force(air_force)
|
||||||
|
rolling_torque = Vector3.ZERO
|
||||||
|
if rolling_enabled and support_normal.length_squared() > 0.001:
|
||||||
|
var n := support_normal.normalized()
|
||||||
|
var roll := state.angular_velocity - n * state.angular_velocity.dot(n)
|
||||||
|
if roll.length() > 0.0001:
|
||||||
|
var support := maxf(0.0, -(mass * state.total_gravity + constant_force + air_force + buoyancy_force + water_drag_force).dot(n))
|
||||||
|
var moment := 0.4 * mass * radius * radius
|
||||||
|
var limit := roll.length() * moment / state.step
|
||||||
|
rolling_torque = -roll.normalized() * minf(contact_rolling * support * radius, limit)
|
||||||
|
state.apply_torque(rolling_torque)
|
||||||
|
last_linear_velocity=state.linear_velocity
|
||||||
|
if tracking_started:
|
||||||
|
travelled += state.transform.origin.distance_to(previous_position)
|
||||||
|
previous_position = state.transform.origin
|
||||||
|
tracking_started = true
|
||||||
|
After Width: | Height: | Size: 134 KiB |
|
After Width: | Height: | Size: 130 KiB |
|
After Width: | Height: | Size: 173 KiB |
@@ -0,0 +1,57 @@
|
|||||||
|
"""Export wood and porcelain finishes on the existing iron sphere mesh."""
|
||||||
|
import bpy
|
||||||
|
import json
|
||||||
|
import runpy
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
|
ROOT = Path(__file__).resolve().parents[4]
|
||||||
|
OUT = ROOT / 'assets/collections/storybook'
|
||||||
|
KINDS = ['wood_ball', 'ceramic_ball']
|
||||||
|
ONLY_BALL = globals().get('ONLY_BALL')
|
||||||
|
if ONLY_BALL is not None and ONLY_BALL not in KINDS:
|
||||||
|
raise ValueError(ONLY_BALL)
|
||||||
|
|
||||||
|
apply_material = runpy.run_path(str(Path(__file__).with_name('material_style.py')))['apply_material']
|
||||||
|
|
||||||
|
catalog = json.loads((OUT/'catalog.json').read_text())
|
||||||
|
for kind in ([ONLY_BALL] if ONLY_BALL else KINDS):
|
||||||
|
directory = ROOT/'assets/balls'/kind
|
||||||
|
source = directory/'source/model.blend'
|
||||||
|
input_model = source if source.exists() else ROOT/'assets/balls/iron_ball/source/model.blend'
|
||||||
|
bpy.ops.wm.open_mainfile(filepath=str(input_model))
|
||||||
|
bpy.context.preferences.filepaths.save_version = 0
|
||||||
|
obj = bpy.data.objects[kind if input_model == source else 'iron_ball']
|
||||||
|
obj.name = kind
|
||||||
|
obj.data = obj.data.copy()
|
||||||
|
obj['asset_id'] = kind
|
||||||
|
obj['collision_source'] = 'same sphere geometry as iron_ball'
|
||||||
|
assert obj.data.uv_layers, 'Iron source must retain its authored UVs'
|
||||||
|
apply_material(obj, kind)
|
||||||
|
obj.location = (0,0,0)
|
||||||
|
bpy.ops.object.select_all(action='DESELECT');obj.select_set(True)
|
||||||
|
bpy.context.view_layer.objects.active = obj
|
||||||
|
bpy.ops.export_scene.gltf(filepath=str(directory/'model.glb'),export_format='GLB',use_selection=True,
|
||||||
|
export_yup=True,export_extras=True,export_apply=True)
|
||||||
|
source.parent.mkdir(parents=True,exist_ok=True)
|
||||||
|
bpy.ops.wm.save_as_mainfile(filepath=str(source))
|
||||||
|
metadata = dict(catalog['models']['iron_ball'])
|
||||||
|
metadata.update(path='res://'+str((directory/'model.glb').relative_to(ROOT)),
|
||||||
|
sourceBlend=str(source.relative_to(ROOT)),role='ball',geometrySource='iron_ball',
|
||||||
|
albedoTexture='res://'+str((directory/'textures/albedo.png').relative_to(ROOT)))
|
||||||
|
catalog['models'][kind] = metadata
|
||||||
|
(OUT/'catalog.json').write_text(json.dumps(catalog,indent=2,ensure_ascii=False)+'\n')
|
||||||
|
|
||||||
|
if not ONLY_BALL:
|
||||||
|
# Full-family build also keeps the editable collection complete.
|
||||||
|
collection = OUT/'source/collection.blend'
|
||||||
|
bpy.ops.wm.open_mainfile(filepath=str(collection))
|
||||||
|
bpy.context.preferences.filepaths.save_version = 0
|
||||||
|
for i,kind in enumerate(KINDS):
|
||||||
|
if kind in bpy.data.objects:bpy.data.objects.remove(bpy.data.objects[kind],do_unlink=True)
|
||||||
|
with bpy.data.libraries.load(str(ROOT/catalog['models'][kind]['sourceBlend']),link=False) as (src,dst):
|
||||||
|
dst.objects = [kind]
|
||||||
|
obj = dst.objects[0]
|
||||||
|
bpy.context.collection.objects.link(obj)
|
||||||
|
obj.location = (5.2+i*2.6,6,0)
|
||||||
|
bpy.ops.wm.save_as_mainfile(filepath=str(collection))
|
||||||
|
print('MATERIAL_BALLS_READY',ONLY_BALL or KINDS)
|
||||||
@@ -0,0 +1,48 @@
|
|||||||
|
extends SceneTree
|
||||||
|
|
||||||
|
const OUTPUT = "res://assets/balls/shared/previews/material-style-v1/"
|
||||||
|
const BALLS = ["iron_ball", "ceramic_ball", "wood_ball"]
|
||||||
|
|
||||||
|
func _initialize() -> void:
|
||||||
|
call_deferred("capture")
|
||||||
|
|
||||||
|
func capture() -> void:
|
||||||
|
var args := OS.get_cmdline_user_args()
|
||||||
|
if args.size() != 1 or args[0] not in ["before", "after"]:
|
||||||
|
push_error("Pass either before or after as the capture name.")
|
||||||
|
quit(1)
|
||||||
|
return
|
||||||
|
var app = load("res://playtest/tutorial/scenes/tutorial.tscn").instantiate()
|
||||||
|
root.add_child(app)
|
||||||
|
var pieces: Array = []
|
||||||
|
var balls: Array = []
|
||||||
|
for i in range(BALLS.size()):
|
||||||
|
var at := Vector3(1.5, 0, -1.0) * (i - 1)
|
||||||
|
pieces.append({"id": "lane_%d" % i, "kind": "straight", "position": [at.x, at.y, at.z], "quarter": 0})
|
||||||
|
var center: Vector3 = at + app.lib.ball_on_surface("straight", 0.5)
|
||||||
|
balls.append({"id": BALLS[i], "ballTypeId": BALLS[i], "position": [center.x, center.y, center.z]})
|
||||||
|
app.apply_data({"schemaVersion": 2, "pieces": pieces, "entities": [], "balls": balls})
|
||||||
|
for child in app.get_children():
|
||||||
|
if child is CanvasLayer:
|
||||||
|
child.hide()
|
||||||
|
for tag in app.tags:
|
||||||
|
tag.hide()
|
||||||
|
app.slots_view.hide()
|
||||||
|
app.preview_view.hide()
|
||||||
|
app.selection.hide()
|
||||||
|
app.ball_marker.hide()
|
||||||
|
app.camera.h_offset = 0
|
||||||
|
app.camera.v_offset = 0
|
||||||
|
app.camera_size = 6.2
|
||||||
|
app.target = Vector3(0, 0.56, 0)
|
||||||
|
app.update_camera()
|
||||||
|
for i in range(8):
|
||||||
|
await process_frame
|
||||||
|
RenderingServer.force_draw(false)
|
||||||
|
RenderingServer.force_sync()
|
||||||
|
var screenshot := root.get_texture().get_image()
|
||||||
|
var path := ProjectSettings.globalize_path(OUTPUT + args[0] + ".png")
|
||||||
|
var result := screenshot.save_png(path)
|
||||||
|
if result != OK:
|
||||||
|
push_error("Could not save material comparison to " + path)
|
||||||
|
quit(0 if result == OK else 1)
|
||||||
@@ -0,0 +1,173 @@
|
|||||||
|
"""Bake and apply the three stylized finishes on the existing UV spheres.
|
||||||
|
|
||||||
|
Run this file in Blender to bake new maps. The normal asset build reads the
|
||||||
|
saved maps, so rebuilding a model does not overwrite an edited texture.
|
||||||
|
"""
|
||||||
|
|
||||||
|
from pathlib import Path
|
||||||
|
import struct
|
||||||
|
import zlib
|
||||||
|
|
||||||
|
import bpy
|
||||||
|
import numpy as np
|
||||||
|
|
||||||
|
|
||||||
|
ROOT = Path(__file__).resolve().parents[4]
|
||||||
|
REFERENCES = ROOT / 'references/materials/ball-materials'
|
||||||
|
BALLS = ROOT / 'assets/balls'
|
||||||
|
SIZE = (1024, 512)
|
||||||
|
FINISHES = {
|
||||||
|
'iron_ball': ('Satin iron', (0.173, 0.226, 0.295), 0.46),
|
||||||
|
'ceramic_ball': ('Ivory porcelain glaze with cobalt scallops', (0.78, 0.69, 0.52), 0.0),
|
||||||
|
'wood_ball': ('Honey wood with painted grain', (0.49, 0.24, 0.09), 0.0),
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
def apply_material(obj, kind):
|
||||||
|
name, color, metallic = FINISHES[kind]
|
||||||
|
material = bpy.data.materials.new(name)
|
||||||
|
material.diffuse_color = (*color, 1)
|
||||||
|
material.use_nodes = True
|
||||||
|
nodes = material.node_tree.nodes
|
||||||
|
shader = nodes.get('Principled BSDF')
|
||||||
|
shader.inputs['Metallic'].default_value = metallic
|
||||||
|
for file, color_space, socket, position in (
|
||||||
|
('albedo.png', 'sRGB', 'Base Color', (-480, 230)),
|
||||||
|
('roughness.png', 'Non-Color', 'Roughness', (-480, -80)),
|
||||||
|
):
|
||||||
|
path = BALLS / kind / 'textures' / file
|
||||||
|
image = bpy.data.images.load(str(path), check_existing=False)
|
||||||
|
image.colorspace_settings.name = color_space
|
||||||
|
# Give each ball a reimportable glTF image name, including across a full build.
|
||||||
|
image.name = f'{kind}_{path.stem}'
|
||||||
|
image.pack()
|
||||||
|
image.filepath = str(path)
|
||||||
|
texture = nodes.new('ShaderNodeTexImage')
|
||||||
|
texture.label = socket
|
||||||
|
texture.location = position
|
||||||
|
texture.image = image
|
||||||
|
texture.extension = 'REPEAT'
|
||||||
|
material.node_tree.links.new(texture.outputs['Color'], shader.inputs[socket])
|
||||||
|
obj.data.materials.clear()
|
||||||
|
obj.data.materials.append(material)
|
||||||
|
for face in obj.data.polygons:
|
||||||
|
face.material_index = 0
|
||||||
|
face.use_smooth = True
|
||||||
|
|
||||||
|
|
||||||
|
def read_reference(path):
|
||||||
|
image = bpy.data.images.load(str(REFERENCES / path), check_existing=False)
|
||||||
|
width, height = image.size
|
||||||
|
values = np.empty(width * height * 4, dtype=np.float32)
|
||||||
|
image.pixels.foreach_get(values)
|
||||||
|
bpy.data.images.remove(image)
|
||||||
|
return values.reshape(height, width, 4)[..., :3]
|
||||||
|
|
||||||
|
|
||||||
|
def lightness(map_rgb):
|
||||||
|
return map_rgb @ np.array([0.2126, 0.7152, 0.0722], dtype=np.float32)
|
||||||
|
|
||||||
|
|
||||||
|
def sample(tile, u, v):
|
||||||
|
"""Bilinear sample a repeating reference in its local projection."""
|
||||||
|
height, width = tile.shape
|
||||||
|
u, v = u * width, v * height
|
||||||
|
i, j = np.floor(u).astype(int), np.floor(v).astype(int)
|
||||||
|
du, dv = u - i, v - j
|
||||||
|
low = (1 - du) * tile[j % height, i % width] + du * tile[j % height, (i + 1) % width]
|
||||||
|
high = (1 - du) * tile[(j + 1) % height, i % width] + du * tile[(j + 1) % height, (i + 1) % width]
|
||||||
|
return low * (1 - dv) + high * dv
|
||||||
|
|
||||||
|
|
||||||
|
def project(tile, x, y, z, scale):
|
||||||
|
"""Project from three axes without concentrating image detail at UV poles."""
|
||||||
|
weights = np.stack([x**4, y**4, z**4])
|
||||||
|
a = sample(tile, y * scale + .31, z * scale + .13)
|
||||||
|
b = sample(tile, x * scale + .51, z * scale + .39)
|
||||||
|
c = sample(tile, x * scale + .21, y * scale + .77)
|
||||||
|
return (weights[0] * a + weights[1] * b + weights[2] * c) / weights.sum(axis=0)
|
||||||
|
|
||||||
|
|
||||||
|
def iron(x, y, z):
|
||||||
|
base_tile = lightness(read_reference('iron/textures/metal032/Metal032_1K-JPG_Color.jpg'))
|
||||||
|
sheen = lightness(read_reference('iron/textures/metal032/Metal032_1K-JPG_Roughness.jpg'))
|
||||||
|
brushed = lightness(read_reference('iron/textures/metal009/Metal009_1K-JPG_Color.jpg'))
|
||||||
|
base = project(base_tile - np.mean(base_tile), x, y, z, .58)
|
||||||
|
scratches = project(brushed - np.mean(brushed), x, y, z, .85)
|
||||||
|
satin = project(sheen - np.mean(sheen), x, y, z, .54)
|
||||||
|
# Preserve an even cool silhouette; the fine marks only vary local tone and sheen.
|
||||||
|
color = np.array([.45, .515, .58]) + (.24 * base + .18 * scratches)[..., None]
|
||||||
|
return color, np.clip(.44 + .21 * satin + .13 * scratches, .38, .50)
|
||||||
|
|
||||||
|
|
||||||
|
def porcelain(x, y, z):
|
||||||
|
source = read_reference('ceramic/textures/porcelain-001/Porcelain_001_basecolor.png')
|
||||||
|
blue = source[source[..., 2] - source[..., 0] > .17].mean(axis=0)
|
||||||
|
pigment = .23 * blue + .77 * np.array([.13, .315, .51])
|
||||||
|
# Tilt the decoration so part of it stays readable in the elevated game view.
|
||||||
|
latitude = np.arcsin(np.clip(.966 * z + .259 * x, -1, 1))
|
||||||
|
longitude = np.arctan2(y, .966 * x - .259 * z)
|
||||||
|
phase = 5 * longitude + .44
|
||||||
|
band = np.abs(latitude) - .53
|
||||||
|
scallop = .145 * (np.cos(phase) + .20 * np.cos(2 * phase))
|
||||||
|
stroke = np.abs(band - scallop) - (.080 + .011 * np.sin(phase))
|
||||||
|
# The source's little teardrop fan becomes a few soft dabs inside each arc.
|
||||||
|
cell = (phase + np.pi) % (2 * np.pi) - np.pi
|
||||||
|
for angle in (-.71, 0, .71):
|
||||||
|
dab = np.hypot((cell - angle) / .19, (band - .30 + abs(angle) * .09) / .045)
|
||||||
|
stroke = np.minimum(stroke, (dab - 1) * .045)
|
||||||
|
mask = np.clip(.5 - stroke / .016, 0, 1)
|
||||||
|
variation = .008 * np.sin(5 * y + 3 * z) * np.cos(4 * x - 2 * z)
|
||||||
|
ivory = np.array([.81, .766, .677]) + variation[..., None]
|
||||||
|
color = ivory * (1 - mask[..., None]) + (pigment + variation[..., None]) * mask[..., None]
|
||||||
|
# Patches of glaze stay glossy without the constant zero roughness in the source pack.
|
||||||
|
return color, .19 + .023 * mask + variation
|
||||||
|
|
||||||
|
|
||||||
|
def wood(x, y, z):
|
||||||
|
natural = lightness(read_reference('wood/textures/wood092/Wood092_1K-JPG_Color.jpg'))
|
||||||
|
painted = lightness(read_reference('wood/textures/handpainted-wood/oga-wood-painted.png'))
|
||||||
|
# Lay large bands over the sphere like grain in a turned wooden blank.
|
||||||
|
# A tilted axis puts the grain over the crown as well as down the sides.
|
||||||
|
side = .72 * x + .69 * z
|
||||||
|
height = .72 * z - .69 * x
|
||||||
|
radial = np.hypot(side + .51, y - .40)
|
||||||
|
wobble = .059 * np.sin(5.2 * height + 3.4 * side) + .021 * np.sin(12 * height - 2 * y)
|
||||||
|
grain = (.5 + .5 * np.sin(37 * (radial + wobble))) ** 3
|
||||||
|
painted_tone = project(painted - np.mean(painted), side, y, height, .42)
|
||||||
|
fine_tone = project(natural - np.mean(natural), side, y, height, .67)
|
||||||
|
color = np.array([.73, .50, .32]) - grain[..., None] * np.array([.105, .113, .090])
|
||||||
|
color += (.12 * painted_tone + .10 * fine_tone)[..., None]
|
||||||
|
return color, np.clip(.63 + .12 * grain + .12 * fine_tone, .59, .77)
|
||||||
|
|
||||||
|
|
||||||
|
def save_png(path, values):
|
||||||
|
data = (np.clip(values, 0, 1) * 255 + .5).astype(np.uint8)
|
||||||
|
# UV texture v=0 is the bottom row; PNG stores the top row first.
|
||||||
|
pixels = b''.join(b'\0' + row.tobytes() for row in data[::-1])
|
||||||
|
|
||||||
|
def chunk(kind, payload):
|
||||||
|
return (struct.pack('!I', len(payload)) + kind + payload
|
||||||
|
+ struct.pack('!I', zlib.crc32(kind + payload)))
|
||||||
|
|
||||||
|
color_type = 2 if data.ndim == 3 else 0
|
||||||
|
header = struct.pack('!IIBBBBB', *SIZE, 8, color_type, 0, 0, 0)
|
||||||
|
path.parent.mkdir(parents=True, exist_ok=True)
|
||||||
|
path.write_bytes(b'\x89PNG\r\n\x1a\n' + chunk(b'IHDR', header)
|
||||||
|
+ chunk(b'IDAT', zlib.compress(pixels, 9)) + chunk(b'IEND', b''))
|
||||||
|
|
||||||
|
|
||||||
|
def bake():
|
||||||
|
width, height = SIZE
|
||||||
|
u, v = np.meshgrid((np.arange(width) + .5) / width, (np.arange(height) + .5) / height)
|
||||||
|
theta, phi = u * np.pi * 2, v * np.pi
|
||||||
|
x, y, z = np.sin(phi) * np.cos(theta), np.sin(phi) * np.sin(theta), -np.cos(phi)
|
||||||
|
for kind, finish in (('iron_ball', iron), ('ceramic_ball', porcelain), ('wood_ball', wood)):
|
||||||
|
color, roughness = finish(x, y, z)
|
||||||
|
directory = BALLS / kind / 'textures'
|
||||||
|
save_png(directory / 'albedo.png', color)
|
||||||
|
save_png(directory / 'roughness.png', roughness)
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
bake()
|
||||||
@@ -0,0 +1,45 @@
|
|||||||
|
[remap]
|
||||||
|
|
||||||
|
importer="scene"
|
||||||
|
importer_version=1
|
||||||
|
type="PackedScene"
|
||||||
|
uid="uid://cj5olusn75u82"
|
||||||
|
path="res://.godot/imported/model.glb-1b1d4d547ed4d9dec0abc98f91db5a5f.scn"
|
||||||
|
|
||||||
|
[deps]
|
||||||
|
|
||||||
|
source_file="res://assets/balls/wood_ball/model.glb"
|
||||||
|
dest_files=["res://.godot/imported/model.glb-1b1d4d547ed4d9dec0abc98f91db5a5f.scn"]
|
||||||
|
|
||||||
|
[params]
|
||||||
|
|
||||||
|
nodes/root_type=""
|
||||||
|
nodes/root_name=""
|
||||||
|
nodes/root_script=null
|
||||||
|
mesh_library/use_node_names_as_mesh_names=false
|
||||||
|
array_mesh/deduplicate_surfaces=true
|
||||||
|
nodes/apply_root_scale=true
|
||||||
|
nodes/root_scale=1.0
|
||||||
|
nodes/import_as_skeleton_bones=false
|
||||||
|
nodes/use_name_suffixes=true
|
||||||
|
nodes/use_node_type_suffixes=true
|
||||||
|
meshes/ensure_tangents=true
|
||||||
|
meshes/generate_lods=true
|
||||||
|
meshes/create_shadow_meshes=true
|
||||||
|
meshes/light_baking=1
|
||||||
|
meshes/lightmap_texel_size=0.2
|
||||||
|
meshes/force_disable_compression=false
|
||||||
|
skins/use_named_skins=true
|
||||||
|
animation/import=true
|
||||||
|
animation/fps=30
|
||||||
|
animation/trimming=false
|
||||||
|
animation/remove_immutable_tracks=true
|
||||||
|
animation/import_rest_as_RESET=false
|
||||||
|
import_script/path=""
|
||||||
|
materials/extract=0
|
||||||
|
materials/extract_format=0
|
||||||
|
materials/extract_path=""
|
||||||
|
_subresources={}
|
||||||
|
gltf/naming_version=2
|
||||||
|
gltf/embedded_image_handling=1
|
||||||
|
gltf/texture_map_mode=1
|
||||||
|
After Width: | Height: | Size: 398 KiB |
@@ -0,0 +1,43 @@
|
|||||||
|
[remap]
|
||||||
|
|
||||||
|
importer="texture"
|
||||||
|
type="CompressedTexture2D"
|
||||||
|
uid="uid://8il0l1lnddbp"
|
||||||
|
path="res://.godot/imported/model_albedo.png-3e262a7b51a87c5cf8f8cd6a272f7e53.ctex"
|
||||||
|
metadata={
|
||||||
|
"vram_texture": false
|
||||||
|
}
|
||||||
|
generator_parameters={
|
||||||
|
"md5": "a58aa5cfe4dcca1810b45db182745c1f"
|
||||||
|
}
|
||||||
|
|
||||||
|
[deps]
|
||||||
|
|
||||||
|
source_file="res://assets/balls/wood_ball/model_albedo.png"
|
||||||
|
dest_files=["res://.godot/imported/model_albedo.png-3e262a7b51a87c5cf8f8cd6a272f7e53.ctex"]
|
||||||
|
|
||||||
|
[params]
|
||||||
|
|
||||||
|
compress/mode=0
|
||||||
|
compress/high_quality=false
|
||||||
|
compress/lossy_quality=0.7
|
||||||
|
compress/uastc_level=0
|
||||||
|
compress/rdo_quality_loss=0.0
|
||||||
|
compress/hdr_compression=1
|
||||||
|
compress/normal_map=0
|
||||||
|
compress/channel_pack=0
|
||||||
|
mipmaps/generate=true
|
||||||
|
mipmaps/limit=-1
|
||||||
|
roughness/mode=0
|
||||||
|
roughness/src_normal=""
|
||||||
|
process/channel_remap/red=0
|
||||||
|
process/channel_remap/green=1
|
||||||
|
process/channel_remap/blue=2
|
||||||
|
process/channel_remap/alpha=3
|
||||||
|
process/fix_alpha_border=true
|
||||||
|
process/premult_alpha=false
|
||||||
|
process/normal_map_invert_y=false
|
||||||
|
process/hdr_as_srgb=false
|
||||||
|
process/hdr_clamp_exposure=false
|
||||||
|
process/size_limit=0
|
||||||
|
detect_3d/compress_to=1
|
||||||
|
After Width: | Height: | Size: 269 KiB |
@@ -0,0 +1,43 @@
|
|||||||
|
[remap]
|
||||||
|
|
||||||
|
importer="texture"
|
||||||
|
type="CompressedTexture2D"
|
||||||
|
uid="uid://bwnilietrwddx"
|
||||||
|
path="res://.godot/imported/model_roughness.png-504e85521daad75c23a39c5972ba1a2b.ctex"
|
||||||
|
metadata={
|
||||||
|
"vram_texture": false
|
||||||
|
}
|
||||||
|
generator_parameters={
|
||||||
|
"md5": "c0276a32c5fd5f8f8e4785fd1e80afe9"
|
||||||
|
}
|
||||||
|
|
||||||
|
[deps]
|
||||||
|
|
||||||
|
source_file="res://assets/balls/wood_ball/model_roughness.png"
|
||||||
|
dest_files=["res://.godot/imported/model_roughness.png-504e85521daad75c23a39c5972ba1a2b.ctex"]
|
||||||
|
|
||||||
|
[params]
|
||||||
|
|
||||||
|
compress/mode=0
|
||||||
|
compress/high_quality=false
|
||||||
|
compress/lossy_quality=0.7
|
||||||
|
compress/uastc_level=0
|
||||||
|
compress/rdo_quality_loss=0.0
|
||||||
|
compress/hdr_compression=1
|
||||||
|
compress/normal_map=0
|
||||||
|
compress/channel_pack=0
|
||||||
|
mipmaps/generate=true
|
||||||
|
mipmaps/limit=-1
|
||||||
|
roughness/mode=0
|
||||||
|
roughness/src_normal=""
|
||||||
|
process/channel_remap/red=0
|
||||||
|
process/channel_remap/green=1
|
||||||
|
process/channel_remap/blue=2
|
||||||
|
process/channel_remap/alpha=3
|
||||||
|
process/fix_alpha_border=true
|
||||||
|
process/premult_alpha=false
|
||||||
|
process/normal_map_invert_y=false
|
||||||
|
process/hdr_as_srgb=false
|
||||||
|
process/hdr_clamp_exposure=false
|
||||||
|
process/size_limit=0
|
||||||
|
detect_3d/compress_to=1
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
"""Run with Blender to rebuild this resource only."""
|
||||||
|
from pathlib import Path
|
||||||
|
import runpy
|
||||||
|
runpy.run_path(str(Path(__file__).resolve().parents[2]/'shared/source/build_materials.py'),
|
||||||
|
init_globals={'ONLY_BALL':'wood_ball'})
|
||||||
|
After Width: | Height: | Size: 398 KiB |
@@ -0,0 +1,40 @@
|
|||||||
|
[remap]
|
||||||
|
|
||||||
|
importer="texture"
|
||||||
|
type="CompressedTexture2D"
|
||||||
|
uid="uid://bpg05wpdgk3ip"
|
||||||
|
path="res://.godot/imported/albedo.png-b9f9faa18ff7a60c8139629d52fcd67d.ctex"
|
||||||
|
metadata={
|
||||||
|
"vram_texture": false
|
||||||
|
}
|
||||||
|
|
||||||
|
[deps]
|
||||||
|
|
||||||
|
source_file="res://assets/balls/wood_ball/textures/albedo.png"
|
||||||
|
dest_files=["res://.godot/imported/albedo.png-b9f9faa18ff7a60c8139629d52fcd67d.ctex"]
|
||||||
|
|
||||||
|
[params]
|
||||||
|
|
||||||
|
compress/mode=0
|
||||||
|
compress/high_quality=false
|
||||||
|
compress/lossy_quality=0.7
|
||||||
|
compress/uastc_level=0
|
||||||
|
compress/rdo_quality_loss=0.0
|
||||||
|
compress/hdr_compression=1
|
||||||
|
compress/normal_map=0
|
||||||
|
compress/channel_pack=0
|
||||||
|
mipmaps/generate=false
|
||||||
|
mipmaps/limit=-1
|
||||||
|
roughness/mode=0
|
||||||
|
roughness/src_normal=""
|
||||||
|
process/channel_remap/red=0
|
||||||
|
process/channel_remap/green=1
|
||||||
|
process/channel_remap/blue=2
|
||||||
|
process/channel_remap/alpha=3
|
||||||
|
process/fix_alpha_border=true
|
||||||
|
process/premult_alpha=false
|
||||||
|
process/normal_map_invert_y=false
|
||||||
|
process/hdr_as_srgb=false
|
||||||
|
process/hdr_clamp_exposure=false
|
||||||
|
process/size_limit=0
|
||||||
|
detect_3d/compress_to=1
|
||||||
|
After Width: | Height: | Size: 154 KiB |
@@ -0,0 +1,40 @@
|
|||||||
|
[remap]
|
||||||
|
|
||||||
|
importer="texture"
|
||||||
|
type="CompressedTexture2D"
|
||||||
|
uid="uid://c3llp5lu756e6"
|
||||||
|
path="res://.godot/imported/roughness.png-29fa2a28b7968617794dfe15bf2a9b31.ctex"
|
||||||
|
metadata={
|
||||||
|
"vram_texture": false
|
||||||
|
}
|
||||||
|
|
||||||
|
[deps]
|
||||||
|
|
||||||
|
source_file="res://assets/balls/wood_ball/textures/roughness.png"
|
||||||
|
dest_files=["res://.godot/imported/roughness.png-29fa2a28b7968617794dfe15bf2a9b31.ctex"]
|
||||||
|
|
||||||
|
[params]
|
||||||
|
|
||||||
|
compress/mode=0
|
||||||
|
compress/high_quality=false
|
||||||
|
compress/lossy_quality=0.7
|
||||||
|
compress/uastc_level=0
|
||||||
|
compress/rdo_quality_loss=0.0
|
||||||
|
compress/hdr_compression=1
|
||||||
|
compress/normal_map=0
|
||||||
|
compress/channel_pack=0
|
||||||
|
mipmaps/generate=false
|
||||||
|
mipmaps/limit=-1
|
||||||
|
roughness/mode=0
|
||||||
|
roughness/src_normal=""
|
||||||
|
process/channel_remap/red=0
|
||||||
|
process/channel_remap/green=1
|
||||||
|
process/channel_remap/blue=2
|
||||||
|
process/channel_remap/alpha=3
|
||||||
|
process/fix_alpha_border=true
|
||||||
|
process/premult_alpha=false
|
||||||
|
process/normal_map_invert_y=false
|
||||||
|
process/hdr_as_srgb=false
|
||||||
|
process/hdr_clamp_exposure=false
|
||||||
|
process/size_limit=0
|
||||||
|
detect_3d/compress_to=1
|
||||||
@@ -0,0 +1,27 @@
|
|||||||
|
extends RefCounted
|
||||||
|
|
||||||
|
const ALTERNATE_TEXTURES := [
|
||||||
|
preload("res://assets/blocks/ice/textures/top_albedo_diagonal.png"),
|
||||||
|
preload("res://assets/blocks/ice/textures/top_albedo_forked.png"),
|
||||||
|
]
|
||||||
|
const TOP_MATERIAL := "Storybook / ice top"
|
||||||
|
|
||||||
|
static var overrides: Dictionary[Texture2D, StandardMaterial3D] = {}
|
||||||
|
|
||||||
|
static func apply(visual: Node3D, location: Vector3) -> void:
|
||||||
|
# X/Z grid neighbors differ by one or two steps in the three-pattern cycle.
|
||||||
|
var pattern := posmod(roundi(location.x) + 2 * roundi(location.z), 3)
|
||||||
|
if pattern == 0:
|
||||||
|
return
|
||||||
|
var texture: Texture2D = ALTERNATE_TEXTURES[pattern - 1]
|
||||||
|
for node in visual.find_children("*", "MeshInstance3D", true, false):
|
||||||
|
var mesh_view := node as MeshInstance3D
|
||||||
|
for index in range(mesh_view.mesh.get_surface_count()):
|
||||||
|
var source := mesh_view.mesh.surface_get_material(index) as StandardMaterial3D
|
||||||
|
if source != null and source.resource_name == TOP_MATERIAL:
|
||||||
|
if not overrides.has(texture):
|
||||||
|
var material := source.duplicate() as StandardMaterial3D
|
||||||
|
material.albedo_texture = texture
|
||||||
|
overrides[texture] = material
|
||||||
|
mesh_view.set_surface_override_material(index, overrides[texture])
|
||||||
|
return
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
uid://cceffvenadusk
|
||||||
@@ -0,0 +1,35 @@
|
|||||||
|
extends Node3D
|
||||||
|
|
||||||
|
# One collision event, measured in N*s; do not sum resting support over time.
|
||||||
|
const BREAK_IMPULSE := 1000.0
|
||||||
|
const MIN_APPROACH_SPEED := 0.5
|
||||||
|
var broken := false
|
||||||
|
var events: Array=[]
|
||||||
|
var peak_impulse := 0.0
|
||||||
|
var pending_break := false
|
||||||
|
|
||||||
|
func receive_impact(ball_id: String, impulse: float, approach: float) -> void:
|
||||||
|
if broken or pending_break or approach<MIN_APPROACH_SPEED:return
|
||||||
|
peak_impulse=maxf(peak_impulse,impulse)
|
||||||
|
var should_break:=impulse>=BREAK_IMPULSE
|
||||||
|
events.append({"ballId":ball_id,"normalImpulseNs":impulse,"approachSpeedMps":approach,
|
||||||
|
"thresholdNs":BREAK_IMPULSE,"breaks":should_break,"tick":Engine.get_physics_frames()})
|
||||||
|
if should_break:
|
||||||
|
pending_break=true
|
||||||
|
call_deferred("break_block")
|
||||||
|
|
||||||
|
func set_solids(node: Node, enabled: bool) -> void:
|
||||||
|
if node is StaticBody3D:
|
||||||
|
node.collision_layer=1 if enabled else 0
|
||||||
|
node.collision_mask=2 if enabled else 0
|
||||||
|
for child in node.get_children():set_solids(child,enabled)
|
||||||
|
|
||||||
|
func break_block() -> void:
|
||||||
|
broken=true;pending_break=false
|
||||||
|
set_solids(self,false)
|
||||||
|
# Visual shards are deliberately not additional dynamic physics objects.
|
||||||
|
hide()
|
||||||
|
|
||||||
|
func reset_block() -> void:
|
||||||
|
broken=false;pending_break=false;events.clear();peak_impulse=0
|
||||||
|
set_solids(self,true);show()
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
uid://gikvxj5eoy8f
|
||||||
@@ -0,0 +1,45 @@
|
|||||||
|
[remap]
|
||||||
|
|
||||||
|
importer="scene"
|
||||||
|
importer_version=1
|
||||||
|
type="PackedScene"
|
||||||
|
uid="uid://cealspaapi3wr"
|
||||||
|
path="res://.godot/imported/model.glb-c7b9a7e8048912184e349a28d0afc078.scn"
|
||||||
|
|
||||||
|
[deps]
|
||||||
|
|
||||||
|
source_file="res://assets/blocks/ice/model.glb"
|
||||||
|
dest_files=["res://.godot/imported/model.glb-c7b9a7e8048912184e349a28d0afc078.scn"]
|
||||||
|
|
||||||
|
[params]
|
||||||
|
|
||||||
|
nodes/root_type=""
|
||||||
|
nodes/root_name=""
|
||||||
|
nodes/root_script=null
|
||||||
|
mesh_library/use_node_names_as_mesh_names=false
|
||||||
|
array_mesh/deduplicate_surfaces=true
|
||||||
|
nodes/apply_root_scale=true
|
||||||
|
nodes/root_scale=1.0
|
||||||
|
nodes/import_as_skeleton_bones=false
|
||||||
|
nodes/use_name_suffixes=true
|
||||||
|
nodes/use_node_type_suffixes=true
|
||||||
|
meshes/ensure_tangents=true
|
||||||
|
meshes/generate_lods=true
|
||||||
|
meshes/create_shadow_meshes=true
|
||||||
|
meshes/light_baking=1
|
||||||
|
meshes/lightmap_texel_size=0.2
|
||||||
|
meshes/force_disable_compression=false
|
||||||
|
skins/use_named_skins=true
|
||||||
|
animation/import=true
|
||||||
|
animation/fps=30
|
||||||
|
animation/trimming=false
|
||||||
|
animation/remove_immutable_tracks=true
|
||||||
|
animation/import_rest_as_RESET=false
|
||||||
|
import_script/path=""
|
||||||
|
materials/extract=0
|
||||||
|
materials/extract_format=0
|
||||||
|
materials/extract_path=""
|
||||||
|
_subresources={}
|
||||||
|
gltf/naming_version=2
|
||||||
|
gltf/embedded_image_handling=1
|
||||||
|
gltf/texture_map_mode=1
|
||||||
|
After Width: | Height: | Size: 57 KiB |
@@ -0,0 +1,43 @@
|
|||||||
|
[remap]
|
||||||
|
|
||||||
|
importer="texture"
|
||||||
|
type="CompressedTexture2D"
|
||||||
|
uid="uid://b333t84ol1tjc"
|
||||||
|
path="res://.godot/imported/model_side_albedo.png-cc8d99ee30be1453a467ecd7ec028299.ctex"
|
||||||
|
metadata={
|
||||||
|
"vram_texture": false
|
||||||
|
}
|
||||||
|
generator_parameters={
|
||||||
|
"md5": "675ed44edaeb3797b77307376a3fc7d8"
|
||||||
|
}
|
||||||
|
|
||||||
|
[deps]
|
||||||
|
|
||||||
|
source_file="res://assets/blocks/ice/model_side_albedo.png"
|
||||||
|
dest_files=["res://.godot/imported/model_side_albedo.png-cc8d99ee30be1453a467ecd7ec028299.ctex"]
|
||||||
|
|
||||||
|
[params]
|
||||||
|
|
||||||
|
compress/mode=0
|
||||||
|
compress/high_quality=false
|
||||||
|
compress/lossy_quality=0.7
|
||||||
|
compress/uastc_level=0
|
||||||
|
compress/rdo_quality_loss=0.0
|
||||||
|
compress/hdr_compression=1
|
||||||
|
compress/normal_map=0
|
||||||
|
compress/channel_pack=0
|
||||||
|
mipmaps/generate=true
|
||||||
|
mipmaps/limit=-1
|
||||||
|
roughness/mode=0
|
||||||
|
roughness/src_normal=""
|
||||||
|
process/channel_remap/red=0
|
||||||
|
process/channel_remap/green=1
|
||||||
|
process/channel_remap/blue=2
|
||||||
|
process/channel_remap/alpha=3
|
||||||
|
process/fix_alpha_border=true
|
||||||
|
process/premult_alpha=false
|
||||||
|
process/normal_map_invert_y=false
|
||||||
|
process/hdr_as_srgb=false
|
||||||
|
process/hdr_clamp_exposure=false
|
||||||
|
process/size_limit=0
|
||||||
|
detect_3d/compress_to=1
|
||||||
|
After Width: | Height: | Size: 106 KiB |
@@ -0,0 +1,43 @@
|
|||||||
|
[remap]
|
||||||
|
|
||||||
|
importer="texture"
|
||||||
|
type="CompressedTexture2D"
|
||||||
|
uid="uid://ca1pi33ncjm7j"
|
||||||
|
path="res://.godot/imported/model_top_albedo.png-8462eb5c935926c77ff3218b3b220b3f.ctex"
|
||||||
|
metadata={
|
||||||
|
"vram_texture": false
|
||||||
|
}
|
||||||
|
generator_parameters={
|
||||||
|
"md5": "d9b2c32e4399609dfc75440a7284ed56"
|
||||||
|
}
|
||||||
|
|
||||||
|
[deps]
|
||||||
|
|
||||||
|
source_file="res://assets/blocks/ice/model_top_albedo.png"
|
||||||
|
dest_files=["res://.godot/imported/model_top_albedo.png-8462eb5c935926c77ff3218b3b220b3f.ctex"]
|
||||||
|
|
||||||
|
[params]
|
||||||
|
|
||||||
|
compress/mode=0
|
||||||
|
compress/high_quality=false
|
||||||
|
compress/lossy_quality=0.7
|
||||||
|
compress/uastc_level=0
|
||||||
|
compress/rdo_quality_loss=0.0
|
||||||
|
compress/hdr_compression=1
|
||||||
|
compress/normal_map=0
|
||||||
|
compress/channel_pack=0
|
||||||
|
mipmaps/generate=true
|
||||||
|
mipmaps/limit=-1
|
||||||
|
roughness/mode=0
|
||||||
|
roughness/src_normal=""
|
||||||
|
process/channel_remap/red=0
|
||||||
|
process/channel_remap/green=1
|
||||||
|
process/channel_remap/blue=2
|
||||||
|
process/channel_remap/alpha=3
|
||||||
|
process/fix_alpha_border=true
|
||||||
|
process/premult_alpha=false
|
||||||
|
process/normal_map_invert_y=false
|
||||||
|
process/hdr_as_srgb=false
|
||||||
|
process/hdr_clamp_exposure=false
|
||||||
|
process/size_limit=0
|
||||||
|
detect_3d/compress_to=1
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
"""Build only this block through the shared asset authoring code."""
|
||||||
|
from pathlib import Path
|
||||||
|
import runpy
|
||||||
|
ROOT = Path(__file__).resolve().parents[4]
|
||||||
|
runpy.run_path(str(ROOT / "assets/collections/storybook/source/build.py"),
|
||||||
|
init_globals={"ONLY_ASSET": "ice"}, run_name="__main__")
|
||||||
@@ -0,0 +1,143 @@
|
|||||||
|
"""Bake the storybook ice color maps and bind them to the existing cube."""
|
||||||
|
|
||||||
|
import struct
|
||||||
|
import zlib
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
|
import bpy
|
||||||
|
import numpy as np
|
||||||
|
|
||||||
|
|
||||||
|
ASSET = Path(__file__).resolve().parents[1]
|
||||||
|
REFERENCES = ASSET.parents[2] / 'references/materials/ice/textures'
|
||||||
|
SIZE = 512
|
||||||
|
CRACK_PATTERNS = {
|
||||||
|
'top_albedo.png': (
|
||||||
|
([(0.0, .34), (.26, .42), (.40, .60), (.68, .54), (.92, .73)], .019),
|
||||||
|
([(.40, .60), (.44, .77), (.35, .94)], .011),
|
||||||
|
([(.68, .54), (.74, .32), (.89, .21)], .012),
|
||||||
|
),
|
||||||
|
'top_albedo_diagonal.png': (
|
||||||
|
([(.10, .86), (.28, .68), (.34, .49), (.57, .36), (.64, .16), (.79, .08)], .018),
|
||||||
|
([(.34, .49), (.21, .40), (.08, .39)], .011),
|
||||||
|
([(.57, .36), (.73, .48), (.92, .46)], .012),
|
||||||
|
),
|
||||||
|
'top_albedo_forked.png': (
|
||||||
|
([(.63, .04), (.57, .23), (.65, .39), (.49, .57), (.54, .76), (.44, .93)], .018),
|
||||||
|
([(.57, .23), (.39, .28), (.29, .18)], .011),
|
||||||
|
([(.65, .39), (.80, .40), (.92, .52)], .012),
|
||||||
|
([(.49, .57), (.30, .61), (.23, .79)], .010),
|
||||||
|
),
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
def mix(image, color, weight):
|
||||||
|
return image + (np.asarray(color) - image) * np.expand_dims(weight, -1)
|
||||||
|
|
||||||
|
|
||||||
|
def ramp(low, high, value):
|
||||||
|
t = np.clip((value - low) / (high - low), 0, 1)
|
||||||
|
return t * t * (3 - 2 * t)
|
||||||
|
|
||||||
|
|
||||||
|
def stroke(u, v, points, width):
|
||||||
|
distance = np.full_like(u, np.inf)
|
||||||
|
for (ax, ay), (bx, by) in zip(points, points[1:]):
|
||||||
|
dx, dy = bx - ax, by - ay
|
||||||
|
along = np.clip(((u - ax) * dx + (v - ay) * dy) / (dx * dx + dy * dy), 0, 1)
|
||||||
|
distance = np.minimum(distance, np.hypot(u - ax - along * dx, v - ay - along * dy))
|
||||||
|
return 1 - ramp(width * 0.48, width, distance)
|
||||||
|
|
||||||
|
|
||||||
|
def reference_tone(path):
|
||||||
|
resolution = 16
|
||||||
|
image = bpy.data.images.load(str(REFERENCES / path), check_existing=False)
|
||||||
|
image.scale(resolution, resolution)
|
||||||
|
pixels = np.empty(resolution * resolution * 4, dtype=np.float32)
|
||||||
|
image.pixels.foreach_get(pixels)
|
||||||
|
bpy.data.images.remove(image)
|
||||||
|
tone = pixels.reshape(resolution, resolution, 4)[:, :, :3].mean(axis=2)
|
||||||
|
tone = (tone - tone.mean()) / max(tone.std(), 0.001)
|
||||||
|
grid = np.arange(resolution)
|
||||||
|
coordinates = np.linspace(0, resolution - 1, SIZE)
|
||||||
|
rows = [np.interp(coordinates, grid, row) for row in tone]
|
||||||
|
return np.stack([np.interp(coordinates, grid, column) for column in np.asarray(rows).T], axis=1)
|
||||||
|
|
||||||
|
|
||||||
|
def save_color(name, color):
|
||||||
|
path = ASSET / 'textures' / name
|
||||||
|
path.parent.mkdir(parents=True, exist_ok=True)
|
||||||
|
# PNG scanlines run top-down, whereas UV V starts at the bottom.
|
||||||
|
rgb = np.clip(np.rint(color[::-1] * 255), 0, 255).astype(np.uint8)
|
||||||
|
scanlines = b''.join(b'\x00' + row.tobytes() for row in rgb)
|
||||||
|
|
||||||
|
def chunk(kind, payload):
|
||||||
|
return (struct.pack('!I', len(payload)) + kind + payload
|
||||||
|
+ struct.pack('!I', zlib.crc32(kind + payload)))
|
||||||
|
|
||||||
|
header = struct.pack('!IIBBBBB', SIZE, SIZE, 8, 2, 0, 0, 0)
|
||||||
|
path.write_bytes(b'\x89PNG\r\n\x1a\n' + chunk(b'IHDR', header)
|
||||||
|
+ chunk(b'IDAT', zlib.compress(scanlines, 9)) + chunk(b'IEND', b''))
|
||||||
|
|
||||||
|
|
||||||
|
def bake_color_maps():
|
||||||
|
samples = (np.arange(SIZE) + 0.5) / SIZE
|
||||||
|
u, v = np.meshgrid(samples, samples)
|
||||||
|
lake = reference_tone('ambientcg-ice003/Ice003_1K-JPG_Color.jpg')
|
||||||
|
frost = reference_tone('ambientcg-ice002/Ice002_1K-JPG_Color.jpg')
|
||||||
|
blue = reference_tone('oga-y2k/y2k_ice_texture.png')
|
||||||
|
|
||||||
|
top = mix((.44, .65, .75), (.54, .73, .81), ramp(-1.5, 1.6, lake))
|
||||||
|
facet = ramp(.42, .45, u * .55 + v * .82) * (1 - ramp(.76, .80, u * .55 + v * .82))
|
||||||
|
top = mix(top, (.67, .81, .87), facet * .33)
|
||||||
|
edge = np.minimum(np.minimum(u, 1 - u), np.minimum(v, 1 - v))
|
||||||
|
top = mix(top, (.86, .95, .94), (1 - ramp(.025, .14, edge + frost * .022)) * .73)
|
||||||
|
# Broken, angular highlight strokes hint at cracks just below the surface.
|
||||||
|
for filename, pattern in CRACK_PATTERNS.items():
|
||||||
|
painted_top = top
|
||||||
|
for points, width in pattern:
|
||||||
|
dark_lip = [(x, y - .019) for x, y in points]
|
||||||
|
painted_top = mix(painted_top, (.27, .55, .69), stroke(u, v, dark_lip, width) * .37)
|
||||||
|
painted_top = mix(painted_top, (.85, .94, .97), stroke(u, v, points, width) * .72)
|
||||||
|
save_color(filename, painted_top)
|
||||||
|
|
||||||
|
side = mix((.31, .49, .64), (.51, .69, .78), ramp(.05, 1.05, v + blue * .10))
|
||||||
|
icy_band = np.exp(-((v - (.82 + .05 * np.sin(7 * u))) / .064) ** 2)
|
||||||
|
side = mix(side, (.79, .92, .94), icy_band * .72)
|
||||||
|
streak = stroke(u, v, [(.07, .42), (.32, .59), (.58, .51), (.94, .67)], .019)
|
||||||
|
side = mix(side, (.74, .90, .94), streak * .64)
|
||||||
|
for x, y, size in [(.18, .65, .029), (.37, .31, .016), (.72, .42, .024), (.81, .25, .013)]:
|
||||||
|
bubble = np.hypot(u - x, (v - y) * .82) / size
|
||||||
|
edge = ramp(.49, .77, bubble) * (1 - ramp(.81, 1.1, bubble))
|
||||||
|
side = mix(side, (.77, .92, .95), edge * .62)
|
||||||
|
save_color('side_albedo.png', side)
|
||||||
|
|
||||||
|
|
||||||
|
def apply_ice_surface(obj, side, top):
|
||||||
|
uv = obj.data.uv_layers.new(name='Ice faces')
|
||||||
|
for polygon in obj.data.polygons:
|
||||||
|
for loop_index in polygon.loop_indices:
|
||||||
|
point = obj.data.vertices[obj.data.loops[loop_index].vertex_index].co
|
||||||
|
if abs(polygon.normal.z) > 0.5:
|
||||||
|
uv.uv[loop_index].vector = (point.x + 0.5, point.y + 0.5)
|
||||||
|
elif abs(polygon.normal.x) > 0.5:
|
||||||
|
uv.uv[loop_index].vector = (0.5 + point.y * polygon.normal.x, point.z)
|
||||||
|
else:
|
||||||
|
uv.uv[loop_index].vector = (0.5 - point.x * polygon.normal.y, point.z)
|
||||||
|
|
||||||
|
for material, file, roughness in ((side, 'side_albedo.png', .27), (top, 'top_albedo.png', .28)):
|
||||||
|
image = bpy.data.images.load(str(ASSET / 'textures' / file), check_existing=False)
|
||||||
|
image.colorspace_settings.name = 'sRGB'
|
||||||
|
image.pack()
|
||||||
|
texture = material.node_tree.nodes.new('ShaderNodeTexImage')
|
||||||
|
texture.image = image
|
||||||
|
texture.label = "Baked ice color"
|
||||||
|
texture.extension = 'EXTEND'
|
||||||
|
texture.location = (-420, 240)
|
||||||
|
shader = material.node_tree.nodes.get('Principled BSDF')
|
||||||
|
shader.inputs['Roughness'].default_value = roughness
|
||||||
|
material.node_tree.links.new(texture.outputs['Color'], shader.inputs['Base Color'])
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
bake_color_maps()
|
||||||
|
After Width: | Height: | Size: 57 KiB |
@@ -0,0 +1,40 @@
|
|||||||
|
[remap]
|
||||||
|
|
||||||
|
importer="texture"
|
||||||
|
type="CompressedTexture2D"
|
||||||
|
uid="uid://b54o021h5utjc"
|
||||||
|
path="res://.godot/imported/side_albedo.png-963130ae016ca2c9fdacec22c8083a03.ctex"
|
||||||
|
metadata={
|
||||||
|
"vram_texture": false
|
||||||
|
}
|
||||||
|
|
||||||
|
[deps]
|
||||||
|
|
||||||
|
source_file="res://assets/blocks/ice/textures/side_albedo.png"
|
||||||
|
dest_files=["res://.godot/imported/side_albedo.png-963130ae016ca2c9fdacec22c8083a03.ctex"]
|
||||||
|
|
||||||
|
[params]
|
||||||
|
|
||||||
|
compress/mode=0
|
||||||
|
compress/high_quality=false
|
||||||
|
compress/lossy_quality=0.7
|
||||||
|
compress/uastc_level=0
|
||||||
|
compress/rdo_quality_loss=0.0
|
||||||
|
compress/hdr_compression=1
|
||||||
|
compress/normal_map=0
|
||||||
|
compress/channel_pack=0
|
||||||
|
mipmaps/generate=false
|
||||||
|
mipmaps/limit=-1
|
||||||
|
roughness/mode=0
|
||||||
|
roughness/src_normal=""
|
||||||
|
process/channel_remap/red=0
|
||||||
|
process/channel_remap/green=1
|
||||||
|
process/channel_remap/blue=2
|
||||||
|
process/channel_remap/alpha=3
|
||||||
|
process/fix_alpha_border=true
|
||||||
|
process/premult_alpha=false
|
||||||
|
process/normal_map_invert_y=false
|
||||||
|
process/hdr_as_srgb=false
|
||||||
|
process/hdr_clamp_exposure=false
|
||||||
|
process/size_limit=0
|
||||||
|
detect_3d/compress_to=1
|
||||||
|
After Width: | Height: | Size: 106 KiB |
@@ -0,0 +1,40 @@
|
|||||||
|
[remap]
|
||||||
|
|
||||||
|
importer="texture"
|
||||||
|
type="CompressedTexture2D"
|
||||||
|
uid="uid://c5doqepwm5lq8"
|
||||||
|
path="res://.godot/imported/top_albedo.png-a33d5a5f3176baa32409ae18b5406d5f.ctex"
|
||||||
|
metadata={
|
||||||
|
"vram_texture": false
|
||||||
|
}
|
||||||
|
|
||||||
|
[deps]
|
||||||
|
|
||||||
|
source_file="res://assets/blocks/ice/textures/top_albedo.png"
|
||||||
|
dest_files=["res://.godot/imported/top_albedo.png-a33d5a5f3176baa32409ae18b5406d5f.ctex"]
|
||||||
|
|
||||||
|
[params]
|
||||||
|
|
||||||
|
compress/mode=0
|
||||||
|
compress/high_quality=false
|
||||||
|
compress/lossy_quality=0.7
|
||||||
|
compress/uastc_level=0
|
||||||
|
compress/rdo_quality_loss=0.0
|
||||||
|
compress/hdr_compression=1
|
||||||
|
compress/normal_map=0
|
||||||
|
compress/channel_pack=0
|
||||||
|
mipmaps/generate=false
|
||||||
|
mipmaps/limit=-1
|
||||||
|
roughness/mode=0
|
||||||
|
roughness/src_normal=""
|
||||||
|
process/channel_remap/red=0
|
||||||
|
process/channel_remap/green=1
|
||||||
|
process/channel_remap/blue=2
|
||||||
|
process/channel_remap/alpha=3
|
||||||
|
process/fix_alpha_border=true
|
||||||
|
process/premult_alpha=false
|
||||||
|
process/normal_map_invert_y=false
|
||||||
|
process/hdr_as_srgb=false
|
||||||
|
process/hdr_clamp_exposure=false
|
||||||
|
process/size_limit=0
|
||||||
|
detect_3d/compress_to=1
|
||||||
|
After Width: | Height: | Size: 101 KiB |
@@ -0,0 +1,40 @@
|
|||||||
|
[remap]
|
||||||
|
|
||||||
|
importer="texture"
|
||||||
|
type="CompressedTexture2D"
|
||||||
|
uid="uid://dad3qnhp5gnew"
|
||||||
|
path="res://.godot/imported/top_albedo_diagonal.png-9f83c91038a8a31954116876f1728b1c.ctex"
|
||||||
|
metadata={
|
||||||
|
"vram_texture": false
|
||||||
|
}
|
||||||
|
|
||||||
|
[deps]
|
||||||
|
|
||||||
|
source_file="res://assets/blocks/ice/textures/top_albedo_diagonal.png"
|
||||||
|
dest_files=["res://.godot/imported/top_albedo_diagonal.png-9f83c91038a8a31954116876f1728b1c.ctex"]
|
||||||
|
|
||||||
|
[params]
|
||||||
|
|
||||||
|
compress/mode=0
|
||||||
|
compress/high_quality=false
|
||||||
|
compress/lossy_quality=0.7
|
||||||
|
compress/uastc_level=0
|
||||||
|
compress/rdo_quality_loss=0.0
|
||||||
|
compress/hdr_compression=1
|
||||||
|
compress/normal_map=0
|
||||||
|
compress/channel_pack=0
|
||||||
|
mipmaps/generate=true
|
||||||
|
mipmaps/limit=-1
|
||||||
|
roughness/mode=0
|
||||||
|
roughness/src_normal=""
|
||||||
|
process/channel_remap/red=0
|
||||||
|
process/channel_remap/green=1
|
||||||
|
process/channel_remap/blue=2
|
||||||
|
process/channel_remap/alpha=3
|
||||||
|
process/fix_alpha_border=true
|
||||||
|
process/premult_alpha=false
|
||||||
|
process/normal_map_invert_y=false
|
||||||
|
process/hdr_as_srgb=false
|
||||||
|
process/hdr_clamp_exposure=false
|
||||||
|
process/size_limit=0
|
||||||
|
detect_3d/compress_to=1
|
||||||
|
After Width: | Height: | Size: 107 KiB |
@@ -0,0 +1,40 @@
|
|||||||
|
[remap]
|
||||||
|
|
||||||
|
importer="texture"
|
||||||
|
type="CompressedTexture2D"
|
||||||
|
uid="uid://b8g0ndalcro1s"
|
||||||
|
path="res://.godot/imported/top_albedo_forked.png-5e11afae8b5f5dbcd695da011563d83f.ctex"
|
||||||
|
metadata={
|
||||||
|
"vram_texture": false
|
||||||
|
}
|
||||||
|
|
||||||
|
[deps]
|
||||||
|
|
||||||
|
source_file="res://assets/blocks/ice/textures/top_albedo_forked.png"
|
||||||
|
dest_files=["res://.godot/imported/top_albedo_forked.png-5e11afae8b5f5dbcd695da011563d83f.ctex"]
|
||||||
|
|
||||||
|
[params]
|
||||||
|
|
||||||
|
compress/mode=0
|
||||||
|
compress/high_quality=false
|
||||||
|
compress/lossy_quality=0.7
|
||||||
|
compress/uastc_level=0
|
||||||
|
compress/rdo_quality_loss=0.0
|
||||||
|
compress/hdr_compression=1
|
||||||
|
compress/normal_map=0
|
||||||
|
compress/channel_pack=0
|
||||||
|
mipmaps/generate=true
|
||||||
|
mipmaps/limit=-1
|
||||||
|
roughness/mode=0
|
||||||
|
roughness/src_normal=""
|
||||||
|
process/channel_remap/red=0
|
||||||
|
process/channel_remap/green=1
|
||||||
|
process/channel_remap/blue=2
|
||||||
|
process/channel_remap/alpha=3
|
||||||
|
process/fix_alpha_border=true
|
||||||
|
process/premult_alpha=false
|
||||||
|
process/normal_map_invert_y=false
|
||||||
|
process/hdr_as_srgb=false
|
||||||
|
process/hdr_clamp_exposure=false
|
||||||
|
process/size_limit=0
|
||||||
|
detect_3d/compress_to=1
|
||||||
@@ -0,0 +1,62 @@
|
|||||||
|
extends Node3D
|
||||||
|
|
||||||
|
# Fixed game rule. No exported/per-instance speed or level override.
|
||||||
|
const FLOW_SPEED := 5.0
|
||||||
|
const DENSITY := 1000.0
|
||||||
|
const DRAG_COEFFICIENT := 0.47
|
||||||
|
var bounds := AABB()
|
||||||
|
var local_direction := Vector3.RIGHT
|
||||||
|
|
||||||
|
func _ready() -> void:
|
||||||
|
add_to_group("water_blocks")
|
||||||
|
|
||||||
|
func flow_velocity() -> Vector3:
|
||||||
|
return (global_basis * local_direction).normalized() * FLOW_SPEED
|
||||||
|
|
||||||
|
func world_bounds() -> AABB:
|
||||||
|
return global_transform * bounds
|
||||||
|
|
||||||
|
# Integrate vertical sphere columns against the UNION of nearby water cells.
|
||||||
|
# Exact vertical intervals, normalized horizontal quadrature: no seam collision,
|
||||||
|
# no doubled buoyancy in overlapping cells, and continuous partial immersion.
|
||||||
|
static func sample(center: Vector3, radius: float, blocks: Array) -> Dictionary:
|
||||||
|
var nearby: Array=[]
|
||||||
|
for block in blocks:
|
||||||
|
var box: AABB=block.world_bounds()
|
||||||
|
if box.grow(radius).has_point(center):nearby.append({"box":box,"velocity":block.flow_velocity()})
|
||||||
|
if nearby.is_empty():return {"fraction":0.0,"velocity":Vector3.ZERO}
|
||||||
|
var total:=0.0
|
||||||
|
var immersed:=0.0
|
||||||
|
var flow:=Vector3.ZERO
|
||||||
|
const SAMPLES := 12
|
||||||
|
for x in range(SAMPLES):
|
||||||
|
for z in range(SAMPLES):
|
||||||
|
var dx:=radius*((x+.5)*2/SAMPLES-1)
|
||||||
|
var dz:=radius*((z+.5)*2/SAMPLES-1)
|
||||||
|
var square:=radius*radius-dx*dx-dz*dz
|
||||||
|
if square<=0:continue
|
||||||
|
var half:=sqrt(square)
|
||||||
|
total+=2*half
|
||||||
|
var intervals: Array=[]
|
||||||
|
var edges: Array=[]
|
||||||
|
for water in nearby:
|
||||||
|
var box: AABB=water.box
|
||||||
|
var px:=center.x+dx;var pz:=center.z+dz
|
||||||
|
if px<box.position.x or px>=box.end.x or pz<box.position.z or pz>=box.end.z:continue
|
||||||
|
var low:=maxf(center.y-half,box.position.y)
|
||||||
|
var high:=minf(center.y+half,box.end.y)
|
||||||
|
if high<=low:continue
|
||||||
|
intervals.append({"low":low,"high":high,"velocity":water.velocity})
|
||||||
|
edges.append(low);edges.append(high)
|
||||||
|
edges.sort()
|
||||||
|
for i in range(edges.size()-1):
|
||||||
|
var length: float=edges[i+1]-edges[i]
|
||||||
|
if length<=0:continue
|
||||||
|
var midpoint: float=(edges[i+1]+edges[i])*.5
|
||||||
|
var velocity:=Vector3.ZERO;var count:=0
|
||||||
|
for interval in intervals:
|
||||||
|
if midpoint>=interval.low and midpoint<interval.high:
|
||||||
|
velocity+=interval.velocity;count+=1
|
||||||
|
if count>0:
|
||||||
|
immersed+=length;flow+=velocity/count*length
|
||||||
|
return {"fraction":clampf(immersed/total,0,1),"velocity":flow/immersed if immersed>0 else Vector3.ZERO}
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
uid://bey2xn6l6l4n0
|
||||||
@@ -0,0 +1,45 @@
|
|||||||
|
[remap]
|
||||||
|
|
||||||
|
importer="scene"
|
||||||
|
importer_version=1
|
||||||
|
type="PackedScene"
|
||||||
|
uid="uid://i0s5sv81yqmg"
|
||||||
|
path="res://.godot/imported/model.glb-1c09ff60726251c5b1b0129f9ed81873.scn"
|
||||||
|
|
||||||
|
[deps]
|
||||||
|
|
||||||
|
source_file="res://assets/blocks/water/model.glb"
|
||||||
|
dest_files=["res://.godot/imported/model.glb-1c09ff60726251c5b1b0129f9ed81873.scn"]
|
||||||
|
|
||||||
|
[params]
|
||||||
|
|
||||||
|
nodes/root_type=""
|
||||||
|
nodes/root_name=""
|
||||||
|
nodes/root_script=null
|
||||||
|
mesh_library/use_node_names_as_mesh_names=false
|
||||||
|
array_mesh/deduplicate_surfaces=true
|
||||||
|
nodes/apply_root_scale=true
|
||||||
|
nodes/root_scale=1.0
|
||||||
|
nodes/import_as_skeleton_bones=false
|
||||||
|
nodes/use_name_suffixes=true
|
||||||
|
nodes/use_node_type_suffixes=true
|
||||||
|
meshes/ensure_tangents=true
|
||||||
|
meshes/generate_lods=true
|
||||||
|
meshes/create_shadow_meshes=true
|
||||||
|
meshes/light_baking=1
|
||||||
|
meshes/lightmap_texel_size=0.2
|
||||||
|
meshes/force_disable_compression=false
|
||||||
|
skins/use_named_skins=true
|
||||||
|
animation/import=true
|
||||||
|
animation/fps=30
|
||||||
|
animation/trimming=false
|
||||||
|
animation/remove_immutable_tracks=true
|
||||||
|
animation/import_rest_as_RESET=false
|
||||||
|
import_script/path=""
|
||||||
|
materials/extract=0
|
||||||
|
materials/extract_format=0
|
||||||
|
materials/extract_path=""
|
||||||
|
_subresources={}
|
||||||
|
gltf/naming_version=2
|
||||||
|
gltf/embedded_image_handling=1
|
||||||
|
gltf/texture_map_mode=1
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
"""Build only this block through the shared asset authoring code."""
|
||||||
|
from pathlib import Path
|
||||||
|
import runpy
|
||||||
|
ROOT = Path(__file__).resolve().parents[4]
|
||||||
|
runpy.run_path(str(ROOT / "assets/collections/storybook/source/build.py"),
|
||||||
|
init_globals={"ONLY_ASSET": "water"}, run_name="__main__")
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
extends RefCounted
|
||||||
|
|
||||||
|
const SHADER := preload("res://assets/blocks/water/surface.gdshader")
|
||||||
|
|
||||||
|
static var materials_by_direction: Dictionary[Vector3, ShaderMaterial] = {}
|
||||||
|
|
||||||
|
static func apply(visual: Node3D, local_direction: Vector3) -> void:
|
||||||
|
if not materials_by_direction.has(local_direction):
|
||||||
|
var material := ShaderMaterial.new()
|
||||||
|
material.shader = SHADER
|
||||||
|
material.set_shader_parameter("local_flow_direction", local_direction)
|
||||||
|
materials_by_direction[local_direction] = material
|
||||||
|
var surface := materials_by_direction[local_direction]
|
||||||
|
for node in visual.find_children("*", "MeshInstance3D", true, false):
|
||||||
|
var mesh_view := node as MeshInstance3D
|
||||||
|
for index in range(mesh_view.mesh.get_surface_count()):
|
||||||
|
var source := mesh_view.mesh.surface_get_material(index)
|
||||||
|
if source != null and source.resource_name.ends_with("water_surface"):
|
||||||
|
mesh_view.set_surface_override_material(index, surface)
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
uid://bvuxde78w5evh
|
||||||
@@ -0,0 +1,56 @@
|
|||||||
|
shader_type spatial;
|
||||||
|
render_mode unshaded, shadows_disabled;
|
||||||
|
|
||||||
|
uniform vec3 local_flow_direction = vec3(1.0, 0.0, 0.0);
|
||||||
|
uniform vec4 water_tint : source_color = vec4(0.25, 0.68, 0.75, 0.55);
|
||||||
|
uniform vec4 foam_tint : source_color = vec4(0.88, 0.98, 0.95, 0.93);
|
||||||
|
|
||||||
|
varying vec2 world_xz;
|
||||||
|
varying vec2 downstream;
|
||||||
|
|
||||||
|
void vertex() {
|
||||||
|
world_xz = (MODEL_MATRIX * vec4(VERTEX, 1.0)).xz;
|
||||||
|
downstream = normalize((MODEL_MATRIX * vec4(local_flow_direction, 0.0)).xz);
|
||||||
|
}
|
||||||
|
|
||||||
|
float cell_random(vec2 cell) {
|
||||||
|
vec3 p = fract(cell.xyx * vec3(0.1031, 0.1030, 0.0973));
|
||||||
|
p += dot(p, p.yzx + 33.33);
|
||||||
|
return fract((p.x + p.y) * p.z);
|
||||||
|
}
|
||||||
|
|
||||||
|
float foam_strokes(vec2 stream) {
|
||||||
|
// World-space lanes carry irregular strokes across same-direction tiles.
|
||||||
|
// The lateral offset between lanes keeps them from forming rows of dots.
|
||||||
|
vec2 cell_size = vec2(0.52, 0.25);
|
||||||
|
vec2 grid = stream / cell_size;
|
||||||
|
grid.x += cell_random(vec2(floor(grid.y), 4.8));
|
||||||
|
vec2 cell = floor(grid);
|
||||||
|
vec2 center = vec2(
|
||||||
|
mix(0.32, 0.68, cell_random(cell + vec2(1.4, 0.0))),
|
||||||
|
mix(0.3, 0.7, cell_random(cell + vec2(0.0, 6.2)))
|
||||||
|
);
|
||||||
|
vec2 offset = (fract(grid) - center) * cell_size;
|
||||||
|
float half_length = mix(0.062, 0.147, cell_random(cell + vec2(7.3, 3.2)));
|
||||||
|
float width = mix(0.015, 0.032, cell_random(cell + vec2(4.7, 8.2)));
|
||||||
|
float along = offset.x / half_length;
|
||||||
|
float curve = 0.013 * (along * along - 0.5);
|
||||||
|
float taper = mix(0.5, 1.0, smoothstep(-0.85, 0.48, along));
|
||||||
|
float dist = length(vec2(along, (offset.y - curve) / (width * taper)));
|
||||||
|
float edge = clamp(fwidth(dist), 0.11, 0.5);
|
||||||
|
float brightness = mix(0.52, 1.0, cell_random(cell + vec2(3.5, 0.0)));
|
||||||
|
return (1.0 - smoothstep(0.92 - edge, 0.92 + edge, dist)) * brightness;
|
||||||
|
}
|
||||||
|
|
||||||
|
void fragment() {
|
||||||
|
vec2 across = vec2(-downstream.y, downstream.x);
|
||||||
|
vec2 stream = vec2(dot(world_xz, downstream), dot(world_xz, across));
|
||||||
|
// Presentation speed gives the eye time to follow one stroke across a tile.
|
||||||
|
// Water contact forces are defined independently in behavior.gd.
|
||||||
|
float foam = foam_strokes(stream - vec2(TIME * 0.94, 0.0));
|
||||||
|
float ripple = sin(stream.x * 14.0 + sin(stream.y * 15.0) - TIME * 2.3);
|
||||||
|
float ripple_highlight = smoothstep(0.4, 0.97, ripple) * 0.11;
|
||||||
|
vec3 water_color = mix(water_tint.rgb, foam_tint.rgb, ripple_highlight);
|
||||||
|
ALBEDO = mix(water_color, foam_tint.rgb, foam);
|
||||||
|
ALPHA = mix(water_tint.a, foam_tint.a, foam);
|
||||||
|
}
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
uid://bbhuaekghhu6
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
# 90°弯槽
|
||||||
|
|
||||||
|
唯一现用弯槽资源 ID 为 `turn_90`,保留 0° / 90° / 180° / 270° 四个朝向。水平四分之一圆槽双向通行,转向由来球方向和摆放朝向决定。
|
||||||
|
|
||||||
|
- [model.glb](model.glb):现用画风模型。
|
||||||
|
- [source/model.blend](source/model.blend):独立可编辑源文件。
|
||||||
|
- [source/build.py](source/build.py):制作入口;也可运行 `./scripts/asset.zsh turn_90`。
|
||||||
|
- [baseline/model.glb](baseline/model.glb):早期画风变体,保留原右弯的几何。
|
||||||
|
|
||||||
|
0° 形态沿用旧 `turn_cw`。旧 `turn_ccw` 的世界形状转换为本资源时,旋转量增加一档;V1 槽上出生点还需反转路径参数。兼容转换由 `designer/scripts/level_data.gd` 处理。旧两个资源目录与来源快照保留作历史输入,不再作为独立素材注册。
|
||||||
@@ -0,0 +1,45 @@
|
|||||||
|
[remap]
|
||||||
|
|
||||||
|
importer="scene"
|
||||||
|
importer_version=1
|
||||||
|
type="PackedScene"
|
||||||
|
uid="uid://660161g43mg"
|
||||||
|
path="res://.godot/imported/model.glb-6e4e2b5277a4c9d9a8b62948f5329f60.scn"
|
||||||
|
|
||||||
|
[deps]
|
||||||
|
|
||||||
|
source_file="res://assets/chutes/turn_90/baseline/model.glb"
|
||||||
|
dest_files=["res://.godot/imported/model.glb-6e4e2b5277a4c9d9a8b62948f5329f60.scn"]
|
||||||
|
|
||||||
|
[params]
|
||||||
|
|
||||||
|
nodes/root_type=""
|
||||||
|
nodes/root_name=""
|
||||||
|
nodes/root_script=null
|
||||||
|
mesh_library/use_node_names_as_mesh_names=false
|
||||||
|
array_mesh/deduplicate_surfaces=true
|
||||||
|
nodes/apply_root_scale=true
|
||||||
|
nodes/root_scale=1.0
|
||||||
|
nodes/import_as_skeleton_bones=false
|
||||||
|
nodes/use_name_suffixes=true
|
||||||
|
nodes/use_node_type_suffixes=true
|
||||||
|
meshes/ensure_tangents=true
|
||||||
|
meshes/generate_lods=true
|
||||||
|
meshes/create_shadow_meshes=true
|
||||||
|
meshes/light_baking=1
|
||||||
|
meshes/lightmap_texel_size=0.2
|
||||||
|
meshes/force_disable_compression=false
|
||||||
|
skins/use_named_skins=true
|
||||||
|
animation/import=true
|
||||||
|
animation/fps=30
|
||||||
|
animation/trimming=false
|
||||||
|
animation/remove_immutable_tracks=true
|
||||||
|
animation/import_rest_as_RESET=false
|
||||||
|
import_script/path=""
|
||||||
|
materials/extract=0
|
||||||
|
materials/extract_format=0
|
||||||
|
materials/extract_path=""
|
||||||
|
_subresources={}
|
||||||
|
gltf/naming_version=2
|
||||||
|
gltf/embedded_image_handling=1
|
||||||
|
gltf/texture_map_mode=1
|
||||||
@@ -0,0 +1,45 @@
|
|||||||
|
[remap]
|
||||||
|
|
||||||
|
importer="scene"
|
||||||
|
importer_version=1
|
||||||
|
type="PackedScene"
|
||||||
|
uid="uid://cn5h2x48nsbhj"
|
||||||
|
path="res://.godot/imported/model.glb-6183ca490ca3b8fa4d6ec933b6abb6dc.scn"
|
||||||
|
|
||||||
|
[deps]
|
||||||
|
|
||||||
|
source_file="res://assets/chutes/turn_90/model.glb"
|
||||||
|
dest_files=["res://.godot/imported/model.glb-6183ca490ca3b8fa4d6ec933b6abb6dc.scn"]
|
||||||
|
|
||||||
|
[params]
|
||||||
|
|
||||||
|
nodes/root_type=""
|
||||||
|
nodes/root_name=""
|
||||||
|
nodes/root_script=null
|
||||||
|
mesh_library/use_node_names_as_mesh_names=false
|
||||||
|
array_mesh/deduplicate_surfaces=true
|
||||||
|
nodes/apply_root_scale=true
|
||||||
|
nodes/root_scale=1.0
|
||||||
|
nodes/import_as_skeleton_bones=false
|
||||||
|
nodes/use_name_suffixes=true
|
||||||
|
nodes/use_node_type_suffixes=true
|
||||||
|
meshes/ensure_tangents=true
|
||||||
|
meshes/generate_lods=true
|
||||||
|
meshes/create_shadow_meshes=true
|
||||||
|
meshes/light_baking=1
|
||||||
|
meshes/lightmap_texel_size=0.2
|
||||||
|
meshes/force_disable_compression=false
|
||||||
|
skins/use_named_skins=true
|
||||||
|
animation/import=true
|
||||||
|
animation/fps=30
|
||||||
|
animation/trimming=false
|
||||||
|
animation/remove_immutable_tracks=true
|
||||||
|
animation/import_rest_as_RESET=false
|
||||||
|
import_script/path=""
|
||||||
|
materials/extract=0
|
||||||
|
materials/extract_format=0
|
||||||
|
materials/extract_path=""
|
||||||
|
_subresources={}
|
||||||
|
gltf/naming_version=2
|
||||||
|
gltf/embedded_image_handling=1
|
||||||
|
gltf/texture_map_mode=1
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
"""Rebuild only this resource using the shared collection authoring code."""
|
||||||
|
from pathlib import Path
|
||||||
|
import runpy
|
||||||
|
|
||||||
|
RESOURCE = Path(__file__).resolve().parent.parent.name
|
||||||
|
ROOT = Path(__file__).resolve().parents[4]
|
||||||
|
runpy.run_path(str(ROOT / 'assets/collections/storybook/source/build.py'),
|
||||||
|
init_globals={'ONLY_ASSET': RESOURCE}, run_name='__main__')
|
||||||