Fixed MeshEditor when ComfyUI crashes
This commit is contained in:
parent
5223c70e0e
commit
085de32bcd
4 changed files with 192 additions and 0 deletions
82
comfyui_workflows/Gen Mesh with Meshflow.json
Normal file
82
comfyui_workflows/Gen Mesh with Meshflow.json
Normal file
|
|
@ -0,0 +1,82 @@
|
|||
{
|
||||
"1": {
|
||||
"inputs": {
|
||||
"mesh_path": "",
|
||||
"normalize": true,
|
||||
"preprocess": true
|
||||
},
|
||||
"class_type": "MeshflowLoadMesh",
|
||||
"_meta": {
|
||||
"title": "Meshflow - LoadMesh"
|
||||
}
|
||||
},
|
||||
"2": {
|
||||
"inputs": {
|
||||
"steps": 28,
|
||||
"seed": 12345,
|
||||
"guidance_scale": 2.5,
|
||||
"pipeline": [
|
||||
"5",
|
||||
0
|
||||
],
|
||||
"mesh": [
|
||||
"1",
|
||||
0
|
||||
],
|
||||
"image": [
|
||||
"3",
|
||||
0
|
||||
]
|
||||
},
|
||||
"class_type": "MeshflowMeshProcessor",
|
||||
"_meta": {
|
||||
"title": "Meshflow - MeshProcessor"
|
||||
}
|
||||
},
|
||||
"3": {
|
||||
"inputs": {
|
||||
"image": ""
|
||||
},
|
||||
"class_type": "LoadImage",
|
||||
"_meta": {
|
||||
"title": "Load Image"
|
||||
}
|
||||
},
|
||||
"4": {
|
||||
"inputs": {
|
||||
"filename_prefix": "Meshflow",
|
||||
"file_format": "glb",
|
||||
"trimesh": [
|
||||
"2",
|
||||
0
|
||||
]
|
||||
},
|
||||
"class_type": "MeshflowExportMesh",
|
||||
"_meta": {
|
||||
"title": "Meshflow - ExportMesh"
|
||||
}
|
||||
},
|
||||
"5": {
|
||||
"inputs": {
|
||||
"num_vertices": 4096,
|
||||
"dinov3_model": "dinov3_vitl16_pretrain_lvd1689m-8aa4cbdd.pth"
|
||||
},
|
||||
"class_type": "MeshflowLoadModel",
|
||||
"_meta": {
|
||||
"title": "Meshflow - LoadModel"
|
||||
}
|
||||
},
|
||||
"6": {
|
||||
"inputs": {
|
||||
"model_file": [
|
||||
"4",
|
||||
0
|
||||
],
|
||||
"image": ""
|
||||
},
|
||||
"class_type": "Preview3D",
|
||||
"_meta": {
|
||||
"title": "Preview 3D & Animation"
|
||||
}
|
||||
}
|
||||
}
|
||||
60
comfyui_workflows/Remove Background and Center.json
Normal file
60
comfyui_workflows/Remove Background and Center.json
Normal file
|
|
@ -0,0 +1,60 @@
|
|||
{
|
||||
"59": {
|
||||
"inputs": {
|
||||
"filename_prefix": "3DGenStudioNoBG",
|
||||
"images": [
|
||||
"72",
|
||||
0
|
||||
]
|
||||
},
|
||||
"class_type": "SaveImage",
|
||||
"_meta": {
|
||||
"title": "Save Image"
|
||||
}
|
||||
},
|
||||
"60": {
|
||||
"inputs": {
|
||||
"model": "RMBG-2.0",
|
||||
"sensitivity": 1,
|
||||
"process_res": 1024,
|
||||
"mask_blur": 0,
|
||||
"mask_offset": 0,
|
||||
"invert_output": false,
|
||||
"refine_foreground": false,
|
||||
"background": "Alpha",
|
||||
"background_color": "#000000",
|
||||
"image": [
|
||||
"71",
|
||||
0
|
||||
]
|
||||
},
|
||||
"class_type": "RMBG",
|
||||
"_meta": {
|
||||
"title": "Remove Background (RMBG)"
|
||||
}
|
||||
},
|
||||
"71": {
|
||||
"inputs": {
|
||||
"image": "Qwen_00004_.png"
|
||||
},
|
||||
"class_type": "Trellis2LoadImageWithTransparency",
|
||||
"_meta": {
|
||||
"title": "Trellis2 - Load Image with Transparency"
|
||||
}
|
||||
},
|
||||
"72": {
|
||||
"inputs": {
|
||||
"padding": 0,
|
||||
"remove_background": true,
|
||||
"max_size": 1024,
|
||||
"image": [
|
||||
"60",
|
||||
0
|
||||
]
|
||||
},
|
||||
"class_type": "Trellis2PreProcessImage",
|
||||
"_meta": {
|
||||
"title": "Trellis2 - PreProcess Image"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -90,7 +90,25 @@ let sharedQuadScene = null
|
|||
let sharedQuadCamera = null
|
||||
let sharedQuadMesh = null
|
||||
|
||||
// A persistent offscreen WebGLRenderer can silently lose its GPU context
|
||||
// (driver reset, tab backgrounding, or the browser evicting the oldest WebGL
|
||||
// context once too many exist — e.g. after a ComfyUI crash followed by retries).
|
||||
// Three.js does NOT auto-recreate it, so a dead renderer bakes NOTHING onto the
|
||||
// texture until a full page reload. Treat a lost context as "needs rebuild".
|
||||
function isBakeContextLost(renderer) {
|
||||
if (!renderer) return false
|
||||
try {
|
||||
return renderer.getContext().isContextLost()
|
||||
} catch {
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
function getBakeRenderer() {
|
||||
if (isBakeContextLost(sharedRenderer)) {
|
||||
sharedRenderer.dispose?.()
|
||||
sharedRenderer = null
|
||||
}
|
||||
if (!sharedRenderer) {
|
||||
sharedRenderer = new THREE.WebGLRenderer({
|
||||
antialias: false,
|
||||
|
|
|
|||
|
|
@ -31,7 +31,26 @@ let sharedDepthPrepassPixels = null
|
|||
let sharedProjectionRenderer = null
|
||||
let sharedMaskProjectionRenderer = null
|
||||
|
||||
// A persistent offscreen WebGLRenderer can silently lose its GPU context
|
||||
// (driver reset, tab backgrounding, or the browser evicting the oldest WebGL
|
||||
// context once too many exist — e.g. after a ComfyUI crash followed by retries).
|
||||
// Three.js does NOT auto-recreate it, so a dead renderer keeps producing BLANK
|
||||
// frames: the projection capture turns black and the GPU bake writes nothing,
|
||||
// until a full page reload. Treat a lost context as "needs rebuild".
|
||||
function isRendererContextLost(renderer) {
|
||||
if (!renderer) return false
|
||||
try {
|
||||
return renderer.getContext().isContextLost()
|
||||
} catch {
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
function getSharedProjectionRenderer() {
|
||||
if (isRendererContextLost(sharedProjectionRenderer)) {
|
||||
sharedProjectionRenderer.dispose?.()
|
||||
sharedProjectionRenderer = null
|
||||
}
|
||||
if (!sharedProjectionRenderer) {
|
||||
sharedProjectionRenderer = new THREE.WebGLRenderer({
|
||||
antialias: true,
|
||||
|
|
@ -45,6 +64,10 @@ function getSharedProjectionRenderer() {
|
|||
}
|
||||
|
||||
function getSharedMaskProjectionRenderer() {
|
||||
if (isRendererContextLost(sharedMaskProjectionRenderer)) {
|
||||
sharedMaskProjectionRenderer.dispose?.()
|
||||
sharedMaskProjectionRenderer = null
|
||||
}
|
||||
if (!sharedMaskProjectionRenderer) {
|
||||
sharedMaskProjectionRenderer = new THREE.WebGLRenderer({
|
||||
antialias: false,
|
||||
|
|
@ -61,6 +84,15 @@ function getDepthPrepassResources(width, height) {
|
|||
const safeWidth = Math.max(1, Math.round(width || 1))
|
||||
const safeHeight = Math.max(1, Math.round(height || 1))
|
||||
|
||||
if (isRendererContextLost(sharedDepthPrepassRenderer)) {
|
||||
sharedDepthPrepassRenderer.dispose?.()
|
||||
sharedDepthPrepassRenderer = null
|
||||
// The render target's framebuffer belongs to the dead context — drop it so
|
||||
// it is rebuilt against the fresh renderer below.
|
||||
sharedDepthPrepassTarget?.dispose?.()
|
||||
sharedDepthPrepassTarget = null
|
||||
}
|
||||
|
||||
if (!sharedDepthPrepassRenderer) {
|
||||
sharedDepthPrepassRenderer = new THREE.WebGLRenderer({
|
||||
antialias: false,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue