<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[3D模型生成 trellis2 - r9700 rocm]]></title><description><![CDATA[<h1>R9700 跑 TRELLIS.2 ROCm：先把能跑的路徑整理出來</h1>
<p dir="auto">這份工具箱不是要把 TRELLIS.2 重新包成一個完整產品。比較實際的目標是：在 AMD Radeon AI PRO R9700 這張卡上，先整理出一條可以重現的 image-to-3D 測試流程。</p>
<p dir="auto">R9700 的硬體規格看起來很適合做本地 AI Lab，但 ROCm、RDNA4、3D 生成模型這幾個東西湊在一起，細節其實不少。官方或社群專案通常會先以 NVIDIA / CUDA 當主要路徑，AMD 這邊常常要自己補一段。</p>
<h2>為什麼要另外整理一包</h2>
<p dir="auto">我測的是 <a href="https://github.com/Cardboard-box-a/TRELLIS.2_rocm" rel="nofollow ugc">TRELLIS.2 的 ROCm fork</a> 。模型本身可以跑，問題主要卡在高品質輸出時的貼圖與 mesh 後處理。</p>
<p dir="auto">原本的 textured GLB export 會走 GPU BVH 路徑，其中有一段 <code>cumesh.cuBVH.unsigned_distance()</code>。在 R9700 / gfx1201 的 ROCm 環境下，這段有機會讓 HIP 進入 illegal state。不是模型完全不能跑，而是輸出流程跑到這裡會炸。</p>
<p dir="auto">所以這個 repo 做了兩件事：</p>
<ul>
<li>固定一個可以重現的 ROCm 容器環境</li>
<li>把貼圖投影改成 CPU KDTree fallback，避開目前不穩的 GPU BVH 路徑</li>
</ul>
<p dir="auto">這不是最快的做法，但至少可以把 textured GLB 生出來。</p>
<h2>目前可用的路徑</h2>
<p dir="auto">目前測過比較穩的設定是：</p>
<pre><code class="language-text">texture_size=4096
decimation_target=1000000
remesh=False
OVOXEL_PROJECTION_MODE=cpu_kdtree
OVOXEL_CPU_KDTREE_K=8
</code></pre>
<p dir="auto"><code>remesh=False</code> 是刻意的。原本 <code>remesh=True</code> 看起來比較漂亮，但它還是會碰到同一條 GPU BVH distance path。只要那段 native ROCm extension 還沒修好，高品質設定就不能只看參數名稱，還要看它底下實際呼叫了什麼。</p>
<h2>測試紀錄：robot 4096 版</h2>
<p dir="auto">這次測試用 4096 texture 設定，目標是先確認高解析貼圖能不能穩定完成，而不是追求最快速度。</p>
<p dir="auto">設定如下：</p>
<pre><code class="language-text">texture_size=4096
decimation_target=1000000
remesh=False
OVOXEL_PROJECTION_MODE=cpu_kdtree
OVOXEL_CPU_KDTREE_K=8
</code></pre>
<p dir="auto">輸出結果：</p>
<pre><code class="language-text">GLB size: 約 41MB
final mesh: 823,375 vertices / 954,302 faces
valid texture pixels: 8,331,054
CPU projection mean distance: 3.255e-05
CPU projection max distance: 0.003561
GLB check: materials=1, textures=2, images=2, baseColorTexture exists
</code></pre>
<p dir="auto">這次 robot 4096 版大約花了 6 分 50 秒。</p>
<p dir="auto">時間拆開看：</p>
<table class="table table-bordered table-striped">
<thead>
<tr>
<th>階段</th>
<th style="text-align:right">時間</th>
<th>備註</th>
</tr>
</thead>
<tbody>
<tr>
<td>啟動 / 載入 pipeline</td>
<td style="text-align:right">約 1 分鐘多</td>
<td>第一次啟動會花時間載入模型與 pipeline</td>
</tr>
<tr>
<td>模型生成 / sampling / decode</td>
<td style="text-align:right">約 2 分 50 秒</td>
<td>從開始跑圖到 <code>to_glb</code> 開始前</td>
</tr>
<tr>
<td>GLB 匯出總時間</td>
<td style="text-align:right">約 2 分 49 秒</td>
<td>22:23:22 開始 <code>to_glb</code>，22:26:11 完成</td>
</tr>
<tr>
<td>4096 texture baking + CPU projection</td>
<td style="text-align:right">約 2 分 35 秒</td>
<td>4096 貼圖解析度下最重的一段</td>
</tr>
<tr>
<td>CPU KDTree projection 本身</td>
<td style="text-align:right">約 2 分 23 秒</td>
<td>22:23:36 開始，22:25:59 完成</td>
</tr>
</tbody>
</table>
<p dir="auto">最耗時的是這段：</p>
<pre><code class="language-text">CPU KDTree projection: querying 8,331,054 points
</code></pre>
<p dir="auto">它要處理 833 萬個 texture points。換句話說，4096 貼圖解析度主要就是卡在這裡。CPU KDTree fallback 可以避開 ROCm GPU BVH 的問題，但代價就是 texture baking 會變成 CPU 工作。</p>
<h2>使用方式</h2>
<p dir="auto">先 build 容器：</p>
<pre><code class="language-bash">podman build -t localhost/r9700-trellis2-rocm-toolbox:latest .
</code></pre>
<p dir="auto">模型不要放進 repo，也不要打進 image。建議把模型目錄掛到 <code>/models</code>：</p>
<pre><code class="language-bash">MODEL_ROOT=$HOME/ai-models \
WORK_ROOT=$PWD/work \
scripts/run-container.sh
</code></pre>
<p dir="auto">進容器後跑輸出：</p>
<pre><code class="language-bash">cd /workspace/TRELLIS.2_rocm
source /workspace/.venv/bin/activate

export OVOXEL_PROJECTION_MODE=cpu_kdtree
export OVOXEL_CPU_KDTREE_K=8
export HF_HOME=/models/huggingface
export HUGGINGFACE_HUB_CACHE=/models/huggingface/hub
export XDG_CACHE_HOME=/models/cache

python /opt/r9700-trellis2/scripts/run-textured-export.py \
  --input /workspace/TRELLIS.2_rocm/assets/example_image/T.png \
  --output /workspace/work/sample-4096.glb \
  --texture-size 4096 \
  --decimation-target 1000000
</code></pre>
<h2>這包適合誰</h2>
<p dir="auto">如果你只是想要最省事地跑 3D 生成，NVIDIA 環境目前還是比較少坑。</p>
<p dir="auto">但如果你手上已經有 R9700，或是想測 AMD AI 生態，這包可以省掉一些重複踩坑的時間。</p>
<h2>後續想補的東西</h2>
<ul>
<li>把 Web UI 的流程也整理成可重現版本</li>
<li>補一份 build 時間與生成時間紀錄</li>
<li>測不同 <code>texture_size</code> 對品質與時間的影響</li>
<li>等 ROCm / native extension 更新後，再回頭測 <code>remesh=True</code></li>
</ul>
<p dir="auto"><a href="https://github.com/CS6/r9700-trellis2-rocm-toolbox" rel="nofollow ugc">https://github.com/CS6/r9700-trellis2-rocm-toolbox</a></p>
<p dir="auto"><img src="https://upload.lcz.me/uploads/b90bf6de-a443-4f7a-aeb5-0667f9cd5317.jpeg" alt="3e68a05a-dda8-4606-8660-52ad145c2782-image.jpeg" class=" img-fluid img-markdown" /></p>
]]></description><link>https://lcz.me/topic/443/3d模型生成-trellis2-r9700-rocm</link><generator>RSS for Node</generator><lastBuildDate>Sat, 06 Jun 2026 02:10:59 GMT</lastBuildDate><atom:link href="https://lcz.me/topic/443.rss" rel="self" type="application/rss+xml"/><pubDate>Fri, 05 Jun 2026 22:48:05 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to 3D模型生成 trellis2 - r9700 rocm on Fri, 05 Jun 2026 23:29:52 GMT]]></title><description><![CDATA[<p dir="auto">會用4500 Pro試試看, 但是不太敢寫包單能成功, 2D-to-3D我沒接觸過</p>
]]></description><link>https://lcz.me/post/5276</link><guid isPermaLink="true">https://lcz.me/post/5276</guid><dc:creator><![CDATA[566656661]]></dc:creator><pubDate>Fri, 05 Jun 2026 23:29:52 GMT</pubDate></item></channel></rss>