diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..68bc17f --- /dev/null +++ b/.gitignore @@ -0,0 +1,160 @@ +# Byte-compiled / optimized / DLL files +__pycache__/ +*.py[cod] +*$py.class + +# C extensions +*.so + +# Distribution / packaging +.Python +build/ +develop-eggs/ +dist/ +downloads/ +eggs/ +.eggs/ +lib/ +lib64/ +parts/ +sdist/ +var/ +wheels/ +share/python-wheels/ +*.egg-info/ +.installed.cfg +*.egg +MANIFEST + +# PyInstaller +# Usually these files are written by a python script from a template +# before PyInstaller builds the exe, so as to inject date/other infos into it. +*.manifest +*.spec + +# Installer logs +pip-log.txt +pip-delete-this-directory.txt + +# Unit test / coverage reports +htmlcov/ +.tox/ +.nox/ +.coverage +.coverage.* +.cache +nosetests.xml +coverage.xml +*.cover +*.py,cover +.hypothesis/ +.pytest_cache/ +cover/ + +# Translations +*.mo +*.pot + +# Django stuff: +*.log +local_settings.py +db.sqlite3 +db.sqlite3-journal + +# Flask stuff: +instance/ +.webassets-cache + +# Scrapy stuff: +.scrapy + +# Sphinx documentation +docs/_build/ + +# PyBuilder +.pybuilder/ +target/ + +# Jupyter Notebook +.ipynb_checkpoints + +# IPython +profile_default/ +ipython_config.py + +# pyenv +# For a library or package, you might want to ignore these files since the code is +# intended to run in multiple environments; otherwise, check them in: +# .python-version + +# pipenv +# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control. +# However, in case of collaboration, if having platform-specific dependencies or dependencies +# having no cross-platform support, pipenv may install dependencies that don't work, or not +# install all needed dependencies. +#Pipfile.lock + +# poetry +# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control. +# This is especially recommended for binary packages to ensure reproducibility, and is more +# commonly ignored for libraries. +# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control +#poetry.lock + +# pdm +# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control. +#pdm.lock +# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it +# in version control. +# https://pdm.fming.dev/#use-with-ide +.pdm.toml + +# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm +__pypackages__/ + +# Celery stuff +celerybeat-schedule +celerybeat.pid + +# SageMath parsed files +*.sage.py + +# Environments +.env +.venv +env/ +venv/ +ENV/ +env.bak/ +venv.bak/ + +# Spyder project settings +.spyderproject +.spyproject + +# Rope project settings +.ropeproject + +# mkdocs documentation +/site + +# mypy +.mypy_cache/ +.dmypy.json +dmypy.json + +# Pyre type checker +.pyre/ + +# pytype static type analyzer +.pytype/ + +# Cython debug symbols +cython_debug/ + +# PyCharm +# JetBrains specific template is maintained in a separate JetBrains.gitignore that can +# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore +# and can be added to the global gitignore or merged into this file. For a more nuclear +# option (not recommended) you can uncomment the following to ignore the entire idea folder. +#.idea/ diff --git a/__init__.py b/__init__.py new file mode 100644 index 0000000..3d998ea --- /dev/null +++ b/__init__.py @@ -0,0 +1,3 @@ +from .nodes import NODE_CLASS_MAPPINGS, NODE_DISPLAY_NAME_MAPPINGS + +__all__ = ['NODE_CLASS_MAPPINGS', 'NODE_DISPLAY_NAME_MAPPINGS'] diff --git a/examples/diffusion_light_test_workflow.json b/examples/diffusion_light_test_workflow.json new file mode 100644 index 0000000..c5e0ed5 --- /dev/null +++ b/examples/diffusion_light_test_workflow.json @@ -0,0 +1,3500 @@ +{ + "last_node_id": 95, + "last_link_id": 185, + "nodes": [ + { + "id": 9, + "type": "KSampler", + "pos": [ + 3312.558854596466, + 1650.5601112492122 + ], + "size": { + "0": 315, + "1": 262 + }, + "flags": {}, + "order": 55, + "mode": 0, + "inputs": [ + { + "name": "model", + "type": "MODEL", + "link": 65 + }, + { + "name": "positive", + "type": "CONDITIONING", + "link": 55 + }, + { + "name": "negative", + "type": "CONDITIONING", + "link": 56 + }, + { + "name": "latent_image", + "type": "LATENT", + "link": 52, + "slot_index": 3 + } + ], + "outputs": [ + { + "name": "LATENT", + "type": "LATENT", + "links": [ + 16 + ], + "shape": 3, + "slot_index": 0 + } + ], + "properties": { + "Node name for S&R": "KSampler" + }, + "widgets_values": [ + 825526754618340, + "fixed", + 25, + 6, + "dpmpp_2m", + "karras", + 1 + ] + }, + { + "id": 29, + "type": "ControlNetLoaderAdvanced", + "pos": [ + 2392.558854596466, + 1881.5601112492122 + ], + "size": { + "0": 367.79998779296875, + "1": 58 + }, + "flags": {}, + "order": 0, + "mode": 0, + "inputs": [ + { + "name": "timestep_keyframe", + "type": "TIMESTEP_KEYFRAME", + "link": null + } + ], + "outputs": [ + { + "name": "CONTROL_NET", + "type": "CONTROL_NET", + "links": [ + 57 + ], + "shape": 3 + } + ], + "properties": { + "Node name for S&R": "ControlNetLoaderAdvanced" + }, + "widgets_values": [ + "controlnet_depth_sdxl_fp16.safetensors" + ] + }, + { + "id": 27, + "type": "LatentBatchSeedBehavior", + "pos": [ + 2903.558854596466, + 2106.560111249212 + ], + "size": { + "0": 315, + "1": 58 + }, + "flags": {}, + "order": 54, + "mode": 0, + "inputs": [ + { + "name": "samples", + "type": "LATENT", + "link": 51 + } + ], + "outputs": [ + { + "name": "LATENT", + "type": "LATENT", + "links": [ + 52 + ], + "shape": 3, + "slot_index": 0 + } + ], + "properties": { + "Node name for S&R": "LatentBatchSeedBehavior" + }, + "widgets_values": [ + "fixed" + ] + }, + { + "id": 52, + "type": "SetNode", + "pos": [ + -60, + -420 + ], + "size": { + "0": 210, + "1": 58 + }, + "flags": { + "collapsed": true + }, + "order": 22, + "mode": 0, + "inputs": [ + { + "name": "VAE", + "type": "VAE", + "link": 101 + } + ], + "outputs": [ + { + "name": "*", + "type": "*", + "links": null + } + ], + "title": "Set_VAE", + "properties": { + "previousName": "" + }, + "widgets_values": [ + "VAE" + ], + "color": "#322", + "bgcolor": "#533" + }, + { + "id": 54, + "type": "SetNode", + "pos": [ + -50, + -470 + ], + "size": { + "0": 210, + "1": 58 + }, + "flags": { + "collapsed": true + }, + "order": 21, + "mode": 0, + "inputs": [ + { + "name": "CLIP", + "type": "CLIP", + "link": 100 + } + ], + "outputs": [ + { + "name": "*", + "type": "*", + "links": null + } + ], + "title": "Set_Clip", + "properties": { + "previousName": "" + }, + "widgets_values": [ + "Clip" + ], + "color": "#432", + "bgcolor": "#653" + }, + { + "id": 53, + "type": "SetNode", + "pos": [ + -50, + -520 + ], + "size": { + "0": 210, + "1": 58 + }, + "flags": { + "collapsed": true + }, + "order": 20, + "mode": 0, + "inputs": [ + { + "name": "MODEL", + "type": "MODEL", + "link": 99 + } + ], + "outputs": [ + { + "name": "*", + "type": "*", + "links": null + } + ], + "title": "Set_Model", + "properties": { + "previousName": "" + }, + "widgets_values": [ + "Model" + ], + "color": "#223", + "bgcolor": "#335" + }, + { + "id": 56, + "type": "GetNode", + "pos": [ + 3545.12449717459, + 1556.0847853703056 + ], + "size": { + "0": 210, + "1": 58 + }, + "flags": { + "collapsed": true + }, + "order": 1, + "mode": 0, + "outputs": [ + { + "name": "VAE", + "type": "VAE", + "links": [ + 103 + ] + } + ], + "title": "Get_VAE", + "properties": {}, + "widgets_values": [ + "VAE" + ], + "color": "#322", + "bgcolor": "#533" + }, + { + "id": 10, + "type": "VAEDecode", + "pos": [ + 3679.558854596466, + 1536.5601112492122 + ], + "size": { + "0": 210, + "1": 46 + }, + "flags": {}, + "order": 56, + "mode": 0, + "inputs": [ + { + "name": "samples", + "type": "LATENT", + "link": 16 + }, + { + "name": "vae", + "type": "VAE", + "link": 103, + "slot_index": 1 + } + ], + "outputs": [ + { + "name": "IMAGE", + "type": "IMAGE", + "links": [ + 71, + 74 + ], + "shape": 3, + "slot_index": 0 + } + ], + "properties": { + "Node name for S&R": "VAEDecode" + } + }, + { + "id": 58, + "type": "GetNode", + "pos": [ + 1065.558854596464, + 2104.560111249212 + ], + "size": { + "0": 210, + "1": 58 + }, + "flags": { + "collapsed": true + }, + "order": 2, + "mode": 0, + "outputs": [ + { + "name": "CLIP", + "type": "CLIP", + "links": [ + 105, + 106 + ], + "slot_index": 0 + } + ], + "title": "Get_Clip", + "properties": {}, + "widgets_values": [ + "Clip" + ], + "color": "#432", + "bgcolor": "#653" + }, + { + "id": 19, + "type": "DifferentialDiffusion", + "pos": [ + 3063.558854596466, + 1556.5601112492122 + ], + "size": { + "0": 210, + "1": 26 + }, + "flags": {}, + "order": 29, + "mode": 0, + "inputs": [ + { + "name": "model", + "type": "MODEL", + "link": 112 + } + ], + "outputs": [ + { + "name": "MODEL", + "type": "MODEL", + "links": [ + 65 + ], + "shape": 3, + "slot_index": 0 + } + ], + "properties": { + "Node name for S&R": "DifferentialDiffusion" + } + }, + { + "id": 14, + "type": "LoraLoaderModelOnly", + "pos": [ + 2697.558854596466, + 1552.5601112492122 + ], + "size": { + "0": 315, + "1": 82 + }, + "flags": {}, + "order": 19, + "mode": 0, + "inputs": [ + { + "name": "model", + "type": "MODEL", + "link": 111, + "slot_index": 0 + } + ], + "outputs": [ + { + "name": "MODEL", + "type": "MODEL", + "links": [ + 112 + ], + "shape": 3, + "slot_index": 0 + } + ], + "properties": { + "Node name for S&R": "LoraLoaderModelOnly" + }, + "widgets_values": [ + "diffusion_light_sdxl_lora_comfy.safetensors", + 0.75 + ] + }, + { + "id": 61, + "type": "GetNode", + "pos": [ + 2512.558854596466, + 1572.5601112492122 + ], + "size": { + "0": 210, + "1": 58 + }, + "flags": { + "collapsed": true + }, + "order": 3, + "mode": 0, + "outputs": [ + { + "name": "MODEL", + "type": "MODEL", + "links": [ + 111 + ] + } + ], + "title": "Get_Model", + "properties": {}, + "widgets_values": [ + "Model" + ], + "color": "#223", + "bgcolor": "#335" + }, + { + "id": 16, + "type": "MaskPreview+", + "pos": [ + 510, + 1150 + ], + "size": [ + 278.7117195507806, + 277.2935388354489 + ], + "flags": {}, + "order": 34, + "mode": 0, + "inputs": [ + { + "name": "mask", + "type": "MASK", + "link": 23 + } + ], + "properties": { + "Node name for S&R": "MaskPreview+" + } + }, + { + "id": 20, + "type": "SimpleMath+", + "pos": [ + 280, + 860 + ], + "size": { + "0": 315, + "1": 78 + }, + "flags": { + "collapsed": true + }, + "order": 23, + "mode": 0, + "inputs": [ + { + "name": "a", + "type": "INT,FLOAT", + "link": 38 + }, + { + "name": "b", + "type": "INT,FLOAT", + "link": null + } + ], + "outputs": [ + { + "name": "INT", + "type": "INT", + "links": [ + 41 + ], + "shape": 3, + "slot_index": 0 + }, + { + "name": "FLOAT", + "type": "FLOAT", + "links": null, + "shape": 3 + } + ], + "properties": { + "Node name for S&R": "SimpleMath+" + }, + "widgets_values": [ + "a/2" + ] + }, + { + "id": 23, + "type": "SimpleMath+", + "pos": [ + 280, + 900 + ], + "size": { + "0": 315, + "1": 78 + }, + "flags": { + "collapsed": true + }, + "order": 24, + "mode": 0, + "inputs": [ + { + "name": "a", + "type": "INT,FLOAT", + "link": 42 + }, + { + "name": "b", + "type": "INT,FLOAT", + "link": null + } + ], + "outputs": [ + { + "name": "INT", + "type": "INT", + "links": [ + 43 + ], + "shape": 3, + "slot_index": 0 + }, + { + "name": "FLOAT", + "type": "FLOAT", + "links": null, + "shape": 3 + } + ], + "properties": { + "Node name for S&R": "SimpleMath+" + }, + "widgets_values": [ + "a/2" + ] + }, + { + "id": 2, + "type": "CheckpointLoaderSimple", + "pos": [ + -590, + -510 + ], + "size": [ + 484.56952672675743, + 98 + ], + "flags": {}, + "order": 4, + "mode": 0, + "outputs": [ + { + "name": "MODEL", + "type": "MODEL", + "links": [ + 99 + ], + "shape": 3, + "slot_index": 0 + }, + { + "name": "CLIP", + "type": "CLIP", + "links": [ + 100 + ], + "shape": 3, + "slot_index": 1 + }, + { + "name": "VAE", + "type": "VAE", + "links": [ + 101 + ], + "shape": 3, + "slot_index": 2 + } + ], + "properties": { + "Node name for S&R": "CheckpointLoaderSimple" + }, + "widgets_values": [ + "SDXL\\juggernautXL_v9Rundiffusionphoto2.safetensors" + ] + }, + { + "id": 18, + "type": "InpaintModelConditioning", + "pos": [ + 2106.5588545964642, + 1679.5601112492122 + ], + "size": { + "0": 216.59999084472656, + "1": 106 + }, + "flags": {}, + "order": 50, + "mode": 0, + "inputs": [ + { + "name": "positive", + "type": "CONDITIONING", + "link": 76 + }, + { + "name": "negative", + "type": "CONDITIONING", + "link": 29, + "slot_index": 1 + }, + { + "name": "vae", + "type": "VAE", + "link": 104, + "slot_index": 2 + }, + { + "name": "pixels", + "type": "IMAGE", + "link": 168, + "slot_index": 3 + }, + { + "name": "mask", + "type": "MASK", + "link": 137 + } + ], + "outputs": [ + { + "name": "positive", + "type": "CONDITIONING", + "links": [ + 53 + ], + "shape": 3, + "slot_index": 0 + }, + { + "name": "negative", + "type": "CONDITIONING", + "links": [ + 54 + ], + "shape": 3, + "slot_index": 1 + }, + { + "name": "latent", + "type": "LATENT", + "links": [ + 49 + ], + "shape": 3, + "slot_index": 2 + } + ], + "properties": { + "Node name for S&R": "InpaintModelConditioning" + } + }, + { + "id": 26, + "type": "VHS_DuplicateLatents", + "pos": [ + 2598.558854596466, + 2134.560111249212 + ], + "size": [ + 315, + 78 + ], + "flags": { + "collapsed": true + }, + "order": 53, + "mode": 0, + "inputs": [ + { + "name": "latents", + "type": "LATENT", + "link": 49 + }, + { + "name": "multiply_by", + "type": "INT", + "link": 118, + "widget": { + "name": "multiply_by" + } + } + ], + "outputs": [ + { + "name": "LATENT", + "type": "LATENT", + "links": [ + 51 + ], + "shape": 3, + "slot_index": 0 + }, + { + "name": "count", + "type": "INT", + "links": null, + "shape": 3 + } + ], + "properties": { + "Node name for S&R": "VHS_DuplicateLatents" + }, + "widgets_values": { + "multiply_by": 3 + } + }, + { + "id": 25, + "type": "BatchPromptSchedule", + "pos": [ + 1303.5588545964645, + 1726.5601112492122 + ], + "size": [ + 467.56468349609327, + 521.9900772265619 + ], + "flags": {}, + "order": 27, + "mode": 0, + "inputs": [ + { + "name": "clip", + "type": "CLIP", + "link": 105, + "slot_index": 0 + }, + { + "name": "app_text", + "type": "STRING", + "link": 107, + "widget": { + "name": "app_text" + } + }, + { + "name": "max_frames", + "type": "INT", + "link": 119, + "widget": { + "name": "max_frames" + } + } + ], + "outputs": [ + { + "name": "POS", + "type": "CONDITIONING", + "links": [ + 76 + ], + "shape": 3, + "slot_index": 0 + }, + { + "name": "NEG", + "type": "CONDITIONING", + "links": null, + "shape": 3 + } + ], + "properties": { + "Node name for S&R": "BatchPromptSchedule" + }, + "widgets_values": [ + "\"0\" :\"a perfect black dark mirrored reflective chrome ball sphere\",\n\"2\" :\"a perfect mirrored reflective chrome ball sphere\",\n\n", + 3, + false, + "", + "professional photograph, landscape, sunset", + 0, + 0, + 0, + 0, + 0 + ], + "color": "#232", + "bgcolor": "#353" + }, + { + "id": 65, + "type": "INTConstant", + "pos": [ + 1436.5588545964645, + 2329.5601112492113 + ], + "size": [ + 200, + 58 + ], + "flags": {}, + "order": 5, + "mode": 0, + "outputs": [ + { + "name": "value", + "type": "INT", + "links": [ + 118, + 119 + ], + "shape": 3, + "slot_index": 0 + } + ], + "title": "BatchSize", + "properties": { + "Node name for S&R": "INTConstant" + }, + "widgets_values": [ + 3 + ], + "color": "#1b4669", + "bgcolor": "#29699c" + }, + { + "id": 12, + "type": "CLIPTextEncode", + "pos": [ + 1326.5588545964645, + 2447.5601112492113 + ], + "size": { + "0": 400, + "1": 200 + }, + "flags": {}, + "order": 18, + "mode": 0, + "inputs": [ + { + "name": "clip", + "type": "CLIP", + "link": 106 + } + ], + "outputs": [ + { + "name": "CONDITIONING", + "type": "CONDITIONING", + "links": [ + 29 + ], + "shape": 3, + "slot_index": 0 + } + ], + "properties": { + "Node name for S&R": "CLIPTextEncode" + }, + "widgets_values": [ + "matte, diffuse, flat, dull" + ], + "color": "#322", + "bgcolor": "#533" + }, + { + "id": 57, + "type": "GetNode", + "pos": [ + 2017.5588545964645, + 1847.5601112492122 + ], + "size": { + "0": 210, + "1": 58 + }, + "flags": { + "collapsed": true + }, + "order": 6, + "mode": 0, + "outputs": [ + { + "name": "VAE", + "type": "VAE", + "links": [ + 104 + ] + } + ], + "title": "Get_VAE", + "properties": {}, + "widgets_values": [ + "VAE" + ], + "color": "#322", + "bgcolor": "#533" + }, + { + "id": 66, + "type": "geowizard_model_loader", + "pos": [ + 1710, + 731 + ], + "size": { + "0": 315, + "1": 58 + }, + "flags": {}, + "order": 26, + "mode": 0, + "inputs": [ + { + "name": "vae", + "type": "VAE", + "link": 126, + "slot_index": 0 + } + ], + "outputs": [ + { + "name": "geowizard_model", + "type": "GEOWIZMODEL", + "links": [ + 121 + ], + "shape": 3, + "slot_index": 0 + } + ], + "properties": { + "Node name for S&R": "geowizard_model_loader" + }, + "widgets_values": [ + "fp16" + ] + }, + { + "id": 73, + "type": "ImageCompositeMasked", + "pos": [ + 1988, + 1068 + ], + "size": { + "0": 315, + "1": 146 + }, + "flags": {}, + "order": 48, + "mode": 0, + "inputs": [ + { + "name": "destination", + "type": "IMAGE", + "link": 131 + }, + { + "name": "source", + "type": "IMAGE", + "link": 130 + }, + { + "name": "mask", + "type": "MASK", + "link": 184, + "slot_index": 2 + } + ], + "outputs": [ + { + "name": "IMAGE", + "type": "IMAGE", + "links": [ + 132, + 134 + ], + "shape": 3, + "slot_index": 0 + } + ], + "properties": { + "Node name for S&R": "ImageCompositeMasked" + }, + "widgets_values": [ + 0, + 0, + false + ] + }, + { + "id": 75, + "type": "PreviewImage", + "pos": [ + 2479, + 690 + ], + "size": [ + 520.0814651737137, + 521.5464873529943 + ], + "flags": {}, + "order": 51, + "mode": 0, + "inputs": [ + { + "name": "images", + "type": "IMAGE", + "link": 132 + } + ], + "properties": { + "Node name for S&R": "PreviewImage" + } + }, + { + "id": 74, + "type": "MaskToImage", + "pos": [ + 1771, + 1118 + ], + "size": { + "0": 210, + "1": 26 + }, + "flags": { + "collapsed": true + }, + "order": 46, + "mode": 0, + "inputs": [ + { + "name": "mask", + "type": "MASK", + "link": 185 + } + ], + "outputs": [ + { + "name": "IMAGE", + "type": "IMAGE", + "links": [ + 130 + ], + "shape": 3, + "slot_index": 0 + } + ], + "properties": { + "Node name for S&R": "MaskToImage" + } + }, + { + "id": 76, + "type": "Reroute", + "pos": [ + 1669, + 1187 + ], + "size": [ + 75, + 26 + ], + "flags": {}, + "order": 35, + "mode": 0, + "inputs": [ + { + "name": "", + "type": "*", + "link": 135 + } + ], + "outputs": [ + { + "name": "MASK", + "type": "MASK", + "links": [ + 137 + ], + "slot_index": 0 + } + ], + "properties": { + "showOutputText": true, + "horizontal": false + } + }, + { + "id": 45, + "type": "chrome_ball_to_envmap", + "pos": [ + 4350.507189436807, + 460.25496943933535 + ], + "size": { + "0": 315, + "1": 82 + }, + "flags": {}, + "order": 59, + "mode": 0, + "inputs": [ + { + "name": "ball_images", + "type": "IMAGE", + "link": 82 + } + ], + "outputs": [ + { + "name": "image", + "type": "IMAGE", + "links": [ + 83 + ], + "shape": 3, + "slot_index": 0 + } + ], + "properties": { + "Node name for S&R": "chrome_ball_to_envmap" + }, + "widgets_values": [ + 768, + 2 + ] + }, + { + "id": 62, + "type": "INTConstant", + "pos": [ + 150, + 970 + ], + "size": [ + 200, + 58 + ], + "flags": {}, + "order": 7, + "mode": 0, + "outputs": [ + { + "name": "value", + "type": "INT", + "links": [ + 114 + ], + "shape": 3, + "slot_index": 0 + } + ], + "title": "MaskWidth", + "properties": { + "Node name for S&R": "INTConstant" + }, + "widgets_values": [ + 512 + ], + "color": "#1b4669", + "bgcolor": "#29699c" + }, + { + "id": 63, + "type": "INTConstant", + "pos": [ + 150, + 1080 + ], + "size": [ + 200, + 58 + ], + "flags": {}, + "order": 8, + "mode": 0, + "outputs": [ + { + "name": "value", + "type": "INT", + "links": [ + 115 + ], + "shape": 3, + "slot_index": 0 + } + ], + "title": "MaskHeight", + "properties": { + "Node name for S&R": "INTConstant" + }, + "widgets_values": [ + 512 + ], + "color": "#1b4669", + "bgcolor": "#29699c" + }, + { + "id": 85, + "type": "UpscaleModelLoader", + "pos": [ + 1595, + 201 + ], + "size": { + "0": 315, + "1": 58 + }, + "flags": {}, + "order": 9, + "mode": 0, + "outputs": [ + { + "name": "UPSCALE_MODEL", + "type": "UPSCALE_MODEL", + "links": [ + 162 + ], + "shape": 3 + } + ], + "properties": { + "Node name for S&R": "UpscaleModelLoader" + }, + "widgets_values": [ + "2xHigurashi_v1_compact_270k.pth" + ] + }, + { + "id": 84, + "type": "ImageUpscaleWithModel", + "pos": [ + 1957, + 204 + ], + "size": { + "0": 241.79998779296875, + "1": 46 + }, + "flags": {}, + "order": 37, + "mode": 0, + "inputs": [ + { + "name": "upscale_model", + "type": "UPSCALE_MODEL", + "link": 162, + "slot_index": 0 + }, + { + "name": "image", + "type": "IMAGE", + "link": 163, + "slot_index": 1 + } + ], + "outputs": [ + { + "name": "IMAGE", + "type": "IMAGE", + "links": [ + 164 + ], + "shape": 3, + "slot_index": 0 + } + ], + "properties": { + "Node name for S&R": "ImageUpscaleWithModel" + } + }, + { + "id": 86, + "type": "ImageResize+", + "pos": [ + 1946, + 330 + ], + "size": { + "0": 315, + "1": 218 + }, + "flags": {}, + "order": 40, + "mode": 0, + "inputs": [ + { + "name": "image", + "type": "IMAGE", + "link": 164 + } + ], + "outputs": [ + { + "name": "IMAGE", + "type": "IMAGE", + "links": [ + 165 + ], + "shape": 3, + "slot_index": 0 + }, + { + "name": "width", + "type": "INT", + "links": null, + "shape": 3 + }, + { + "name": "height", + "type": "INT", + "links": null, + "shape": 3 + } + ], + "properties": { + "Node name for S&R": "ImageResize+" + }, + "widgets_values": [ + 2048, + 2048, + "nearest", + false, + "always", + 0 + ] + }, + { + "id": 21, + "type": "INTConstant", + "pos": [ + -215, + 532 + ], + "size": { + "0": 210, + "1": 58 + }, + "flags": {}, + "order": 10, + "mode": 0, + "outputs": [ + { + "name": "value", + "type": "INT", + "links": [ + 38, + 40 + ], + "shape": 3, + "slot_index": 0 + } + ], + "title": "Width", + "properties": { + "Node name for S&R": "INTConstant" + }, + "widgets_values": [ + 2048 + ], + "color": "#1b4669", + "bgcolor": "#29699c" + }, + { + "id": 22, + "type": "INTConstant", + "pos": [ + -213, + 665 + ], + "size": { + "0": 210, + "1": 58 + }, + "flags": {}, + "order": 11, + "mode": 0, + "outputs": [ + { + "name": "value", + "type": "INT", + "links": [ + 42, + 46 + ], + "shape": 3, + "slot_index": 0 + } + ], + "title": "Height", + "properties": { + "Node name for S&R": "INTConstant" + }, + "widgets_values": [ + 2048 + ], + "color": "#1b4669", + "bgcolor": "#29699c" + }, + { + "id": 39, + "type": "PreviewImage", + "pos": [ + 3727.89744756875, + 1727.3434136793749 + ], + "size": [ + 1540.0967480468735, + 528.6918603515619 + ], + "flags": {}, + "order": 57, + "mode": 0, + "inputs": [ + { + "name": "images", + "type": "IMAGE", + "link": 71 + } + ], + "properties": { + "Node name for S&R": "PreviewImage" + } + }, + { + "id": 42, + "type": "exposure_to_hdr", + "pos": [ + 4740.507189436807, + 450.25496943933535 + ], + "size": { + "0": 315, + "1": 78 + }, + "flags": {}, + "order": 61, + "mode": 0, + "inputs": [ + { + "name": "images", + "type": "IMAGE", + "link": 83 + } + ], + "outputs": [ + { + "name": "hrd_image", + "type": "IMAGE", + "links": [ + 169 + ], + "shape": 3, + "slot_index": 0 + }, + { + "name": "ldr_image", + "type": "IMAGE", + "links": [ + 80 + ], + "shape": 3, + "slot_index": 1 + } + ], + "properties": { + "Node name for S&R": "exposure_to_hdr" + }, + "widgets_values": [ + 2.32 + ] + }, + { + "id": 88, + "type": "SaveImageOpenEXR", + "pos": [ + 5139, + 392 + ], + "size": { + "0": 315, + "1": 58 + }, + "flags": {}, + "order": 62, + "mode": 0, + "inputs": [ + { + "name": "images", + "type": "IMAGE", + "link": 169 + } + ], + "outputs": [ + { + "name": "file_url", + "type": "STRING", + "links": null, + "shape": 3 + } + ], + "properties": { + "Node name for S&R": "SaveImageOpenEXR" + }, + "widgets_values": [ + "DiffusionLight" + ] + }, + { + "id": 64, + "type": "GetNode", + "pos": [ + 965, + -142 + ], + "size": { + "0": 210, + "1": 58 + }, + "flags": { + "collapsed": true + }, + "order": 12, + "mode": 0, + "outputs": [ + { + "name": "CLIP", + "type": "CLIP", + "links": [ + 116, + 117 + ], + "slot_index": 0 + } + ], + "title": "Get_Clip", + "properties": {}, + "widgets_values": [ + "Clip" + ], + "color": "#432", + "bgcolor": "#653" + }, + { + "id": 60, + "type": "GetNode", + "pos": [ + 1594, + -470 + ], + "size": { + "0": 210, + "1": 58 + }, + "flags": { + "collapsed": true + }, + "order": 13, + "mode": 0, + "outputs": [ + { + "name": "MODEL", + "type": "MODEL", + "links": [ + 143, + 153 + ] + } + ], + "title": "Get_Model", + "properties": {}, + "widgets_values": [ + "Model" + ], + "color": "#223", + "bgcolor": "#335" + }, + { + "id": 78, + "type": "KSamplerAdvanced", + "pos": [ + 1697, + -329 + ], + "size": { + "0": 315, + "1": 334 + }, + "flags": {}, + "order": 32, + "mode": 0, + "inputs": [ + { + "name": "model", + "type": "MODEL", + "link": 143 + }, + { + "name": "positive", + "type": "CONDITIONING", + "link": 144 + }, + { + "name": "negative", + "type": "CONDITIONING", + "link": 145 + }, + { + "name": "latent_image", + "type": "LATENT", + "link": 146 + } + ], + "outputs": [ + { + "name": "LATENT", + "type": "LATENT", + "links": [ + 147 + ], + "shape": 3 + } + ], + "properties": { + "Node name for S&R": "KSamplerAdvanced" + }, + "widgets_values": [ + "enable", + 123, + "fixed", + 20, + 7, + "dpmpp_2m", + "karras", + 0, + 10000, + "disable" + ] + }, + { + "id": 6, + "type": "EmptyLatentImage", + "pos": [ + 1174, + -443 + ], + "size": [ + 269.2066092285154, + 106 + ], + "flags": { + "collapsed": false + }, + "order": 14, + "mode": 0, + "inputs": [], + "outputs": [ + { + "name": "LATENT", + "type": "LATENT", + "links": [ + 146 + ], + "shape": 3, + "slot_index": 0 + } + ], + "properties": { + "Node name for S&R": "EmptyLatentImage" + }, + "widgets_values": [ + 1024, + 1024, + 1 + ] + }, + { + "id": 4, + "type": "CLIPTextEncode", + "pos": [ + 1162, + -223 + ], + "size": [ + 210, + 54 + ], + "flags": { + "collapsed": true + }, + "order": 28, + "mode": 0, + "inputs": [ + { + "name": "clip", + "type": "CLIP", + "link": 116 + }, + { + "name": "text", + "type": "STRING", + "link": 109, + "widget": { + "name": "text" + } + } + ], + "outputs": [ + { + "name": "CONDITIONING", + "type": "CONDITIONING", + "links": [ + 144, + 173 + ], + "shape": 3, + "slot_index": 0 + } + ], + "properties": { + "Node name for S&R": "CLIPTextEncode" + }, + "widgets_values": [ + "professional photograph, landscape, sunset" + ], + "color": "#232", + "bgcolor": "#353" + }, + { + "id": 90, + "type": "Reroute", + "pos": [ + 1723, + 27 + ], + "size": [ + 140.8, + 26 + ], + "flags": {}, + "order": 33, + "mode": 0, + "inputs": [ + { + "name": "", + "type": "*", + "link": 173, + "slot_index": 0 + } + ], + "outputs": [ + { + "name": "CONDITIONING", + "type": "CONDITIONING", + "links": [ + 172 + ], + "slot_index": 0 + } + ], + "properties": { + "showOutputText": true, + "horizontal": false + } + }, + { + "id": 89, + "type": "Reroute", + "pos": [ + 1733, + 72 + ], + "size": [ + 140.8, + 26 + ], + "flags": {}, + "order": 31, + "mode": 0, + "inputs": [ + { + "name": "", + "type": "*", + "link": 170 + } + ], + "outputs": [ + { + "name": "CONDITIONING", + "type": "CONDITIONING", + "links": [ + 171 + ], + "slot_index": 0 + } + ], + "properties": { + "showOutputText": true, + "horizontal": false + } + }, + { + "id": 5, + "type": "CLIPTextEncode", + "pos": [ + 1061, + -61 + ], + "size": [ + 381.9204001171868, + 114.7438129687497 + ], + "flags": {}, + "order": 25, + "mode": 0, + "inputs": [ + { + "name": "clip", + "type": "CLIP", + "link": 117 + } + ], + "outputs": [ + { + "name": "CONDITIONING", + "type": "CONDITIONING", + "links": [ + 145, + 170 + ], + "shape": 3, + "slot_index": 0 + } + ], + "properties": { + "Node name for S&R": "CLIPTextEncode" + }, + "widgets_values": [ + "bad quality, bad picture" + ], + "color": "#322", + "bgcolor": "#533" + }, + { + "id": 55, + "type": "GetNode", + "pos": [ + 2033, + -145 + ], + "size": { + "0": 210, + "1": 58 + }, + "flags": { + "collapsed": true + }, + "order": 15, + "mode": 0, + "outputs": [ + { + "name": "VAE", + "type": "VAE", + "links": [ + 102, + 158, + 166 + ] + } + ], + "title": "Get_VAE", + "properties": {}, + "widgets_values": [ + "VAE" + ], + "color": "#322", + "bgcolor": "#533" + }, + { + "id": 81, + "type": "VAEDecode", + "pos": [ + 2832, + -100 + ], + "size": { + "0": 210, + "1": 46 + }, + "flags": {}, + "order": 47, + "mode": 0, + "inputs": [ + { + "name": "samples", + "type": "LATENT", + "link": 157 + }, + { + "name": "vae", + "type": "VAE", + "link": 158, + "slot_index": 1 + } + ], + "outputs": [ + { + "name": "IMAGE", + "type": "IMAGE", + "links": [ + 159, + 168 + ], + "shape": 3, + "slot_index": 0 + } + ], + "properties": { + "Node name for S&R": "VAEDecode" + } + }, + { + "id": 80, + "type": "KSamplerAdvanced", + "pos": [ + 2453, + -30 + ], + "size": { + "0": 315, + "1": 334 + }, + "flags": {}, + "order": 45, + "mode": 0, + "inputs": [ + { + "name": "model", + "type": "MODEL", + "link": 153 + }, + { + "name": "positive", + "type": "CONDITIONING", + "link": 172 + }, + { + "name": "negative", + "type": "CONDITIONING", + "link": 171 + }, + { + "name": "latent_image", + "type": "LATENT", + "link": 167 + } + ], + "outputs": [ + { + "name": "LATENT", + "type": "LATENT", + "links": [ + 157 + ], + "shape": 3, + "slot_index": 0 + } + ], + "properties": { + "Node name for S&R": "KSamplerAdvanced" + }, + "widgets_values": [ + "enable", + 123, + "fixed", + 20, + 7, + "dpmpp_2m", + "karras", + 10, + 10000, + "disable" + ] + }, + { + "id": 87, + "type": "VAEEncode", + "pos": [ + 2213, + 95 + ], + "size": { + "0": 210, + "1": 46 + }, + "flags": {}, + "order": 43, + "mode": 0, + "inputs": [ + { + "name": "pixels", + "type": "IMAGE", + "link": 165 + }, + { + "name": "vae", + "type": "VAE", + "link": 166, + "slot_index": 1 + } + ], + "outputs": [ + { + "name": "LATENT", + "type": "LATENT", + "links": [ + 167 + ], + "shape": 3, + "slot_index": 0 + } + ], + "properties": { + "Node name for S&R": "VAEEncode" + } + }, + { + "id": 82, + "type": "PreviewImage", + "pos": [ + 2794, + 35 + ], + "size": [ + 455.01594843750036, + 486.8726437500004 + ], + "flags": {}, + "order": 49, + "mode": 0, + "inputs": [ + { + "name": "images", + "type": "IMAGE", + "link": 159 + } + ], + "properties": { + "Node name for S&R": "PreviewImage" + } + }, + { + "id": 91, + "type": "PreviewImage", + "pos": [ + 2483.5896138671856, + -496.3171666015628 + ], + "size": [ + 322.1019999999994, + 330.1545499999994 + ], + "flags": {}, + "order": 38, + "mode": 0, + "inputs": [ + { + "name": "images", + "type": "IMAGE", + "link": 174 + } + ], + "properties": { + "Node name for S&R": "PreviewImage" + } + }, + { + "id": 71, + "type": "VAELoader", + "pos": [ + 1329, + 738 + ], + "size": { + "0": 315, + "1": 58 + }, + "flags": {}, + "order": 16, + "mode": 0, + "outputs": [ + { + "name": "VAE", + "type": "VAE", + "links": [ + 126 + ], + "shape": 3, + "slot_index": 0 + } + ], + "properties": { + "Node name for S&R": "VAELoader" + }, + "widgets_values": [ + "vae-ft-mse-840000-ema-pruned.safetensors" + ] + }, + { + "id": 59, + "type": "Text Multiline", + "pos": [ + 479, + -164 + ], + "size": { + "0": 400, + "1": 200 + }, + "flags": {}, + "order": 17, + "mode": 0, + "outputs": [ + { + "name": "STRING", + "type": "STRING", + "links": [ + 107, + 109 + ], + "shape": 3, + "slot_index": 0 + } + ], + "properties": { + "Node name for S&R": "Text Multiline" + }, + "widgets_values": [ + "outdoors, lake, clouds, sky, sunset" + ], + "color": "#232", + "bgcolor": "#353" + }, + { + "id": 3, + "type": "VAEDecode", + "pos": [ + 2204, + -323 + ], + "size": { + "0": 210, + "1": 46 + }, + "flags": {}, + "order": 36, + "mode": 0, + "inputs": [ + { + "name": "samples", + "type": "LATENT", + "link": 147 + }, + { + "name": "vae", + "type": "VAE", + "link": 102, + "slot_index": 1 + } + ], + "outputs": [ + { + "name": "IMAGE", + "type": "IMAGE", + "links": [ + 163, + 174, + 178 + ], + "shape": 3, + "slot_index": 0 + } + ], + "properties": { + "Node name for S&R": "VAEDecode" + } + }, + { + "id": 47, + "type": "PreviewImage", + "pos": [ + 3569, + 783 + ], + "size": [ + 853.0890680018756, + 304.6789532742189 + ], + "flags": {}, + "order": 60, + "mode": 0, + "inputs": [ + { + "name": "images", + "type": "IMAGE", + "link": 89 + } + ], + "properties": { + "Node name for S&R": "PreviewImage" + } + }, + { + "id": 28, + "type": "ACN_AdvancedControlNetApply", + "pos": [ + 2793.89744756875, + 1760.3434136793749 + ], + "size": { + "0": 355.20001220703125, + "1": 266 + }, + "flags": {}, + "order": 52, + "mode": 0, + "inputs": [ + { + "name": "positive", + "type": "CONDITIONING", + "link": 53 + }, + { + "name": "negative", + "type": "CONDITIONING", + "link": 54 + }, + { + "name": "control_net", + "type": "CONTROL_NET", + "link": 57, + "slot_index": 2 + }, + { + "name": "image", + "type": "IMAGE", + "link": 134, + "slot_index": 3 + }, + { + "name": "mask_optional", + "type": "MASK", + "link": null + }, + { + "name": "timestep_kf", + "type": "TIMESTEP_KEYFRAME", + "link": null + }, + { + "name": "latent_kf_override", + "type": "LATENT_KEYFRAME", + "link": null + }, + { + "name": "weights_override", + "type": "CONTROL_NET_WEIGHTS", + "link": null + }, + { + "name": "model_optional", + "type": "MODEL", + "link": null + } + ], + "outputs": [ + { + "name": "positive", + "type": "CONDITIONING", + "links": [ + 55 + ], + "shape": 3, + "slot_index": 0 + }, + { + "name": "negative", + "type": "CONDITIONING", + "links": [ + 56 + ], + "shape": 3, + "slot_index": 1 + }, + { + "name": "model_opt", + "type": "MODEL", + "links": null, + "shape": 3 + } + ], + "properties": { + "Node name for S&R": "ACN_AdvancedControlNetApply" + }, + "widgets_values": [ + 0.75, + 0, + 1 + ] + }, + { + "id": 15, + "type": "CreateShapeMask", + "pos": [ + 490, + 830 + ], + "size": [ + 315, + 270 + ], + "flags": {}, + "order": 30, + "mode": 0, + "inputs": [ + { + "name": "frame_width", + "type": "INT", + "link": 40, + "widget": { + "name": "frame_width" + } + }, + { + "name": "frame_height", + "type": "INT", + "link": 46, + "widget": { + "name": "frame_height" + } + }, + { + "name": "location_x", + "type": "INT", + "link": 41, + "widget": { + "name": "location_x" + } + }, + { + "name": "location_y", + "type": "INT", + "link": 43, + "widget": { + "name": "location_y" + } + }, + { + "name": "shape_width", + "type": "INT", + "link": 114, + "widget": { + "name": "shape_width" + }, + "slot_index": 4 + }, + { + "name": "shape_height", + "type": "INT", + "link": 115, + "widget": { + "name": "shape_height" + } + } + ], + "outputs": [ + { + "name": "mask", + "type": "MASK", + "links": [ + 23, + 135, + 176 + ], + "shape": 3, + "slot_index": 0 + }, + { + "name": "mask_inverted", + "type": "MASK", + "links": null, + "shape": 3 + } + ], + "properties": { + "Node name for S&R": "CreateShapeMask" + }, + "widgets_values": [ + "circle", + 1, + 512, + 256, + 0, + 1152, + 640, + 256, + 256 + ] + }, + { + "id": 67, + "type": "geowizard_sampler", + "pos": [ + 2082, + 768 + ], + "size": { + "0": 315, + "1": 222 + }, + "flags": {}, + "order": 42, + "mode": 0, + "inputs": [ + { + "name": "geowizard_model", + "type": "GEOWIZMODEL", + "link": 121 + }, + { + "name": "image", + "type": "IMAGE", + "link": 180 + } + ], + "outputs": [ + { + "name": "depth", + "type": "IMAGE", + "links": [ + 131 + ], + "shape": 3, + "slot_index": 0 + }, + { + "name": "normal", + "type": "IMAGE", + "links": [], + "shape": 3, + "slot_index": 1 + } + ], + "properties": { + "Node name for S&R": "geowizard_sampler" + }, + "widgets_values": [ + 10, + 3, + 0, + "fixed", + "outdoor", + "DPMSolverMultistepScheduler", + false + ] + }, + { + "id": 95, + "type": "Reroute", + "pos": [ + 1699, + 837 + ], + "size": [ + 82, + 26 + ], + "flags": {}, + "order": 39, + "mode": 0, + "inputs": [ + { + "name": "", + "type": "*", + "link": 178 + } + ], + "outputs": [ + { + "name": "IMAGE", + "type": "IMAGE", + "links": [ + 179, + 180 + ], + "slot_index": 0 + } + ], + "properties": { + "showOutputText": true, + "horizontal": false + } + }, + { + "id": 93, + "type": "GetImageSize+", + "pos": [ + 1325, + 952 + ], + "size": { + "0": 210, + "1": 46 + }, + "flags": { + "collapsed": true + }, + "order": 41, + "mode": 0, + "inputs": [ + { + "name": "image", + "type": "IMAGE", + "link": 179 + } + ], + "outputs": [ + { + "name": "width", + "type": "INT", + "links": [ + 182 + ], + "shape": 3, + "slot_index": 0 + }, + { + "name": "height", + "type": "INT", + "links": [ + 183 + ], + "shape": 3, + "slot_index": 1 + } + ], + "properties": { + "Node name for S&R": "GetImageSize+" + } + }, + { + "id": 92, + "type": "ResizeMask", + "pos": [ + 1565, + 953 + ], + "size": [ + 229.97858398437438, + 108.4678759765618 + ], + "flags": {}, + "order": 44, + "mode": 0, + "inputs": [ + { + "name": "mask", + "type": "MASK", + "link": 176 + }, + { + "name": "width", + "type": "INT", + "link": 182, + "widget": { + "name": "width" + } + }, + { + "name": "height", + "type": "INT", + "link": 183, + "widget": { + "name": "height" + } + } + ], + "outputs": [ + { + "name": "mask", + "type": "MASK", + "links": [ + 184, + 185 + ], + "shape": 3, + "slot_index": 0 + }, + { + "name": "width", + "type": "INT", + "links": null, + "shape": 3 + }, + { + "name": "height", + "type": "INT", + "links": null, + "shape": 3 + } + ], + "properties": { + "Node name for S&R": "ResizeMask" + }, + "widgets_values": [ + 512, + 512, + false + ] + }, + { + "id": 44, + "type": "PreviewImage", + "pos": [ + 4540.507189436807, + 640.2549694393354 + ], + "size": [ + 996.5626543131903, + 513.6630652286324 + ], + "flags": {}, + "order": 63, + "mode": 0, + "inputs": [ + { + "name": "images", + "type": "IMAGE", + "link": 80 + } + ], + "properties": { + "Node name for S&R": "PreviewImage" + } + }, + { + "id": 40, + "type": "ImageCrop+", + "pos": [ + 3590.507189436806, + 450.25496943933535 + ], + "size": { + "0": 315, + "1": 194 + }, + "flags": {}, + "order": 58, + "mode": 0, + "inputs": [ + { + "name": "image", + "type": "IMAGE", + "link": 74 + } + ], + "outputs": [ + { + "name": "IMAGE", + "type": "IMAGE", + "links": [ + 82, + 89 + ], + "shape": 3, + "slot_index": 0 + }, + { + "name": "x", + "type": "INT", + "links": null, + "shape": 3 + }, + { + "name": "y", + "type": "INT", + "links": null, + "shape": 3 + } + ], + "properties": { + "Node name for S&R": "ImageCrop+" + }, + "widgets_values": [ + 504, + 504, + "center", + 0, + 0 + ] + } + ], + "links": [ + [ + 16, + 9, + 0, + 10, + 0, + "LATENT" + ], + [ + 23, + 15, + 0, + 16, + 0, + "MASK" + ], + [ + 29, + 12, + 0, + 18, + 1, + "CONDITIONING" + ], + [ + 38, + 21, + 0, + 20, + 0, + "INT,FLOAT" + ], + [ + 40, + 21, + 0, + 15, + 0, + "INT" + ], + [ + 41, + 20, + 0, + 15, + 2, + "INT" + ], + [ + 42, + 22, + 0, + 23, + 0, + "INT,FLOAT" + ], + [ + 43, + 23, + 0, + 15, + 3, + "INT" + ], + [ + 46, + 22, + 0, + 15, + 1, + "INT" + ], + [ + 49, + 18, + 2, + 26, + 0, + "LATENT" + ], + [ + 51, + 26, + 0, + 27, + 0, + "LATENT" + ], + [ + 52, + 27, + 0, + 9, + 3, + "LATENT" + ], + [ + 53, + 18, + 0, + 28, + 0, + "CONDITIONING" + ], + [ + 54, + 18, + 1, + 28, + 1, + "CONDITIONING" + ], + [ + 55, + 28, + 0, + 9, + 1, + "CONDITIONING" + ], + [ + 56, + 28, + 1, + 9, + 2, + "CONDITIONING" + ], + [ + 57, + 29, + 0, + 28, + 2, + "CONTROL_NET" + ], + [ + 65, + 19, + 0, + 9, + 0, + "MODEL" + ], + [ + 71, + 10, + 0, + 39, + 0, + "IMAGE" + ], + [ + 74, + 10, + 0, + 40, + 0, + "IMAGE" + ], + [ + 76, + 25, + 0, + 18, + 0, + "CONDITIONING" + ], + [ + 80, + 42, + 1, + 44, + 0, + "IMAGE" + ], + [ + 82, + 40, + 0, + 45, + 0, + "IMAGE" + ], + [ + 83, + 45, + 0, + 42, + 0, + "IMAGE" + ], + [ + 89, + 40, + 0, + 47, + 0, + "IMAGE" + ], + [ + 99, + 2, + 0, + 53, + 0, + "MODEL" + ], + [ + 100, + 2, + 1, + 54, + 0, + "CLIP" + ], + [ + 101, + 2, + 2, + 52, + 0, + "VAE" + ], + [ + 102, + 55, + 0, + 3, + 1, + "VAE" + ], + [ + 103, + 56, + 0, + 10, + 1, + "VAE" + ], + [ + 104, + 57, + 0, + 18, + 2, + "VAE" + ], + [ + 105, + 58, + 0, + 25, + 0, + "CLIP" + ], + [ + 106, + 58, + 0, + 12, + 0, + "CLIP" + ], + [ + 107, + 59, + 0, + 25, + 1, + "STRING" + ], + [ + 109, + 59, + 0, + 4, + 1, + "STRING" + ], + [ + 111, + 61, + 0, + 14, + 0, + "MODEL" + ], + [ + 112, + 14, + 0, + 19, + 0, + "MODEL" + ], + [ + 114, + 62, + 0, + 15, + 4, + "INT" + ], + [ + 115, + 63, + 0, + 15, + 5, + "INT" + ], + [ + 116, + 64, + 0, + 4, + 0, + "CLIP" + ], + [ + 117, + 64, + 0, + 5, + 0, + "CLIP" + ], + [ + 118, + 65, + 0, + 26, + 1, + "INT" + ], + [ + 119, + 65, + 0, + 25, + 2, + "INT" + ], + [ + 121, + 66, + 0, + 67, + 0, + "GEOWIZMODEL" + ], + [ + 126, + 71, + 0, + 66, + 0, + "VAE" + ], + [ + 130, + 74, + 0, + 73, + 1, + "IMAGE" + ], + [ + 131, + 67, + 0, + 73, + 0, + "IMAGE" + ], + [ + 132, + 73, + 0, + 75, + 0, + "IMAGE" + ], + [ + 134, + 73, + 0, + 28, + 3, + "IMAGE" + ], + [ + 135, + 15, + 0, + 76, + 0, + "*" + ], + [ + 137, + 76, + 0, + 18, + 4, + "MASK" + ], + [ + 143, + 60, + 0, + 78, + 0, + "MODEL" + ], + [ + 144, + 4, + 0, + 78, + 1, + "CONDITIONING" + ], + [ + 145, + 5, + 0, + 78, + 2, + "CONDITIONING" + ], + [ + 146, + 6, + 0, + 78, + 3, + "LATENT" + ], + [ + 147, + 78, + 0, + 3, + 0, + "LATENT" + ], + [ + 153, + 60, + 0, + 80, + 0, + "MODEL" + ], + [ + 157, + 80, + 0, + 81, + 0, + "LATENT" + ], + [ + 158, + 55, + 0, + 81, + 1, + "VAE" + ], + [ + 159, + 81, + 0, + 82, + 0, + "IMAGE" + ], + [ + 162, + 85, + 0, + 84, + 0, + "UPSCALE_MODEL" + ], + [ + 163, + 3, + 0, + 84, + 1, + "IMAGE" + ], + [ + 164, + 84, + 0, + 86, + 0, + "IMAGE" + ], + [ + 165, + 86, + 0, + 87, + 0, + "IMAGE" + ], + [ + 166, + 55, + 0, + 87, + 1, + "VAE" + ], + [ + 167, + 87, + 0, + 80, + 3, + "LATENT" + ], + [ + 168, + 81, + 0, + 18, + 3, + "IMAGE" + ], + [ + 169, + 42, + 0, + 88, + 0, + "IMAGE" + ], + [ + 170, + 5, + 0, + 89, + 0, + "*" + ], + [ + 171, + 89, + 0, + 80, + 2, + "CONDITIONING" + ], + [ + 172, + 90, + 0, + 80, + 1, + "CONDITIONING" + ], + [ + 173, + 4, + 0, + 90, + 0, + "*" + ], + [ + 174, + 3, + 0, + 91, + 0, + "IMAGE" + ], + [ + 176, + 15, + 0, + 92, + 0, + "MASK" + ], + [ + 178, + 3, + 0, + 95, + 0, + "*" + ], + [ + 179, + 95, + 0, + 93, + 0, + "IMAGE" + ], + [ + 180, + 95, + 0, + 67, + 1, + "IMAGE" + ], + [ + 182, + 93, + 0, + 92, + 1, + "INT" + ], + [ + 183, + 93, + 1, + 92, + 2, + "INT" + ], + [ + 184, + 92, + 0, + 73, + 2, + "MASK" + ], + [ + 185, + 92, + 0, + 74, + 0, + "MASK" + ] + ], + "groups": [ + { + "title": "BaseImageGen", + "bounding": [ + 212, + -574, + 3106, + 1146 + ], + "color": "#3f789e", + "font_size": 24, + "locked": false + }, + { + "title": "Crop and unwrap", + "bounding": [ + 3362, + 233, + 2238, + 971 + ], + "color": "#3f789e", + "font_size": 24, + "locked": false + }, + { + "title": "Inpaint", + "bounding": [ + 1002, + 1282, + 4615, + 1402 + ], + "color": "#3f789e", + "font_size": 24, + "locked": false + }, + { + "title": "Mask", + "bounding": [ + 74, + 693, + 832, + 822 + ], + "color": "#3f789e", + "font_size": 24, + "locked": false + }, + { + "title": "Depth predict", + "bounding": [ + 1146, + 634, + 2039, + 615 + ], + "color": "#3f789e", + "font_size": 24, + "locked": false + } + ], + "config": {}, + "extra": {}, + "version": 0.4 +} \ No newline at end of file diff --git a/nodes.py b/nodes.py new file mode 100644 index 0000000..5672e9f --- /dev/null +++ b/nodes.py @@ -0,0 +1,153 @@ +import torch +import numpy as np +import torch +import torch.nn.functional as F +from .relighting.tonemapper import TonemapHDR + +def create_envmap_grid(size: int): + """ + BLENDER CONVENSION + Create the grid of environment map that contain the position in sperical coordinate + Top left is (0,0) and bottom right is (pi/2, 2pi) + """ + theta = torch.linspace(0, np.pi * 2, size * 2) + phi = torch.linspace(0, np.pi, size) + + #use indexing 'xy' torch match vision's homework 3 + theta, phi = torch.meshgrid(theta, phi ,indexing='xy') + + theta_phi = torch.cat([theta[..., None], phi[..., None]], dim=-1) + theta_phi = theta_phi.numpy() + return theta_phi + +def get_normal_vector(incoming_vector: np.ndarray, reflect_vector: np.ndarray): + """ + BLENDER CONVENSION + incoming_vector: the vector from the point to the camera + reflect_vector: the vector from the point to the light source + """ + #N = 2(R ⋅ I)R - I + N = (incoming_vector + reflect_vector) / np.linalg.norm(incoming_vector + reflect_vector, axis=-1, keepdims=True) + return N + +def get_cartesian_from_spherical(theta: np.array, phi: np.array, r = 1.0): + """ + BLENDER CONVENSION + theta: vertical angle + phi: horizontal angle + r: radius + """ + x = r * np.sin(theta) * np.cos(phi) + y = r * np.sin(theta) * np.sin(phi) + z = r * np.cos(theta) + return np.concatenate([x[...,None],y[...,None],z[...,None]], axis=-1) + +class chrome_ball_to_envmap: + @classmethod + def INPUT_TYPES(s): + return { + "required": { + "ball_images": ("IMAGE", ), + "envmap_height": ("INT", {"default": 256, "min": 1, "max": 2048, "step": 1}, ), + "scale": ("INT", {"default": 4, "min": 1, "max": 30, "step": 1}, ), + }, + } + + CATEGORY = "DiffusionLight" + RETURN_TYPES = ("IMAGE",) + RETURN_NAMES = ("image", ) + + FUNCTION = "process" + + + def process(self, ball_images, envmap_height, scale): + I = np.array([1, 0, 0]) + + # compute normal map that create from reflect vector + env_grid = create_envmap_grid(envmap_height * scale) + reflect_vec = get_cartesian_from_spherical(env_grid[...,1], env_grid[...,0]) + normal = get_normal_vector(I[None,None], reflect_vec) + + # turn from normal map to position to lookup [Range: 0,1] + pos = (normal + 1.0) / 2 + pos = 1.0 - pos + pos = pos[...,1:] + + env_map = None + # convert position to pytorch grid look up + grid = torch.from_numpy(pos)[None].float() + grid = grid * 2 - 1 # convert to range [-1,1] + print(grid.shape) + ball_images = ball_images.permute(0,3,1,2) # [1,3,H,W] + + env_maps_list = [] + for ball in ball_images: + env_map = F.grid_sample(ball.unsqueeze(0), grid, mode='bilinear', padding_mode='border', align_corners=True) + env_map_default = F.interpolate(env_map, size=(envmap_height, envmap_height*2), mode='bilinear', align_corners=True) + env_map_default = env_map_default.permute(0,2,3,1).cpu().to(torch.float32) + env_maps_list.append(env_map_default) + env_maps_out = torch.cat(env_maps_list, dim=0) + + + + return env_maps_out, + +class exposure_to_hdr: + @classmethod + def INPUT_TYPES(s): + return { + "required": { + "images": ("IMAGE", ), + #"EV": ("FLOAT", {"default": 0, "min": 1, "max": 30, "step": 1}, ), + "gamma": ("FLOAT", {"default": 2.4, "min": 1, "max": 30, "step": 0.01}, ), + }, + } + + CATEGORY = "DiffusionLight" + RETURN_TYPES = ("IMAGE", "IMAGE",) + RETURN_NAMES = ("hrd_image", "ldr_image", ) + + FUNCTION = "exposuretohdr" + + def exposuretohdr(self, images, gamma): + first_image = torch.pow(images[0], gamma) + evs = [0.0, -2.5, -5.0] + hdr2ldr = TonemapHDR(gamma=gamma, percentile=99, max_mapping=0.9) + scaler = torch.tensor([0.212671, 0.715160, 0.072169]) + + # read luminace for every image + luminances = [] + for i in range(len(evs)): + linear_img = torch.pow(images[i], gamma) + linear_img = linear_img * 1 / (2** evs[i]) + # compute luminace + lumi = linear_img @ scaler + luminances.append(lumi) + + # start from darkest image + out_luminace = luminances[len(evs) - 1] + for i in range(len(evs) - 1, 0, -1): + # compute mask + maxval = 1 / (2 ** evs[i-1]) + p1 = torch.clip((luminances[i-1] - 0.9 * maxval) / (0.1 * maxval), 0, 1) + p2 = out_luminace > luminances[i-1] + mask = (p1 * p2) + out_luminace = luminances[i-1] * (1-mask) + out_luminace * mask + + hdr_rgb = first_image * (out_luminace / (luminances[0] + 1e-10)).unsqueeze(-1) + ldr_rgb, _, _ = hdr2ldr(hdr_rgb) + + hrd_rgb = hdr_rgb.unsqueeze(0).cpu().to(torch.float32) + ldr_rgb = ldr_rgb.unsqueeze(0).cpu().to(torch.float32) + + return (hrd_rgb, ldr_rgb,) + +NODE_CLASS_MAPPINGS = { + "chrome_ball_to_envmap": chrome_ball_to_envmap, + "exposure_to_hdr": exposure_to_hdr, +} + +NODE_DISPLAY_NAME_MAPPINGS = { + "chrome_ball_to_envmap": "Chrome Ball to Envmap", + "exposure_to_hdr": "Exposure to HDR", +} diff --git a/relighting/tonemapper.py b/relighting/tonemapper.py new file mode 100644 index 0000000..2151b2e --- /dev/null +++ b/relighting/tonemapper.py @@ -0,0 +1,37 @@ +import numpy as np + +import torch + +class TonemapHDR(object): + """ + Tonemap HDR image globally. First, we find alpha that maps the (max(tensor_img) * percentile) to max_mapping. + Then, we calculate I_out = alpha * I_in ^ (1/gamma) + input : torch.Tensor batch of images : [H, W, C] + output : torch.Tensor batch of images : [H, W, C] + """ + + def __init__(self, gamma=2.4, percentile=50, max_mapping=0.5): + self.gamma = gamma + self.percentile = percentile + self.max_mapping = max_mapping # the value to which alpha will map the (max(tensor_img) * percentile) to + + def __call__(self, tensor_img, clip=True, alpha=None, gamma=True): + if gamma: + power_tensor_img = torch.pow(tensor_img, 1 / self.gamma) + else: + power_tensor_img = tensor_img + non_zero = power_tensor_img > 0 + if non_zero.any(): + r_percentile = torch.quantile(power_tensor_img[non_zero], self.percentile / 100.0) + else: + r_percentile = torch.quantile(power_tensor_img, self.percentile / 100.0) + if alpha is None: + alpha = self.max_mapping / (r_percentile + 1e-10) + tonemapped_img = alpha * power_tensor_img + + if clip: + tonemapped_img_clip = torch.clamp(tonemapped_img, 0, 1) + else: + tonemapped_img_clip = tonemapped_img + + return tonemapped_img_clip.float(), alpha, tonemapped_img \ No newline at end of file