---
title: Depth2Img
description: "Depth2Img is a fantastic mode that takes an RGB color pass + a Depth pass as an input to condition the image generation, allowing for a lot more control. Compared to ControlNet, Depth2Img **takes the lighting into account a lot…"
url: "https://elasticmonkeys.com/docs/depth2img/"
updated: "2023-04-26"
category: Mandala
---

# Depth2Img

Depth2Img is a fantastic mode that takes an RGB color pass + a Depth pass as an input to condition the image generation, allowing for a lot more control. Compared to ControlNet, Depth2Img **takes the lighting into account a lot mor**e, which is quite amazing. But, it is a bit less flexible in terms of what models you can choose.

## Example

| ![](https://elasticmonkeys.com/wp-content/uploads/2023/04/mdla_ok.png) Open Maya's content browser and drag the **space marine rifle**into the scene. Assign a quick metallic shader to it (no need to get into details) and create a light. Depth2Img needs a proper color pass to work, because unlike controlNet it takes into account the lighting. ![](https://elasticmonkeys.com/wp-content/uploads/2023/04/image-49-1024x865.png) |
| --- |
| ![](https://elasticmonkeys.com/wp-content/uploads/2023/04/mdla_ok.png) Make a nice framing with Maya's default camera. ![](https://elasticmonkeys.com/wp-content/uploads/2023/04/image-50-1024x576.png) |
| ![](https://elasticmonkeys.com/wp-content/uploads/2023/04/mdla_ok.png) Now, open the **image generation** tab in Mandala's UI and pick "depth2img" in the combo box. Set the resolution to 1920x1080 and set the **upscaler** to RealESRGAN. Also set the **strength** to 0.8. With less than that, Stable Diffusion might take too much input from the color pass. We want it to be a bit more creative. ![](https://elasticmonkeys.com/wp-content/uploads/2023/04/image-51.png) |
| ![](https://elasticmonkeys.com/wp-content/uploads/2023/04/mdla_ok.png) Type this prompt in the prompt editor: `a space marine rifle, realistic, sci-fi, textured, warhammer 40000, star wars, octane render 4k, HDRI reflections, shiny metal, beveled edges, army camouflage` |
| ![](https://elasticmonkeys.com/wp-content/uploads/2023/04/mdla_ok.png) Finally, click on ![](https://elasticmonkeys.com/wp-content/uploads/2023/04/mdla_autoDepth.png)**auto-depth** in the UI. |
| ![](https://elasticmonkeys.com/wp-content/uploads/2023/04/mdla_ok.png) Hit ![](https://elasticmonkeys.com/wp-content/uploads/2023/04/mdla_render-1.png)**render**. After a while, an image appears. ![](https://elasticmonkeys.com/wp-content/uploads/2023/04/image-52-1024x574.png) |
| ![](https://elasticmonkeys.com/wp-content/uploads/2023/04/mdla_ok.png) That's okay, but it's missing some sort of rim lighting. Let's add a blue backlight in the scene, and re-render. ![](https://elasticmonkeys.com/wp-content/uploads/2023/04/image-53-1024x575.png) |
| ![](https://elasticmonkeys.com/wp-content/uploads/2023/04/mdla_ok.png) Of course this is just a start, it would look better with basic textures and colors in the input. The point is, Depth2Img takes lighting into account! |

## Parameters

| ![](https://elasticmonkeys.com/wp-content/uploads/2023/04/mdla_ok.png) **depth2imgModelName**: The depth2img checkpoint to use. |
| --- |
| ![](https://elasticmonkeys.com/wp-content/uploads/2023/04/mdla_ok.png) **strength**: The strength of the effect. Generally, values above 0.9 work the best. |
| ![](https://elasticmonkeys.com/wp-content/uploads/2023/04/mdla_ok.png) **minDepth**: The minimum depth when converting the depth data to grayscale. You can compute these automatically using the 'auto-depth' button in the UI. Note that the algorithm will take the camera frustum into account and only calculate depth based on the visible mesh points! |
| ![](https://elasticmonkeys.com/wp-content/uploads/2023/04/mdla_ok.png) **maxDepth**: The maximum depth when converting the depth data to grayscale. You can compute these automatically using 'auto-depth' in the UI. |

For the other parameters, refer to the [diffusion page](https://elasticmonkeys.com/docs/diffusion/).
