Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
yosun opened this issue Jun 28, 2024 · 21 comments
Closed

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

yosun opened this issue Jun 28, 2024 · 21 comments

Comments

@yosun
Copy link

yosun commented Jun 28, 2024

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

@MrForExample
Copy link
Owner

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

@yosun
Copy link
Author

yosun commented Jul 2, 2024

even adjusting background the mesh still does not show ?

@MrForExample
Copy link
Owner

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 👍

@yosun
Copy link
Author

yosun commented Jul 4, 2024

do u have upgrade instructions

@t-manabe-s
Copy link

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:

@MrForExample
Copy link
Owner

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

@t-manabe-s
Copy link

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?

@genericgod
Copy link

genericgod commented Aug 2, 2024

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 https://192.168.x.xxx:8188/scripts/app.js:1454

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

@DreamLoveBetty
Copy link

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

@Blahblahdenver
Copy link

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

@t-manabe-s
Copy link

t-manabe-s commented Aug 5, 2024

@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 https://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.

@genericgod
Copy link

@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>
[...]

@Blahblahdenver
Copy link

Blahblahdenver commented Aug 5, 2024

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
Copy link

Blahblahdenver commented Aug 7, 2024

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

@rodsott
Copy link

rodsott commented Aug 18, 2024

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

@CZ-Wu
Copy link

CZ-Wu commented Aug 22, 2024

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

@rodsott
Copy link

rodsott commented Aug 24, 2024

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!!

@SmallStom
Copy link

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

@jakechai
Copy link
Contributor

Fixed here:
#291

@tcarneyjohnson
Copy link

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.

@MrForExample
Copy link
Owner

MrForExample commented Sep 16, 2024

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests