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 Online
for ready-to-use ComfyUI environment
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
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.
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:
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
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.
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.
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:
Sample JSON Files: 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.