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

Add Project Dream Texture operator #409

Merged
merged 56 commits into from
Dec 14, 2022
Merged

Add Project Dream Texture operator #409

merged 56 commits into from
Dec 14, 2022

Conversation

carson-katri
Copy link
Owner

This uses depth to image to project a texture onto a mesh using a text prompt.

@carson-katri carson-katri added this to the v0.0.9 milestone Dec 5, 2022
@carson-katri
Copy link
Owner Author

@Ryztiq Should be git checkout sd-depth-projection

@dddjef
Copy link

dddjef commented Dec 11, 2022

seems incredible!
is it compatible with 3.4? I've got "context is incorrect" error when I try to run "Project Dream Texture"

@carson-katri
Copy link
Owner Author

@dddjef Make sure you enter edit mode and select all of the faces you want the texture to be applied to.

@carson-katri
Copy link
Owner Author

I've added model type inference. It checks how many in_channels are specified in the U-Net config to guess what kind of model it is. This can be used to show hints before the user loads the wrong model that they need to switch to a depth-specific one or otherwise.

Screenshot 2022-12-11 at 3 58 41 PM

@dddjef
Copy link

dddjef commented Dec 11, 2022

Tx, I don't have this error anymore, but it still doesn't work. Console shows

WARN (bpy.rna): C:\Users\blender\git\blender-v340\blender.git\source\blender\python\intern\bpy_rna.c:1341 pyrna_enum_to_py: current value '2' matches no enum in 'DreamPrompt', '', 'pipeline'
Traceback (most recent call last):
  File "C:\Users\dddje\AppData\Roaming\Blender Foundation\Blender\3.4\scripts\addons\dream_textures\operators\project.py", line 98, in draw
    row.enabled = Pipeline[context.scene.dream_textures_project_prompt.pipeline].depth()
  File "C:\Program Files\Blender Foundation\Blender 3.4\3.4\python\lib\enum.py", line 440, in __getitem__
    return cls._member_map_[name]
KeyError: ''

Not sure to install this correctly anyway. I've downloaded the big 7zip file from default dream texture repo. I unzip and install it, it works correctly. Then I set pycharm to the installed addon folder, and checkout your branch. All seems fine, I see your change, and the interface you added to the 3D view. Is is the right way to do it?
PS : I don't have the model package list in the addon preferences anymore

@carson-katri
Copy link
Owner Author

@dddjef you would need to reinstall the dependencies in the .python_dependencies folder. In #405 everything was switched over to diffusers and new dependencies were added/removed.

@FabianRueckert
Copy link

Using the latest commit, Blender doesn't find anything when I search for carsonkatri/stable-diffusion-2-depth-diffusers in the find model search box.
And the one from stabilityai directly doesn't work
image

@carson-katri
Copy link
Owner Author

@FabianRueckert thanks for giving it a try. Can you open the folder for that depth model and check the snapshots/…/unet/config.json file and see how many in_channels it has? It should be 5…
If so you could ignore the warning it should hypothetically work anyways. I’m not sure why my converted model doesn’t show in search.

@FabianRueckert
Copy link

FabianRueckert commented Dec 13, 2022

@carson-katri Ok I got it to work. I think the reason for the error above was, that the model wasn't fully downloaded due to a choppy connection, but the script thought it had been. Some files were missing. Deleting the folder and redownloading worked.

Copy link
Collaborator

@NullSenseStudio NullSenseStudio left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@carson-katri carson-katri merged commit f352cca into main Dec 14, 2022
JasonHoku pushed a commit to JasonHoku/dream-textures that referenced this pull request Dec 20, 2022
* Initial diffusers backend scaffolding

* Support scheduler selection

* Add more schedulers

* Add ocio_transform action

* Support seamless generation

* Support cancellation

* Remove old intents, upscaling, actor improvements

* Add tiling to stable diffusion upscaler

* Add image_to_image and inpaint

* Update render_pass.py

* fix activating when diffusers is not installed

* load dependencies sooner

* re-add other platform requirements

* fix can_use() and cancel/stop operators

* fix non-square images

* First attempt at depth to image

* Update optimization options

* Add proper file naming

* Fix data block removal error

* Add upscale tile blending with the 'tiler'

* Add 'tiler' to other requirements files

* Add upscale naming

* Add progress bar

* Add progress bar to upscaling

* Fix image2image

* Fix inpaint

* Raise the error in the exception_callback

* Pipeline switching

* fix upscale

* no_grad already used in pipe

* Re-use the same datablock

* update workflow requirements

* Fix clamping

* Support using color and depth together

* Handle multiple material slots

* Add pipeline/model selection

* Only set material on selected faces

* Add model_type

* Add progress bar

* Add scaling option

* Use specified size

* Remove project scale

* Add 'Use Depth' for source image

* Extend source image depth options

* Return image of specified size, and use custom projection method

* Normalize ignoring 0

* Support seamless

* Fix depth image loading

* Enable depth input for render pass

Co-authored-by: NullSenseStudio <47096043+NullSenseStudio@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

8 participants