A picture into a 3D model: Hunyuan3D 2
Lesson "3d-image", in the group 3D of the lesson list. Steps: 13.
What you will be able to do
You build a graph that turns one picture of an object into a 3D model you can open in other programs.
What you need
- It goes on from A first picture from text. The card says so; it is a hint, not a lock.
- Model files the lesson checks:
- for
ckpt_nameof Image Only Checkpoint Loader (img2vid model): a file whose name hashunyuan3d.
- for
- Nodes: Image Only Checkpoint Loader (img2vid model), ModelSamplingAuraFlow, Load Image, CLIP Vision Encode, Hunyuan3Dv2Conditioning, Empty Hunyuan 3D v2 Latent, KSampler, Hunyuan 3D VAE Decode, Voxel to Mesh, Save 3D Model.
- The app downloads and installs nothing. The step texts below say which files and folders, and which ComfyUI template names them.
The steps
The words of each step, as the lesson shows them. Node names are in bold.
What comes out (reading)
Hunyuan3D 2 looks at one picture of an object and builds its shape in 3D. The result is a mesh, a surface of many small triangles, without colours: a white model.
The best picture shows one object whole, on a plain background, from a little above and to the side.
The lesson builds the graph from an empty canvas: "File ▸ New project".
Load the model
Add a Image Only Checkpoint Loader (img2vid model) node. In
ckpt_namechoosehunyuan3d-dit-v2_fp16.safetensors(version 2.0) orhunyuan_3d_v2.1.safetensors(version 2.1) from models/checkpoints.This loader takes a model that reads pictures, not text: its outputs are the model, the picture reader
CLIP_VISIONand the decoder.If the file you need is not in the list, your ComfyUI does not have it. The app downloads nothing. The easiest way is to open, in ComfyUI itself, the template "HY 3D 2.0" or "HY 3D 2.1: Single View to Model": it shows which files are missing and where to put them. Then choose "Sync ▸ Sync now" in this app's menu, and the files appear in the lists.
Set the noise shift
Add a ModelSamplingAuraFlow node, connect the
MODELoutput of Image Only Checkpoint Loader (img2vid model) to itsmodelinput and setshiftto 1.Both templates use 1. This model was trained for that value.
Load the picture
Add a Load Image node and choose the picture in its
imagefield.A background with other objects becomes part of the model. Remove it first if you can.
Let the model see the picture
Add a CLIP Vision Encode node. Connect the
CLIP_VISIONoutput of Image Only Checkpoint Loader (img2vid model) to itsclip_visioninput and the picture from Load Image to itsimageinput. Setcroptocenter.This node turns the picture into a prompt the model can follow.
Turn it into a condition
Add a Hunyuan3Dv2Conditioning node and connect the output of CLIP Vision Encode to its
clip_vision_outputinput.It gives two outputs,
positiveandnegative, ready for the sampler. Nothing is written by hand here: the picture is the whole prompt.Add the blank
Add a Empty Hunyuan 3D v2 Latent node and set
resolutionto 3072.This is how finely the shape is worked out. Version 2.0 uses 3072, version 2.1 uses 4096.
Add the sampler
Add a KSampler node and connect four inputs:
modelfrom ModelSamplingAuraFlow;positiveandnegativefrom the outputs of the same name of Hunyuan3Dv2Conditioning;latent_imagefrom Empty Hunyuan 3D v2 Latent.
Set
stepsto 20 andcfgto 8, as the template of version 2.0 does. For version 2.1 the template uses 30 and 5.Turn the result into a volume
Add a Hunyuan 3D VAE Decode node. Connect the output of KSampler to its
samplesinput and theVAEoutput of Image Only Checkpoint Loader (img2vid model) to itsvaeinput.The result is a voxel grid: space cut into small cubes, each either inside the object or outside.
Turn the volume into a mesh
Add a Voxel to Mesh node and connect the output of Hunyuan 3D VAE Decode to its voxel input. Set algorithm to surface net and threshold to 0.6.
surface net gives a smoother surface than basic. The threshold says where the inside ends: lower makes the object fatter, higher thinner and with holes.
- Save the model
Add a Save 3D Model node and connect the output of Voxel to Mesh to its mesh input.
- Where the file goes and what opens it (reading)
In ComfyUI the node writes a .glb file into the output/3d folder and shows the model on the canvas.
A .glb file opens in Blender (File ▸ Import ▸ glTF), in most 3D viewers and game engines, and in a web browser through any glTF viewer. The model has no colours yet: they are painted in another program or by a texturing graph.
The ComfyUI-3D-Pack pack and the TRELLIS.2 nodes of ComfyUI itself also build models with colours, but their graphs are much larger.
- The graph is ready (reading)
Save the graph with "File ▸ Save workflow for ComfyUI…", open the file in ComfyUI and run it there. This app runs nothing in ComfyUI itself.
If the model has holes or lumps: a cleaner picture helps most, then a larger resolution.
What the lesson checks
A reading step is done when you press Got it, next. A doing step ticks itself off when the canvas holds:
- Step 2, Load the model:
- a Image Only Checkpoint Loader (img2vid model) node.
ckpt_nameof Image Only Checkpoint Loader (img2vid model) holds a file whose name hashunyuan3d(capitals, dots and dashes do not matter).
- Step 3, Set the noise shift:
- a ModelSamplingAuraFlow node.
MODELof Image Only Checkpoint Loader (img2vid model) intomodelof ModelSamplingAuraFlow.shiftof ModelSamplingAuraFlow is1.
- Step 4, Load the picture:
- a Load Image node.
imageof Load Image: a value is chosen.
- Step 5, Let the model see the picture:
- a CLIP Vision Encode node.
CLIP_VISIONof Image Only Checkpoint Loader (img2vid model) intoclip_visionof CLIP Vision Encode.IMAGEof Load Image intoimageof CLIP Vision Encode.cropof CLIP Vision Encode iscenter.
- Step 6, Turn it into a condition:
- a Hunyuan3Dv2Conditioning node.
CLIP_VISION_OUTPUTof CLIP Vision Encode intoclip_vision_outputof Hunyuan3Dv2Conditioning.
- Step 7, Add the blank:
- a Empty Hunyuan 3D v2 Latent node.
resolutionof Empty Hunyuan 3D v2 Latent is from 3072 to 4096; Do this for me sets 3072.
- Step 8, Add the sampler:
- a KSampler node.
MODELof ModelSamplingAuraFlow intomodelof KSampler.positiveof Hunyuan3Dv2Conditioning intopositiveof KSampler.negativeof Hunyuan3Dv2Conditioning intonegativeof KSampler.LATENTof Empty Hunyuan 3D v2 Latent intolatent_imageof KSampler.stepsof KSampler is from 20 to 30; Do this for me sets 20.cfgof KSampler is from 5 to 8; Do this for me sets 8.
- Step 9, Turn the result into a volume:
- a Hunyuan 3D VAE Decode node.
LATENTof KSampler intosamplesof Hunyuan 3D VAE Decode.VAEof Image Only Checkpoint Loader (img2vid model) intovaeof Hunyuan 3D VAE Decode.
- Step 10, Turn the volume into a mesh:
- a Voxel to Mesh node.
VOXELof Hunyuan 3D VAE Decode intovoxelof Voxel to Mesh.algorithmof Voxel to Mesh issurface net.thresholdof Voxel to Mesh is from 0.5 to 0.7; Do this for me sets 0.6.
- Step 11, Save the model:
- a Save 3D Model node.
MESHof Voxel to Mesh intomeshof Save 3D Model.