# aiuniai/unique3d architecture

> Architecture diagram of the GitHub repository aiuniai/unique3d, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-25). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/aiuniai/unique3d
- Repository: https://github.com/aiuniai/unique3d

## Overview

Unique3D turns a single input image into a textured 3D mesh. The main Gradio workflow optionally removes the background and upscales small images, predicts multiple views, reconstructs and refines geometry, then exports a mesh and optional preview video. A separate stepwise UI exposes multiview generation and mesh reconstruction, including optional supplied normals; the README also documents local and hosted demos and ComfyUI support. The graph follows explicit calls in sampled UI and prediction code; reconstruction internals and several documented integrations are represented only at their supported directory paths.

Main entry points: [`app/gradio_3dgen.py`](https://github.com/aiuniai/unique3d/blob/main/app/gradio_3dgen.py) (Full-run Gradio), [`app/gradio_3dgen_steps.py`](https://github.com/aiuniai/unique3d/blob/main/app/gradio_3dgen_steps.py) (Stepwise Gradio), [`app/custom_models/mvimg_prediction.py`](https://github.com/aiuniai/unique3d/blob/main/app/custom_models/mvimg_prediction.py) (Multiview prediction), [`scripts/multiview_inference.py`](https://github.com/aiuniai/unique3d/blob/main/scripts/multiview_inference.py) (Geometry reconstruction)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interfaces["User interfaces"]
  node_main_ui["Full-run Gradio<br/>[gradio_3dgen.py]"]
  node_steps_ui["Stepwise Gradio"]
end

subgraph group_generation["Image generation"]
  node_background["Background removal"]
  node_preprocess["Image preprocessing<br/>[utils.py]"]
  node_upscale["Image upscaling<br/>[refine_lr_to_sr.py]"]
  node_multiview_model["Multiview prediction"]
  node_normal_model["Normal prediction"]
end

subgraph group_reconstruction["Mesh reconstruction"]
  node_reconstruction_entry["Geometry reconstruction"]
  node_mesh_recon["Mesh reconstruction"]
  node_remesh["Adaptive remeshing<br/>[opt.py]"]
  node_export["Mesh and video export<br/>[utils.py]"]
end

subgraph group_diffusion["Diffusion internals"]
  node_diffusion_train["Diffusion training"]
  node_diffusion_pipe["Image diffusion pipelines"]
  node_attention["Attention processors"]
  node_unifield["Configurable UNet"]
end

node_user(("Image user"))
node_hosted["Hosted demos"]
node_comfy["ComfyUI integration"]
node_mesh_result["Generated mesh"]

node_user -->|"submits image"| node_main_ui
node_user -->|"submits image"| node_steps_ui
node_main_ui -->|"upscales small image"| node_upscale
node_main_ui -->|"predicts views"| node_multiview_model
node_multiview_model -->|"removes background"| node_background
node_multiview_model -->|"preprocesses image"| node_preprocess
node_multiview_model -->|"runs pipeline forward"| node_diffusion_train
node_diffusion_train -->|"constructs pipeline"| node_diffusion_pipe
node_diffusion_pipe -->|"uses UNet"| node_unifield
node_unifield -->|"installs processors"| node_attention
node_main_ui -->|"reconstructs geometry"| node_reconstruction_entry
node_reconstruction_entry -->|"builds mesh"| node_mesh_recon
node_mesh_recon -->|"optimizes topology"| node_remesh
node_main_ui -->|"exports mesh"| node_export
node_export -->|"writes result"| node_mesh_result
node_steps_ui -->|"generates views"| node_multiview_model
node_steps_ui -.->|"optional normal prediction"| node_normal_model
node_steps_ui -->|"reconstructs mesh"| node_reconstruction_entry
node_steps_ui -->|"exports mesh"| node_export
node_hosted -.->|"offers inference"| node_user
node_comfy -.->|"offers workflow"| node_user

click node_main_ui "https://github.com/aiuniai/unique3d/blob/main/app/gradio_3dgen.py"
click node_steps_ui "https://github.com/aiuniai/unique3d/blob/main/app/gradio_3dgen_steps.py"
click node_background "https://github.com/aiuniai/unique3d/blob/main/app/custom_models/mvimg_prediction.py"
click node_preprocess "https://github.com/aiuniai/unique3d/blob/main/scripts/utils.py"
click node_upscale "https://github.com/aiuniai/unique3d/blob/main/scripts/refine_lr_to_sr.py"
click node_multiview_model "https://github.com/aiuniai/unique3d/blob/main/app/custom_models/mvimg_prediction.py"
click node_normal_model "https://github.com/aiuniai/unique3d/blob/main/app/custom_models/normal_prediction.py"
click node_diffusion_train "https://github.com/aiuniai/unique3d/tree/main/custum_3d_diffusion/trainings"
click node_diffusion_pipe "https://github.com/aiuniai/unique3d/tree/main/custum_3d_diffusion/custum_pipeline"
click node_attention "https://github.com/aiuniai/unique3d/blob/main/custum_3d_diffusion/custum_modules/attention_processors.py"
click node_unifield "https://github.com/aiuniai/unique3d/blob/main/custum_3d_diffusion/custum_modules/unifield_processor.py"
click node_reconstruction_entry "https://github.com/aiuniai/unique3d/blob/main/scripts/multiview_inference.py"
click node_mesh_recon "https://github.com/aiuniai/unique3d/tree/main/mesh_reconstruction"
click node_remesh "https://github.com/aiuniai/unique3d/blob/main/mesh_reconstruction/opt.py"
click node_export "https://github.com/aiuniai/unique3d/blob/main/scripts/utils.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_main_ui,node_steps_ui,node_user,node_comfy toneBlue
class node_background,node_preprocess,node_upscale,node_multiview_model,node_normal_model toneAmber
class node_reconstruction_entry,node_mesh_recon,node_remesh,node_export toneMint
class node_diffusion_train,node_diffusion_pipe,node_attention,node_unifield toneRose
class node_hosted,node_mesh_result toneIndigo
```

## Components

### User interfaces

- [Full-run Gradio](https://github.com/aiuniai/unique3d/blob/main/app/gradio_3dgen.py): `app/gradio_3dgen.py`
- [Stepwise Gradio](https://github.com/aiuniai/unique3d/blob/main/app/gradio_3dgen_steps.py): `app/gradio_3dgen_steps.py`

### Image generation

- [Background removal](https://github.com/aiuniai/unique3d/blob/main/app/custom_models/mvimg_prediction.py): `app/custom_models/mvimg_prediction.py`
- [Image preprocessing](https://github.com/aiuniai/unique3d/blob/main/scripts/utils.py): `scripts/utils.py`
- [Image upscaling](https://github.com/aiuniai/unique3d/blob/main/scripts/refine_lr_to_sr.py): `scripts/refine_lr_to_sr.py`
- [Multiview prediction](https://github.com/aiuniai/unique3d/blob/main/app/custom_models/mvimg_prediction.py): `app/custom_models/mvimg_prediction.py`
- [Normal prediction](https://github.com/aiuniai/unique3d/blob/main/app/custom_models/normal_prediction.py): `app/custom_models/normal_prediction.py`

### Mesh reconstruction

- [Geometry reconstruction](https://github.com/aiuniai/unique3d/blob/main/scripts/multiview_inference.py): `scripts/multiview_inference.py`
- [Mesh reconstruction](https://github.com/aiuniai/unique3d/tree/main/mesh_reconstruction): `mesh_reconstruction`
- [Adaptive remeshing](https://github.com/aiuniai/unique3d/blob/main/mesh_reconstruction/opt.py): `mesh_reconstruction/opt.py`
- [Mesh and video export](https://github.com/aiuniai/unique3d/blob/main/scripts/utils.py): `scripts/utils.py`

### Diffusion internals

- [Diffusion training](https://github.com/aiuniai/unique3d/tree/main/custum_3d_diffusion/trainings): `custum_3d_diffusion/trainings`
- [Image diffusion pipelines](https://github.com/aiuniai/unique3d/tree/main/custum_3d_diffusion/custum_pipeline): `custum_3d_diffusion/custum_pipeline`
- [Attention processors](https://github.com/aiuniai/unique3d/blob/main/custum_3d_diffusion/custum_modules/attention_processors.py): `custum_3d_diffusion/custum_modules/attention_processors.py`
- [Configurable UNet](https://github.com/aiuniai/unique3d/blob/main/custum_3d_diffusion/custum_modules/unifield_processor.py): `custum_3d_diffusion/custum_modules/unifield_processor.py`

### Other components

- **Image user**
- **Hosted demos**
- **ComfyUI integration**
- **Generated mesh**

## Connections

- Image user → Full-run Gradio: submits image
- Image user → Stepwise Gradio: submits image
- Full-run Gradio → Image upscaling: upscales small image
- Full-run Gradio → Multiview prediction: predicts views
- Multiview prediction → Background removal: removes background
- Multiview prediction → Image preprocessing: preprocesses image
- Multiview prediction → Diffusion training: runs pipeline forward
- Diffusion training → Image diffusion pipelines: constructs pipeline
- Image diffusion pipelines → Configurable UNet: uses UNet
- Configurable UNet → Attention processors: installs processors
- Full-run Gradio → Geometry reconstruction: reconstructs geometry
- Geometry reconstruction → Mesh reconstruction: builds mesh
- Mesh reconstruction → Adaptive remeshing: optimizes topology
- Full-run Gradio → Mesh and video export: exports mesh
- Mesh and video export → Generated mesh: writes result
- Stepwise Gradio → Multiview prediction: generates views
- Stepwise Gradio → Normal prediction: optional normal prediction
- Stepwise Gradio → Geometry reconstruction: reconstructs mesh
- Stepwise Gradio → Mesh and video export: exports mesh
- Hosted demos → Image user: offers inference
- ComfyUI integration → Image user: offers workflow
