ComfyUI > Nodes > ComfyUI-IC-Light > Calculate Normals From Images

ComfyUI Node: Calculate Normals From Images

Class Name

CalculateNormalsFromImages

Category
IC-Light
Author
kijai (Account age: 2181days)
Extension
ComfyUI-IC-Light
Latest Updated
2024-06-19
Github Stars
0.39K

How to Install ComfyUI-IC-Light

Install this extension via the ComfyUI Manager by searching for ComfyUI-IC-Light
  • 1. Click the Manager button in the main menu
  • 2. Select Custom Nodes Manager button
  • 3. Enter ComfyUI-IC-Light in the search bar
After installation, click the Restart button to restart ComfyUI. Then, manually refresh your browser to clear the cache and access the updated list of nodes.

Visit ComfyUI Online for ready-to-use ComfyUI environment

  • Free trial available
  • High-speed GPU machines
  • 200+ preloaded models/nodes
  • Freedom to upload custom models/nodes
  • 50+ ready-to-run workflows
  • 100% private workspace with up to 200GB storage
  • Dedicated Support

Run ComfyUI Online

Calculate Normals From Images Description

Generate normal maps from directional exposure images to enhance textures and lighting for 3D/2D models.

Calculate Normals From Images:

The CalculateNormalsFromImages node is designed to generate normal maps from a set of images taken from different directional exposures. This node is particularly useful for AI artists who need to create detailed and realistic textures for 3D models or enhance the depth and lighting of 2D images. By processing four images representing different light directions (left, right, bottom, and top), the node calculates the normal map, which can be used to simulate how light interacts with the surface of an object. This process helps in creating more dynamic and visually appealing images by adding depth and realism.

Calculate Normals From Images Input Parameters:

images

This parameter expects a batch of four images representing different directional exposures: left, right, bottom, and top. These images are used to calculate the normal map. The images should be in the format of a 4D tensor with dimensions (B, H, W, C), where B is the batch size, H is the height, W is the width, and C is the number of color channels.

sigma

This is a floating-point parameter that controls the sharpness of the normal map. A higher sigma value results in a smoother normal map, while a lower value produces a sharper map. The default value is 10.0, with a minimum of 0.01 and a maximum of 100.0. Adjusting this value can help in fine-tuning the appearance of the normal map to match the desired level of detail.

center_input_range

This boolean parameter determines whether the input image range should be centered. If set to True, the images are scaled to a range of [0, 1]. The default value is False. Centering the input range can help in normalizing the images, which may lead to more consistent results in the normal map calculation.

mask (optional)

This optional parameter allows you to provide a mask that can be used to influence the normal map calculation. The mask should have the same spatial dimensions as the input images. If provided, the mask is used to blend the normal map with a default normal vector, which can help in preserving certain areas of the image. If not provided, the normal map is calculated without any masking.

Calculate Normals From Images Output Parameters:

normal

This output parameter provides the calculated normal map as an image. The normal map is a 3D tensor with dimensions (H, W, 3), where H is the height, W is the width, and 3 represents the three color channels corresponding to the x, y, and z components of the normal vectors. This map can be used to simulate lighting and shading effects in 3D rendering or image processing applications.

divided

This output parameter provides an image that represents the divided directional exposures. It is a 4D tensor with dimensions (4, H, W, 3), where 4 corresponds to the four directional exposures (left, right, bottom, top), H is the height, W is the width, and 3 represents the color channels. This output can be useful for debugging or further processing of the individual directional exposures.

Calculate Normals From Images Usage Tips:

  • Ensure that the input images are correctly aligned and represent the intended directional exposures (left, right, bottom, top) to achieve accurate normal map calculations.
  • Experiment with the sigma parameter to find the optimal sharpness for your normal map. Higher values will produce smoother results, while lower values will enhance details.
  • Use the center_input_range parameter to normalize your input images if they are not already in the [0, 1] range. This can help in achieving more consistent results.
  • If you have specific areas in the image that you want to preserve or influence, provide a mask to blend the normal map accordingly.

Calculate Normals From Images Common Errors and Solutions:

Invalid operation for morphology

  • Explanation: This error occurs when an invalid operation is specified for the morphology process.
  • Solution: Ensure that the operation parameter is set to one of the valid options: 'erode', 'dilate', 'open', 'close', 'gradient', 'top_hat', 'bottom_hat'.

Mask shape mismatch

  • Explanation: This error occurs when the provided mask does not match the spatial dimensions of the input images.
  • Solution: Ensure that the mask has the same height and width as the input images. You can use interpolation to resize the mask if necessary.

Batch size not divisible by 4

  • Explanation: This error occurs when the batch size of the input images is not divisible by 4. - Solution: Ensure that the batch size of your input images is a multiple of 4, as the node expects four directional exposures for each normal map calculation.

Division by zero in safe_divide

  • Explanation: This error occurs when there is a division by zero in the safe_divide function.
  • Solution: Ensure that the input images are not completely black or white, as this can lead to division by zero. Adjust the input images to have a range of pixel values.

Calculate Normals From Images Related Nodes

Go back to the extension to check out more related nodes.
ComfyUI-IC-Light
RunComfy

© Copyright 2024 RunComfy. All Rights Reserved.

RunComfy is the premier ComfyUI platform, offering ComfyUI online environment and services, along with ComfyUI workflows featuring stunning visuals.