I-DevNet / app.js
Chao-Yun's picture
Deploy I-DevNet side-by-side 3D studio & demo videos linked to HF Model Hub
08149ec verified
Raw History Blame Contribute Delete
17.1 kB
(() => {
const toastEl = document.getElementById("copy-toast");
function showToast(msg) {
if (!toastEl) return;
toastEl.textContent = msg;
setTimeout(() => {
if (toastEl.textContent === msg) toastEl.textContent = "";
}, 2200);
}
async function copyText(text) {
try {
await navigator.clipboard.writeText(text);
} catch {
const ta = document.createElement("textarea");
ta.value = text;
document.body.appendChild(ta);
ta.select();
document.execCommand("copy");
document.body.removeChild(ta);
}
showToast("Copied to clipboard");
}
document.querySelectorAll("[data-copy-target]").forEach((btn) => {
btn.addEventListener("click", () => {
const target = document.getElementById(btn.dataset.copyTarget);
if (target) copyText(target.textContent.trim());
});
});
// 1. Video switcher
const VIDEO_DATA = {
full: {
src: "assets/videos/full_paper_demo.mp4",
poster: "assets/videos/full_paper_demo_poster.jpg",
title: "Full CAD 2025 Supplemental Video Walkthrough",
desc: "Complete narrated paper video showcasing patch developability formulation, live interactive Blender drag design, human-in-the-loop seam cutting, quantitative comparisons, and real cardstock fabrication.",
},
drag: {
src: "assets/videos/drag_patch.mp4",
poster: "assets/videos/drag_patch_poster.jpg",
title: "Real-Time Optimization under Drag-and-Drop Deformation (Figs. 2 & 7)",
desc: "As the user drags control points or lattice handles on the irregular triangular patch, cached bidirectional UV sampling maps the surface to a 64x64 masked geometry image and back after coarse-to-fine ResUNet inference.",
},
cut: {
src: "assets/videos/interactive_cut.mp4",
poster: "assets/videos/interactive_cut_poster.jpg",
title: "Interactive Piecewise Developable Approximation via Seam Cutting (Fig. 14)",
desc: "Users mark or sketch seam strokes interactively on complex 3D surfaces; only affected patches are incrementally re-parameterized, optimized in parallel, fused across seams, and post-processed.",
},
compare: {
src: "assets/videos/model_comparison.mp4",
poster: "assets/videos/model_comparison_poster.jpg",
title: "360-Degree Turntable Comparison: Bunny, Dog, and Kitten (Fig. 17)",
desc: "Full visual comparison against Ion et al. (2020), Zhao et al. (2022), and Zhao et al. (2023), showing tighter shape preservation with significantly fewer developable patches.",
},
craft: {
src: "assets/videos/papercraft_making.mp4",
poster: "assets/videos/papercraft_making_poster.jpg",
title: "Physical Papercraft Printing, Cutting & Assembly (Fig. 18)",
desc: "Optimized patches unfold isometrically into planar A4 cutting sheets with matched seam IDs, producing lifelike physical cardstock models.",
},
};
const videoEl = document.getElementById("demo-video");
const videoSrc = document.getElementById("demo-video-src");
const videoTitle = document.getElementById("video-title");
const videoDesc = document.getElementById("video-desc");
document.querySelectorAll("[data-video]").forEach((btn) => {
btn.addEventListener("click", () => {
document.querySelectorAll("[data-video]").forEach((b) => b.classList.remove("active"));
btn.classList.add("active");
const info = VIDEO_DATA[btn.dataset.video];
if (!info || !videoEl) return;
videoEl.pause();
videoEl.poster = info.poster;
videoSrc.src = info.src;
videoEl.load();
videoTitle.textContent = info.title;
videoDesc.textContent = info.desc;
});
});
// 2. Method switcher
const METHOD_DATA = {
pipeline: {
img: "assets/figures/patch_process.jpg",
title: "Two-Stage Coarse-to-Fine Patch Pipeline (Section 3)",
desc: "Any surface patch with arbitrary boundary shape (or interior holes) is parameterized with angle-preserving LSCM UV coordinates and resampled into a (64, 64, 4) normalized masked geometry image. Coarse and fine ResUNet stages eliminate Gaussian curvature before barycentric inverse sampling reconstructs the triangular mesh.",
},
sampling: {
img: "assets/figures/sample_inverse.jpg",
title: "Forward UV Sampling & Inverse Barycentric Reconstruction (Fig. 3)",
desc: "Points inside triangular mesh faces map onto regular 64x64 pixels via barycentric interpolation, dilated along the boundary to prevent clipping, then inverted back onto arbitrary triangle vertices at sub-millisecond cost.",
},
stencils: {
img: "assets/figures/region_conv.jpg",
title: "Masked Region, Fairness & Gaussian Curvature Stencils (Eqs. 4-6)",
desc: "A zero-padded exterior border combined with 5-point cross fairness erosion (W_fair) and 7-point hexagonal Gaussian curvature erosion (W_gc) constrains masked CNN gradients purely inside valid patch pixels.",
},
postproc: {
img: "assets/figures/post_process_vert.jpg",
title: "Two-Stage Numerical Post-Processing (Section 3.5)",
desc: "Stage 1 optimizes slit boundary vertices and their 1-ring neighbors with analytical L-BFGS-B gradients; Stage 2 alternates global/local interior refinement (Algorithm 1) until 97%-100% of interior vertices satisfy |K| <= 5e-4 rad.",
},
motivation: {
img: "assets/figures/tang_strip_patch.jpg",
title: "Motivation: Spline-Based vs. Patch-Based Optimization (Fig. 1)",
desc: "Compared against spline-strip methods, directly learning developability over arbitrary surface patches enables local surface control with substantially tighter fidelity to reference geometry.",
},
};
const methodImg = document.getElementById("method-img");
const methodTitle = document.getElementById("method-title");
const methodDesc = document.getElementById("method-desc");
document.querySelectorAll("[data-method]").forEach((btn) => {
btn.addEventListener("click", () => {
document.querySelectorAll("[data-method]").forEach((b) => b.classList.remove("active"));
btn.classList.add("active");
const info = METHOD_DATA[btn.dataset.method];
if (!info) return;
methodImg.src = info.img;
methodTitle.textContent = info.title;
methodDesc.textContent = info.desc;
});
});
// 3. Before/After model slider
const SLIDER_MODELS = {
bunny: {
before: "assets/renders/bunny_zhao2023.png",
after: "assets/renders/bunny_ours_final.png",
stat: "Ours: 6 patches, d_H-a = 0.382% | Zhao2023: 11 patches (paper), 0.729%",
},
dog: {
before: "assets/renders/dog_zhao2023.png",
after: "assets/renders/dog_ours_final.png",
stat: "Ours: 10 patches, d_H-a = 0.485% | Zhao2023: 11 patches (paper), 0.843%",
},
kitten: {
before: "assets/renders/kitten_zhao2023.png",
after: "assets/renders/kitten_ours_final.png",
stat: "Ours: 11 patches, d_H-a = 0.323% | Baseline: Zhao et al. (2023) visual render",
},
};
const baWrapper = document.getElementById("ba-wrapper");
const baClip = document.getElementById("ba-before-clip");
const baDivider = document.getElementById("ba-divider");
const baRange = document.getElementById("ba-range");
const baBefore = document.getElementById("ba-before");
const baAfter = document.getElementById("ba-after");
const sliderStat = document.getElementById("slider-stat");
function setSliderPct(pct) {
const p = Math.max(0, Math.min(100, pct));
baClip.style.clipPath = `inset(0 ${100 - p}% 0 0)`;
baDivider.style.left = `${p}%`;
baRange.value = String(Math.round(p));
}
if (baRange && baWrapper) {
baRange.addEventListener("input", (e) => setSliderPct(Number(e.target.value)));
let dragging = false;
const updateFromClientX = (clientX) => {
const rect = baWrapper.getBoundingClientRect();
setSliderPct(((clientX - rect.left) / rect.width) * 100);
};
baWrapper.addEventListener("pointerdown", (e) => {
dragging = true;
updateFromClientX(e.clientX);
});
window.addEventListener("pointermove", (e) => {
if (dragging) updateFromClientX(e.clientX);
});
window.addEventListener("pointerup", () => {
dragging = false;
});
}
document.querySelectorAll("[data-slider-model]").forEach((btn) => {
btn.addEventListener("click", () => {
document.querySelectorAll("[data-slider-model]").forEach((b) => b.classList.remove("active"));
btn.classList.add("active");
const info = SLIDER_MODELS[btn.dataset.sliderModel];
if (!info) return;
baBefore.src = info.before;
baAfter.src = info.after;
sliderStat.textContent = info.stat;
});
});
// 4. Multi-model figure gallery
const MFIG_DATA = {
compare_other: {
img: "assets/figures/compare_other.jpg",
cap: "Visual comparison against Ion et al. (2020), Zhao et al. (2022), and Zhao et al. (2023) on Bunny, Dog, and Kitten (Fig. 17).",
},
dog_process: {
img: "assets/figures/dog_process.jpg",
cap: "Fig. 15: Step-by-step optimization on Dog (Input -> Coarse+Fine Fusion -> Slit Boundary -> Interior Refinement -> Patch Merging).",
},
plot_opt: {
img: "assets/figures/plot_opt_process.png",
cap: "Fig. 16: Mean |K| reduction vs. bilateral Hausdorff distance evolution across pipeline stages on Bunny, Dog, and Kitten.",
},
metric_hausdorff: {
img: "assets/figures/metric_hausdorff.jpg",
cap: "Fig. 5: Comparison of bilateral Hausdorff metrics d_H, d_{H-99}, and d_{H-a} on Smooth vs. Zhao et al. (2023) Bunny.",
},
bunny_process: {
img: "assets/figures/bunny_process.jpg",
cap: "Appendix Fig. 20: Full optimization stages, Gaussian curvature maps, and Hausdorff error maps on Bunny.",
},
kitten_process: {
img: "assets/figures/kitten_process.jpg",
cap: "Appendix Fig. 21: Full optimization stages, Gaussian curvature maps, and Hausdorff error maps on Kitten.",
},
haus_app: {
triple: true,
cap: "Appendix Figs. 22-24: Per-vertex bilateral Hausdorff error heatmaps across baselines vs. Ours on Bunny, Dog, and Kitten.",
},
};
const mfigImg = document.getElementById("mfig-img");
const mfigTriple = document.getElementById("mfig-triple");
const mfigCap = document.getElementById("mfig-cap");
document.querySelectorAll("[data-mfig]").forEach((btn) => {
btn.addEventListener("click", () => {
document.querySelectorAll("[data-mfig]").forEach((b) => b.classList.remove("active"));
btn.classList.add("active");
const info = MFIG_DATA[btn.dataset.mfig];
if (!info) return;
if (info.triple) {
mfigImg.classList.add("hidden");
mfigTriple.classList.remove("hidden");
} else {
mfigTriple.classList.add("hidden");
mfigImg.classList.remove("hidden");
mfigImg.src = info.img;
}
mfigCap.textContent = info.cap;
});
});
// 5. Patch robustness gallery
const PFIG_DATA = {
drag: {
img: "assets/figures/drag_patch.jpg",
cap: "Fig. 7: Real-time drag-and-drop sequence preserving developability across four continuous control-point deformations.",
},
smooth: {
img: "assets/figures/smooth_patch.jpg",
cap: "Fig. 8: Smooth free-form patches before and after neural developability optimization (curvature reduction 66.6%-92.8%).",
},
model: {
img: "assets/figures/patch_model.jpg",
cap: "Fig. 9: Complex patches segmented from Bunny, Rabbit, and Einstein models (-99.68% curvature reduction on Einstein).",
},
resolution: {
img: "assets/figures/patch_resolutions.jpg",
cap: "Fig. 10: Resolution independence across meshes with 500 to 4,096 vertices using fixed 64x64 grid inference.",
},
hole: {
img: "assets/figures/patch_hole.jpg",
cap: "Fig. 11: Patches containing arbitrary interior holes, arrays, and non-trivial cutouts natively handled by UV masking.",
},
nonuniform: {
img: "assets/figures/patch_nonuniform.jpg",
cap: "Fig. 12: Robust optimization across uniform and severely non-uniform triangulations (cyclide benchmark).",
},
noise: {
img: "assets/figures/patch_noise.jpg",
cap: "Fig. 13: Stability under N(0.5%), N(1.0%), and N(2.0%) Gaussian vertex noise (up to 99.21% curvature reduction).",
},
gridres: {
img: "assets/figures/sample_resolution.jpg",
cap: "Appendix Fig. 19: Bidirectional UV grid reconstruction precision at 32x32 (0.036%), 64x64 (0.017%), and 128x128 (0.008%).",
},
};
const pfigImg = document.getElementById("pfig-img");
const pfigCap = document.getElementById("pfig-cap");
document.querySelectorAll("[data-pfig]").forEach((btn) => {
btn.addEventListener("click", () => {
document.querySelectorAll("[data-pfig]").forEach((b) => b.classList.remove("active"));
btn.classList.add("active");
const info = PFIG_DATA[btn.dataset.pfig];
if (!info) return;
pfigImg.src = info.img;
pfigCap.textContent = info.cap;
});
});
// 6. CLI snippets switcher
const CODE_DATA = {
setup: `git clone https://github.com/chaoyunwang/I-DevNet.git
cd I-DevNet
conda create -n idevnet python=3.10 -y && conda activate idevnet
pip install -e ".[full]"
python -m unittest discover -s tests -v`,
infer: `# Single patch (.obj or .npy) + Stage 2 interior post-processing
python scripts/optimize_patch.py \\
--input examples/patches/patch_811v.obj \\
--output outputs/patch_811v_opt.obj \\
--iters 2 --postprocess
# Segmented multi-patch mesh + seam JSON + A4 papercraft PDF
python scripts/optimize_mesh.py \\
--input examples/models/bunny/seg_input.obj \\
--seams examples/models/bunny/seg_seams.json \\
--output outputs/bunny_opt.obj --iters 2 --slit-postprocess --interior-postprocess
python scripts/export_papercraft_pdf.py --input examples/models/bunny/ours_final.obj --output outputs/bunny.pdf`,
eval: `# Table 1 quantitative reproduction (Bunny, Dog, Kitten)
python scripts/reproduce_table1.py --output-json outputs/table1.json
# End-to-end segmented pipeline (Bunny, Dog, Kitten from scratch)
python scripts/verify_full_pipeline.py --models bunny,dog,kitten
# All 25 Section 4.2 paper patches + UV sampling error
python scripts/verify_paper_patches.py
python scripts/eval_sampling_error.py`,
train: `# Download stratified real dataset into datasets/real_sample_subset (see docs/CLOUD_DRIVE_ASSETS.md)
python scripts/run_training_curriculum.py \\
--data-dir datasets/real_sample_subset \\
--output-dir runs/full_curriculum
# Or 1-epoch smoke curriculum on included examples/grid_samples/
python scripts/run_training_curriculum.py \\
--data-dir examples/grid_samples --output-dir runs/smoke \\
--stages stage1,stage5,opt2,stage6,export --epochs-override 1 --batch-size 2`,
blender: `# 1. Zip blender_addons/patch_dev_addon/ (or install directly from repo)
# 2. In Blender 3.6 / 4.x / 5.x: Edit -> Preferences -> Add-ons -> Install
# 3. Install Blender Python dependencies if needed:
"<BLENDER_PYTHON>" -m pip install numpy scipy onnxruntime pillow joblib
# 4. Run full headless operator verification inside Blender:
blender --background --python scripts/verify_blender_addon.py -- --output-json outputs/blender_verify.json`,
studio: `# Launch the Blender-Free Interactive 3D Web Studio (requires only Python + browser)
python scripts/web_studio.py --port 8080
# Includes live ONNX patch sculpting, Stage 2 SciPy interior refine,
# segmented 3D model inspector, and A4 unfolded papercraft PDF export.`,
};
const codeEl = document.getElementById("code-snippet");
const copyCodeBtn = document.getElementById("copy-code-btn");
document.querySelectorAll("[data-code]").forEach((btn) => {
btn.addEventListener("click", () => {
document.querySelectorAll("[data-code]").forEach((b) => b.classList.remove("active"));
btn.classList.add("active");
if (codeEl) codeEl.textContent = CODE_DATA[btn.dataset.code] || "";
});
});
if (copyCodeBtn && codeEl) {
copyCodeBtn.addEventListener("click", () => copyText(codeEl.textContent));
}
// 7. Lightbox modal for all figures
const lightbox = document.getElementById("lightbox");
const lightboxImg = document.getElementById("lightbox-img");
const lightboxClose = document.getElementById("lightbox-close");
document.querySelectorAll(".zoomable").forEach((img) => {
img.addEventListener("click", () => {
lightboxImg.src = img.src;
lightboxImg.alt = img.alt;
lightbox.classList.remove("hidden");
});
});
const closeBox = () => lightbox && lightbox.classList.add("hidden");
if (lightboxClose) lightboxClose.addEventListener("click", closeBox);
if (lightbox) {
lightbox.addEventListener("click", (e) => {
if (e.target === lightbox) closeBox();
});
window.addEventListener("keydown", (e) => {
if (e.key === "Escape") closeBox();
});
}
})();