ComfyUI-3D-Pack icon indicating copy to clipboard operation
ComfyUI-3D-Pack copied to clipboard

preview 3dmesh always black / does not show mesh though mesh is saved

Open yosun opened this issue 1 year ago • 15 comments

preview 3dmesh always black / does not show mesh though mesh is saved

yosun avatar Jun 28 '24 04:06 yosun

I'm updating preview node now to make things more robust to use, but you can adjust background color of the background to make mesh more visible

MrForExample avatar Jul 02 '24 21:07 MrForExample

even adjusting background the mesh still does not show ?

yosun avatar Jul 02 '24 22:07 yosun

That's weird, can you please try the new version I released today, see if those changes anything, if it's still not work, then maybe you can share your workflow, or create a minimum problem replicate workflow so I can see what happened, cheers 👍

MrForExample avatar Jul 03 '24 22:07 MrForExample

do u have upgrade instructions

yosun avatar Jul 04 '24 10:07 yosun

I had the same problem. The cause was that the Preview 3DMesh node was designed to run locally, as described in ComfyUI-3D-Pack/webserver/server.py. I was running ComfyUI on a remote Linux PC, so I changed the relevant part of server.py and the problem was solved. Original code

    # Security check to see if query client is local
    if request.remote in web_conf['clients_ip'] and "filepath" in query:

Changed code

    # Security check to see if query client is local
    if True:

t-manabe-s avatar Jul 08 '24 03:07 t-manabe-s

Hi @yosun @t-manabe-s As mentioned in Readme file, you can add your server IP in system.conf

MrForExample avatar Jul 24 '24 18:07 MrForExample

Thanks for the reply @MrForExample As for system.conf, I noticed it by looking at init.py and knew it wasn't the right way to do it, but I chose this method because it was the easiest way to solve it.

I missed what was written in the read me file. By the way, I understand that system.conf adds the IPs of clients that are allowed to make requests. Since you say you can add your server IP in system.conf, does this add the server IP?

t-manabe-s avatar Jul 25 '24 03:07 t-manabe-s

Same problem here. Running ComfyUI on a different machine in the same network. I've added both client and server IP's to system.conf to no avail.

In firefox console I'm getting the following errors:

Error loading extension /extensions/ComfyUI-3D-Pack/js/threeVisualizer.js TypeError: Failed to resolve module specifier "three". Relative references must start with either "/", "./", or "../"
    extensionPromises http://192.168.x.xxx:8188/scripts/app.js:1454

Uncaught TypeError: downloadButton is null
    <anonymous> http://192.168.x.xxx:8188/extensions/ComfyUI-3D-Pack/js/threeVisualizer.js:62

genericgod avatar Aug 02 '24 17:08 genericgod

I'm also experiencing this problem with local use, previous versions were fine using Unique3D etc, and after updating Fast 3D this problem occurs.The workflow is shown in the figure: 1722627845636 https://github.com/MrForExample/ComfyUI-3D-Pack/issues/180#issuecomment-2212915090 Changing this still doesn't fix it

DreamLoveBetty avatar Aug 02 '24 19:08 DreamLoveBetty

mine just doesnt work period, ive gone through all instructions thoroughly many times and i still get this. Screenshot 2024-08-03 145150

this is the log. im also not sure why i cant get cuda arch set. ive ran through instructions there too. if youve got any tips let me know please. 2024-08-03 14:47:06.194 [Debug] [ComfyUI-0/STDOUT] [34m[Comfy3D] [0m[Load_InstantMesh_Reconstruction_Model] loaded model ckpt from C:\SwarmUI\SwarmUI\dlbackend\comfy\ComfyUI\custom_nodes\ComfyUI-3D-Pack\Checkpoints\InstantMesh\instant_nerf_base.ckpt[0m 2024-08-03 14:47:09.750 [Debug] [ComfyUI-0/STDOUT] Warn!: C:\SwarmUI\SwarmUI\dlbackend\comfy\python_embeded\Lib\site-packages\torch\utils\cpp_extension.py:1967: UserWarning: TORCH_CUDA_ARCH_LIST is not set, all archs for visible cards are included for compilation. 2024-08-03 14:47:09.750 [Debug] [ComfyUI-0/STDOUT] If this is not desired, please set os.environ['TORCH_CUDA_ARCH_LIST']. 2024-08-03 14:47:09.750 [Debug] [ComfyUI-0/STDOUT] warnings.warn( 2024-08-03 14:47:09.750 [Debug] [ComfyUI-0/STDOUT] 2024-08-03 14:48:27.596 [Debug] [ComfyUI-0/STDOUT] [34m[Comfy3D] [0m[Save_3D_Mesh] Saving model to C:\SwarmUI\SwarmUI\dlbackend\comfy\ComfyUI\output\InstantMesh_test\Mesh_Cat.glb[0m 2024-08-03 14:48:27.706 [Debug] [ComfyUI-0/STDOUT] Prompt executed in 165.25 seconds

Blahblahdenver avatar Aug 03 '24 21:08 Blahblahdenver

@genericgod

Error loading extension /extensions/ComfyUI-3D-Pack/js/threeVisualizer.js TypeError: Failed to resolve module specifier "three". Relative references must start with either "/", "./", or "../" extensionPromises http://192.168.x.xxx:8188/scripts/app.js:1454

This error means that the JavaScript module three cannot be found. The cause is that the function called Dynamic imports on lines 21 to 31 of ComfyUI-3D-Pack/web/html/threeVisualizer.html is not working properly. The cause is unknown.

I'm not familiar with JavaScript or HTML, so I don't know a smart solution, but you may be able to solve the problem by following the steps below.

  1. Go to ComfyUI-3D-Pack/web/js in the console.
  2. Run npm install three.
  3. Run cp node_modules/three/build/three.module.js ./.
  4. Modify lines 1-11 in the import section of ComfyUI-3D-Pack/web/js/threeVisualizer.js as follows. This modification changes the import path from three to /extensions/ComfyUI-3D-Pack/js/three.module.js and from three/addons/ to /extensions/ComfyUI-3D-Pack/js/node_modules/three/examples/jsm/. This path may be different in your environment, so I recommend checking it in the Firefox console.
import * as THREE from '/extensions/ComfyUI-3D-Pack/js/three.module.js';
import { api } from '/scripts/api.js';
import {getRGBValue} from '/extensions/ComfyUI-3D-Pack/js/sharedFunctions.js';

import { OrbitControls } from '/extensions/ComfyUI-3D-Pack/js/node_modules/three/examples/jsm/controls/OrbitControls.js';
import { RoomEnvironment } from '/extensions/ComfyUI-3D-Pack/js/node_modules/three/examples/jsm/environments/RoomEnvironment.js';

import { MTLLoader } from '/extensions/ComfyUI-3D-Pack/js/node_modules/three/examples/jsm/loaders/MTLLoader.js';
import { OBJLoader } from '/extensions/ComfyUI-3D-Pack/js/node_modules/three/examples/jsm/loaders/OBJLoader.js';
import { GLTFLoader } from '/extensions/ComfyUI-3D-Pack/js/node_modules/three/examples/jsm/loaders/GLTFLoader.js';
import { DRACOLoader } from '/extensions/ComfyUI-3D-Pack/js/node_modules/three/examples/jsm/loaders/DRACOLoader.js';
  1. Reload the browser and run the workflow. It is a good idea to check in the browser's debug mode that the changes to the source code have been applied.
  2. If this does not resolve the issue, you will also need to make the changes in the .js files under ComfyUI-3D-Pack/web/js/node_modules/three/examples/jsm as in step 4.

t-manabe-s avatar Aug 05 '24 02:08 t-manabe-s

@t-manabe-s While it did remove the original error now many modules in ComfyUI-3D-Pack/web/js/node_modules/three/examples/jsm get this error. So now i have to edit more than 100 scripts which is a LOT of work.

I think I found another Solution

The node now works correctly, even though the aforementioned error still persists.

It seemed like the importmap in ComfyUI-3D-Pack/web/html/threeVisualizer.html somehow was not executed correctly. So I moved it into the <head> of the html file like this:

<!DOCTYPE html>
<html lang="en">
	<head>
		<meta charset="utf-8">
		<meta name="viewport" content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
		<link type="text/css" rel="stylesheet" href="/extensions/ComfyUI-3D-Pack/style/threeStyle.css">
		<link type="text/css" rel="stylesheet" href="/extensions/ComfyUI-3D-Pack/style/libs/coloris.min.css">
		<link type="text/css" rel="stylesheet" href="/extensions/ComfyUI-3D-Pack/style/sharedStyle.css">

		<!-- moved here from "container" -->
		<script type="importmap">
			{
			  "imports": {
				"three": "https://cdn.jsdelivr.net/npm/three@latest/build/three.module.js",
				"three/addons/": "https://cdn.jsdelivr.net/npm/three@latest/examples/jsm/"
			  }
			}
		</script>
	</head>

	<body>
		<div id="progress-container">
			<dialog open id="progress-dialog">
				<p>
					<label for="progress-indicator">Loading scene...</label>
				</p>
				<progress max="100" id="progress-indicator"></progress>
			</dialog>
		</div>

		<div id="container">
			<script id="visualizer" type="module" filepath="" timestamp="" crossorigin src="/extensions/ComfyUI-3D-Pack/js/threeVisualizer.js"></script>
		</div>
[...]

genericgod avatar Aug 05 '24 14:08 genericgod

3. cp node_modules/three/build/three.module.js ./ Im not sure if this matters but im running SwarmUI with Comfy backend. i think we are missing some of the files you are referring to. could you show us some pics of your directory's and what files you have? i just looked and i dont have any mentioned in this. import * as THREE from '/extensions/ComfyUI-3D-Pack/js/three.module.js'; import { api } from '/scripts/api.js'; import {getRGBValue} from '/extensions/ComfyUI-3D-Pack/js/sharedFunctions.js';

import { OrbitControls } from '/extensions/ComfyUI-3D-Pack/js/node_modules/three/examples/jsm/controls/OrbitControls.js'; import { RoomEnvironment } from '/extensions/ComfyUI-3D-Pack/js/node_modules/three/examples/jsm/environments/RoomEnvironment.js';

import { MTLLoader } from '/extensions/ComfyUI-3D-Pack/js/node_modules/three/examples/jsm/loaders/MTLLoader.js'; import { OBJLoader } from '/extensions/ComfyUI-3D-Pack/js/node_modules/three/examples/jsm/loaders/OBJLoader.js'; import { GLTFLoader } from '/extensions/ComfyUI-3D-Pack/js/node_modules/three/examples/jsm/loaders/GLTFLoader.js'; import { DRACOLoader } from '/extensions/ComfyUI-3D-Pack/js/node_modules/three/examples/jsm/loaders/DRACOLoader.js';

Blahblahdenver avatar Aug 05 '24 23:08 Blahblahdenver

is there ever going to be a fix or solution for this? been a while. I've downloaded the pack, reinstalled comfyui countless times, reinstalled the pack countless times, read every single readme very thoroughly, tried every idea anyone has had. but i do know there are files missing no matter how I download or install it. although my window isn't black it just looks like this. Screenshot 2024-08-07 042538

Blahblahdenver avatar Aug 07 '24 11:08 Blahblahdenver

I`m having the same problem, can't make the visualizer to work. Now I just saw in the Chrome console this error message:

Error loading extension /extensions/ComfyUI-3D-Pack/js/gsVisualizer.js TypeError: Failed to resolve module specifier "gsplat". Relative references must start with either "/", "./", or "../".

app.ts:1756 Error loading extension /extensions/ComfyUI-3D-Pack/js/threeVisualizer.js TypeError: Failed to resolve module specifier "three". Relative references must start with either "/", "./", or "../".

@MrForExample If you could help us with this matter would be much appreciated! Its better to check the 3d model generation inside Comfy, without needing to open using external programs. Thank you once again for your hard work on this custom node! My best, RoD

rodsott avatar Aug 18 '24 02:08 rodsott

I'm also experiencing this problem with local use, previous versions were fine using Unique3D etc, and after updating Fast 3D this problem occurs.The workflow is shown in the figure: 1722627845636 #180 (comment) Changing this still doesn't fix it

I have the same problem. I find that ComfyUI/web/extensions does not contain ComfyUI-3D-Pack dir. I create dir ComfyUI/web/extensions/ComfyUI-3D-Pack and copy the files from ComfyUI/custom_nodes/ComfyUI-3D-Pack/web to ComfyUI/web/extensions/ComfyUI-3D-Pack, and then restart comfyui, ComfyUI/web/extensions/ComfyUI-3D-Pack is deleted automatically. I don't know if this matters. @MrForExample

CZ-Wu avatar Aug 22 '24 09:08 CZ-Wu

I have the same problem. I find that ComfyUI/web/extensions does not contain ComfyUI-3D-Pack dir. I create dir ComfyUI/web/extensions/ComfyUI-3D-Pack and copy the files from ComfyUI/custom_nodes/ComfyUI-3D-Pack/web to ComfyUI/web/extensions/ComfyUI-3D-Pack, and then restart comfyui, ComfyUI/web/extensions/ComfyUI-3D-Pack is deleted automatically. I don't know if this matters. @MrForExample

Yeap, I just did it, copied the files to this ComfyUI/web/extensions and it was deleted when restarting Comfy.. At the terminal, I see this line:

Comfy3D: Removed old extension folder

Please, @MrForExample , take a look when you can, so we be able to see the 3D viewer working again. Thanks in advance!!

rodsott avatar Aug 24 '24 21:08 rodsott

1725439373548 I can run the task normally, but the result is not displayed, I have already added the server ip in system.conf, but it still does not work. please help me,tks

SmallStom avatar Sep 04 '24 08:09 SmallStom

Fixed here: https://github.com/MrForExample/ComfyUI-3D-Pack/issues/291

jakechai avatar Sep 11 '24 01:09 jakechai

For anyone in a "TLDR" kind of mood @jakechai is correct that there is a workaround by falling back to the old frontend.

Copy and paste --front-end-version Comfy-Org/ComfyUI_legacy_frontend@latest into the first line of your run_nvidia_gpu.bat or run_cpu.bat file in the main ComfyUI folder.

tcarneyjohnson avatar Sep 11 '24 15:09 tcarneyjohnson

Hi all, sorry was busy working on other things 3D preview nodes now support new ComfyUI's Frontend, cheers 👍

MrForExample avatar Sep 16 '24 23:09 MrForExample