ComfyUI  >  Nodes  >  comfyUI_TJ_NormalLighting

ComfyUI Extension: comfyUI_TJ_NormalLighting

Repo Name

comfyUI_TJ_NormalLighting

Author
TJ16th (Account age: 2533 days)
Nodes
View all nodes (1)
Latest Updated
5/23/2024
Github Stars
0.1K

How to Install comfyUI_TJ_NormalLighting

Install this extension via the ComfyUI Manager by searching for  comfyUI_TJ_NormalLighting
  • 1. Click the Manager button in the main menu
  • 2. Select Custom Nodes Manager button
  • 3. Enter comfyUI_TJ_NormalLighting 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 Cloud 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

comfyUI_TJ_NormalLighting Description

comfyUI_TJ_NormalLighting is a custom node for comfyUI that utilizes normal maps to apply virtual lighting effects to images, enhancing visual depth and realism.

comfyUI_TJ_NormalLighting Introduction

Welcome to comfyUI_TJ_NormalLighting, an innovative extension designed to enhance your images with virtual lighting effects using normal maps. This extension is particularly useful for AI artists who want to add realistic lighting to their digital artwork without needing extensive technical knowledge. By leveraging normal maps, you can simulate how light interacts with surfaces, creating more dynamic and visually appealing images.

How comfyUI_TJ_NormalLighting Works

At its core, comfyUI_TJ_NormalLighting uses normal maps to calculate how light should reflect off surfaces in your images. A normal map is a type of texture that stores information about the direction of surface normals, which are vectors perpendicular to the surface. This information is used to simulate lighting effects.

Basic Principles

  1. Diffuse Reflection: This is based on the Lambertian reflection model, which assumes that light is scattered equally in all directions from a surface. The intensity of the reflected light is proportional to the angle between the light source and the surface normal.
  2. Specular Reflection: This uses Phong's reflection model to simulate shiny surfaces. It calculates the reflection of light in a specific direction, creating highlights that make surfaces look glossy or metallic. By combining these two types of reflections, comfyUI_TJ_NormalLighting can create realistic lighting effects that enhance the depth and texture of your images.

comfyUI_TJ_NormalLighting Features

Input Images

To use this extension, you need to provide three types of images:

  • Diffuse Map: A standard RGB image that represents the base colors of your surface.
  • Normal Map: An RGB image that encodes the surface normals. This is crucial for calculating how light interacts with the surface.
  • Specular Map: An RGB image that defines the color and intensity of specular reflections.

Parameters

Light Source Direction

  • light_yaw and light_pitch: These parameters control the direction of the light source using Euler angles. Adjusting these angles changes how light hits the surface, allowing you to simulate different lighting conditions.

Strength of Specular Reflection

  • specular_power: This parameter controls the sharpness and intensity of specular highlights. Higher values create sharper, more intense highlights (like metal), while lower values produce softer highlights (like plastic).

Output Balance

  • ambient_light: Controls the base lighting that is independent of the light source direction. Setting this to 1 outputs the diffuse map as is.
  • NormalDiffuseStrength: Adjusts the strength of the diffuse reflection.
  • SpecularHighlightsStrength: Adjusts the intensity of the specular highlights.
  • TotalGain: Controls the overall brightness of the output image. The final output is calculated using the following formula:
output_tensor = (diffuse_tensor * (ambient_light + diffuse * NormalDiffuseStrength) + specular_tensor * specular * SpecularHighlightsStrength) * TotalGain

comfyUI_TJ_NormalLighting Models

This extension uses a combination of the Lambertian reflection model for diffuse reflection and Phong's reflection model for specular reflection. These models work together to create realistic lighting effects that can be customized to suit different materials and lighting conditions.

Lambertian Reflection Model

  • Assumes surfaces scatter light equally in all directions.
  • Ideal for simulating matte surfaces.

Phong Reflection Model

  • Calculates specular highlights based on the angle between the light source, surface normal, and the viewer.
  • Ideal for simulating shiny or metallic surfaces.

Troubleshooting comfyUI_TJ_NormalLighting

Common Issues and Solutions

  1. Inconsistent Image Sizes: Ensure that all input images (diffuse, normal, and specular maps) are the same size. Mismatched sizes can lead to incorrect lighting calculations.
  • Solution: Resize your images to match before inputting them into the extension.
  1. Unexpected Lighting Effects: If the lighting looks off, check the light source direction parameters.
  • Solution: Adjust the light_yaw and light_pitch values to change the light direction.
  1. Overly Bright or Dark Images: This can be due to incorrect TotalGain settings.
  • Solution: Adjust the TotalGain parameter to balance the overall brightness.

Frequently Asked Questions

  • What is a normal map? A normal map is a texture that stores information about the direction of surface normals, used to simulate lighting effects.

  • How do I create a normal map? You can create normal maps using various software tools like Photoshop, Blender, or specialized normal map generators.

  • Can I use this extension for animations? Yes, you can use it for animations by providing a sequence of images and adjusting the lighting parameters accordingly.

Learn More about comfyUI_TJ_NormalLighting

To further enhance your understanding and usage of comfyUI_TJ_NormalLighting, here are some additional resources:

  • : Explore sample configurations to see how different settings affect the output.
  • Tutorials and Documentation: Look for tutorials on platforms like YouTube or community forums where you can ask questions and get support from other AI artists.

By exploring these resources, you can master the use of comfyUI_TJ_NormalLighting and create stunning, well-lit images that stand out.

comfyUI_TJ_NormalLighting Related Nodes

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.