10.014 CTD
  • Overview
  • Schedule
  • Administrative
    • Accessing Rhino remotely
    • Rhino for Mac
  • ASSIGNMENTS
    • Dates and rubrics
    • Generative design
      • Generative design
    • Parametric design
      • Parametric design
    • Simulated design
      • Simulated design
      • Simulated design
  • SESSION 1B
    • Computer Aided Design
    • Ranges and expressions 1
      • Ranges and expressions 2
      • Ranges and expressions 3
      • Ranges and expressions 4
      • Ranges and expressions 5
      • Ranges and expressions 6
  • SESSION 2A
    • Visual programming 1
      • Visual programming 2
      • Visual programming 3
      • Visual programming 4
    • Associative modelling 1
      • Associative modelling 2
      • Associative modelling 3
  • SESSION 2B
    • Logical Patterns 1
      • Logical patterns 2
      • Logical patterns 3
  • SESSION 3A
    • Spatial geometry 1
      • Spatial geometry 2
      • Spatial geometry 3
      • Spatial geometry 4
      • Spatial geometry 5
      • Spatial geometry 6
      • Spatial geometry 7
    • Curve geometry 1
      • Curve geometry 2
      • Curve geometry 3
      • Curve geometry 4
  • SESSION 3B
    • Surface geometry
    • Parametric modelling 1
      • Parametric modelling 2
      • Parametric modelling 3
      • Parametric modelling 4
  • SESSION 4A
    • Information nesting 1
      • Information nesting 2
      • Information nesting 3
    • Data landscapes 1
      • Data landscapes 2
      • Data Landscapes 3
      • Data landscapes 4
  • SESSION 4B
    • Mesh geometry 1
      • Mesh geometry 2
      • Mesh geometry 3
  • SESSION 5A
    • Space and time 1
      • Space and time 2
    • Modelling entities 1
      • Modelling entities 2
      • Modelling entities 3
  • SESSION 5B
    • Multibody dynamics 1
      • Multibody dynamics 2
    • Material elasticity 1
      • Material elasticity 2
      • Material elasticity 3
  • SESSION 6A
    • Form-finding 1
      • Form-finding 2
      • Form-finding 3
      • Form-finding 4
  • SESSION 6B
    • AI Image generation 1
      • AI Image generation 2
      • AI Image generation 3
  • APPENDIX
    • Spirograph 1
      • Spirograph 2
    • Curves
    • Swarm Intelligence 1
      • Swarm Intelligence 2
    • Hybrid programming 1
      • Hybrid programming 2
Powered by GitBook
On this page
  • Image to image workflow
  • Adjusting the results
  1. SESSION 6B
  2. AI Image generation 1

AI Image generation 2

Diffusion models

PreviousAI Image generation 1NextAI Image generation 3

Last updated 7 months ago

Image to image workflow

To exert more control over the intended output, we can use image prompts in conjunction with textual ones. In this approach, we first create an image that functions as a low-fidelity description of the intended outcome.

Rhino/Grasshopper

We return to Rhino/Grasshopper and run one of the earlier form-finding definitions e.g. minimal surface. Bake the result from Grasshopper (you may have to do it from inside the cluster). Thereafter, use the command 'ViewCaptureToFile" command to save the image. Customise its size and set it to to 512 x 512 pixels. We will use this image as our prompt later.

Use 'DisplayProperties' command to open the Display panel and adjust the settings there to customise the how the baked mesh is displayed.

Image to image

Switch to the img2img tab in webui. We will enter a text prompt as usual, but at the same time drag our saved image into the Generation >img2img tab to act as an image prompt. Scrolling down, we find a new slider below CFG scale called Denoising strength. This value determines how much of the input image to preserve, with higher numbers causing more change and lower values leaving the original intact. As seen in the batch images below, we are now able to achieve results that resemble the reference instead of arbitrary dome-shaped, curved or tent structure like before.

Practice

  • Experiment with adjusting the relative values of CFG and denoising strength. What do you observe if you made one value high and the other low?

  • Use script

Adjusting the results

Since our intended output is a building/structure, we may use more specialised AI models than the general stable-diffusion v1 models. For example, you may search for "architecturerealmix" on Hugging Face. Click on the option " clone repository" and copy the command

git clone https://huggingface.co/stablediffusionapi/architecturerealmix

Using git like earlier, clone the repository to a local folder.

Once the local repository is created, move the architecturerealmix safetensor file to your local \stable-diffusion-webui\models\Stable-diffusion subfolder. Afterwards, you will have the option of choosing the "architecturerealmix" model in webui. Since it is trained on a dataset of architecture related images, the model produces more realistic looking results with building elements like railings, panelling and mullions.

Fine-tuning the results

To improve the results even further, we can select a best image from a batch, for example the bottom right one from the table above, as the next image prompt. Use the picture-frame icon (circled in red below) to send the image and generation parameters back to the img2img tab. Repeating the selection-generation process leads to 'fitter' results in an evolutionary sense as images more closely match your intentions and aesthetic preferences.

The results look compelling so far, but it appears that the AI model has mistakenly generated a tiled boulevard rather than naturalistic rocky landscape in the foreground. We can make use of inpainting to fix this region of the image. Click on the painting icon to send an image to the "Inpaint" tab. At the top right of the tab, click on the brush icon, and use the slider to specify its size. Thereafter, paint the foreground of the image which we wish to change. This creates a mask, which is represented as a semi-transparent white region.

The parts of the image outside the white region will be conserved. You may leave the default inpaint parameters unchanged for a start. However, we should edit the text prompt now, because it applies only to the mask region. For example, we may change it to:

Astronauts with helmets walking around red rocky ground, cinematic lighting with red hue, sci-fi realistic

Practice

  • There are 4 mask options -fill, original, latent noise and latent nothing. Try the different options and observe the results.

  • Try adjusting the "Mask blur" slider values, what effect does this have?

  • Try resizing your favourite image. Place it in the img2img tab and make sure you use the same seed. Select the "Resize by" tab to scale the image up uniformly. Should you specify a high or low Denoise strength value?

  • Original mask option feeds the original cropped portion directly to SD for use with your prompt and other settings. Latent noise replaces the masked section with true noise that then gets used to generate a new image

  • Mask blur sometimes helps merge the inpainting and the unchanged part around it.

  • Use a low denoise strength e.g. 0.3 since we only want to upscale the image not change it.

Alternatively, if the architecturerealmix safetensors file cannot be found in the repository, use this alternative

civitai link
Example results
Find the repository on Hugging Face
Using the architecturerealmix model
Send the image and generation parameters
Inpaint tab
Resized final image