Skip to content

Minecraft 即時 3D 投影與自動區域分割 (Real-time 3D-to-2D Projection & Auto-Segmentation in Minecraft via Basis Vector Transformation): code:

Notifications You must be signed in to change notification settings

evan6007/Minecraft-Auto-Segmentation

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 

Repository files navigation

NovaView – Minecraft AR HUD Overlay

用 Minecraft 的 latest.log 即時讀取玩家 座標 (Pos)視角 (Rotation),並使用 Python 在螢幕上疊加 AR 標記(多邊形區域 + 點位距離)。

🎬 Demo Video

https://youtu.be/NGRIXmHUiX4


✅ Features

  • 讀取 Minecraft log:DATA:[x,y,z]|[yaw,pitch]
  • 依照玩家視角將世界座標投影到螢幕
  • 繪製半透明多邊形區域與頂點標籤、距離顯示
  • 以 Minecraft 視窗畫面作為背景進行 overlay

🧰 Requirements

  • Windows 10 / 11
  • Python 3.10 – 3.12
  • Minecraft(建議視窗模式或無邊框視窗)
  • Creative Mode(Cheats ON,可使用指令方塊)

🛠 Minecraft 設置指南 (Setup Guide)

目標:讓 Minecraft 每秒持續把玩家 PosRotation 寫入 latest.log,供 Python 腳本讀取。

1) 取得指令方塊

在聊天欄輸入:

/give @p command_block

2) 放置並設定指令方塊

右鍵點擊指令方塊,設定為:

  • Block Type:Repeat(循環 / 紫色)
  • Redstone:Always Active(保持開啟)

3) 貼上數據發送指令

在指令方塊的 Console Command 欄位貼上:

tellraw @a ["DATA:",{"nbt":"Pos","entity":"@p"},"|",{"nbt":"Rotation","entity":"@p"}]

輸出格式為:

DATA:[x,y,z]|[yaw,pitch]

4) 防止聊天洗版(建議)

/gamerule commandBlockOutput false

5) 避免投影偏差(非常重要)

  • 關閉 View Bobbing Options → Video Settings → View Bobbing: OFF
  • 確認遊戲 FOV 為 70(或與程式碼中的 MC_FOV 一致)

▶️ How to Run (novaview.py)

1) 安裝 Python 套件

在專案資料夾開啟終端機(PowerShell / CMD),執行:

pip install pygame mss numpy pygetwindow

2) 設定 Minecraft log 路徑

打開 novaview.py,修改以下路徑為你自己的 Windows 使用者名稱:

LOG_PATH = r"C:\Users\YOUR_NAME\AppData\Roaming\.minecraft\logs\latest.log"

範例:

LOG_PATH = r"C:\Users\evan6\AppData\Roaming\.minecraft\logs\latest.log"

3) 先啟動 Minecraft

  1. 啟動 Minecraft 並進入世界
  2. 確認指令方塊正在持續輸出 DATA:...

4) 執行程式

python novaview.py

成功後會出現 overlay 視窗,AR polygon 會疊加在 Minecraft 畫面上。


⚙️ Customize Targets

可在 novaview.py 中修改 TARGET_SITES 來設定世界座標點位:

TARGET_SITES = [
    {"pos": [31.5, 75.0, 62.5], "color": (255, 50, 50), "label": "A"},
    {"pos": [28.5, 73.0, 63.5], "color": (50, 255, 50), "label": "B"},
    {"pos": [29.5, 73.0, 65.5], "color": (50, 50, 255), "label": "C"},
    {"pos": [32.5, 72.5, 65.5], "color": (255, 255, 50), "label": "D"},
]

🧯 Troubleshooting

找不到 Minecraft 視窗

程式預設使用視窗標題 Minecraft 來抓取視窗。若你的標題包含版本號或語言不同,請修改程式中對應的視窗標題關鍵字。

沒有 DATA 或 overlay 不更新

  • 確認指令方塊為 Repeat + Always Active
  • 確認 tellraw 指令正確(不要加 /
  • 確認 LOG_PATH 指向正確的 latest.log
  • 確認已進入世界(主選單通常不會刷 log)

🛑 Stop

關閉

About

Minecraft 即時 3D 投影與自動區域分割 (Real-time 3D-to-2D Projection & Auto-Segmentation in Minecraft via Basis Vector Transformation): code:

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages