Jump to content

Suggestions for lighting direction


Recommended Posts

I have always wondered if there was a way or a plugin that can control where the light source on a image or layer comes from. The Curves and Levels tools are not always reliable.

 

I like to render a light source that comes from one direction such as from the left side, right side, from above or even below. The light source can be vertical, horizontal or in a tilted diagonal angle. And there should also be an option if it expands and fades as it comes closer to the center of the image. Imagine the rays of the sun of the light beam of a flashlight? I want to render that kind of lighting.

 

It would be very useful in creating an artificial light source. If there isn't a plugin written for this yet, let me be the first to make a call towards making one. Thank you.

Link to comment
Share on other sites

I am aware of making another layer and using a transparent gradient to mimic a light source. I have tried that multiple times but it has limitations. I think I might have used something like that on the shadow side of the planet of my profile picture.

 

However, it would have been better if it can be applied without needing another layer. Such a plugin would greatly affect and enhance an image that needs directional lighting to be added. I recently used the Sharpen Landscape plugin for enhancing a dull landscape image I found and it has good effects, thanks to its multiple adjustment controls. Maybe a new plugin for rendering a light source with comparable mechanics can be made.

 

 

And thanks Goonfella for linking that Light Rays Plugin. I was looking for that plugin but that's another story.

Link to comment
Share on other sites

Isn't lighting the primary function of a Normal Map?  http://en.wikipedia.org/wiki/Normal_mapping

 

There are a few plugins.  This one Normal Tools has excellent supporting documentation.

Link to comment
Share on other sites

do you mean something like this?

Plugin Retracted

It's under the Color menu

 

CodeLab Source Code

Hidden Content:
// Submenu: Color
// Name: TR's SimpleLight
// Title: TR's SimpleLight- v1.0
// Author: TechnoRobbo
// URL: http://www.technorobbo.com

#region UICode
Pair<double, double> Amount1 = Pair.Create( 0.0 , 0.0 ); // Hot Spot
double Amount2 = 0.5; // [0,4] Coverage
byte Amount3 = 0; // [1] Type|Normal|Flood|Spot
double Amount4 = 1; // [0.5,2] Gain
#endregion

void Render(Surface dst, Surface src, Rectangle rect)
{
    // Delete any of these lines you don't need
    Rectangle selection = EnvironmentParameters.GetSelection(src.Bounds).GetBoundsInt();
    int CenterX = ((selection.Right - selection.Left) / 2)+selection.Left;
    int CenterY = ((selection.Bottom - selection.Top) / 2)+selection.Top;
    ColorBgra PrimaryColor = (ColorBgra)EnvironmentParameters.PrimaryColor;
    ColorBgra SecondaryColor = (ColorBgra)EnvironmentParameters.SecondaryColor;
    int BrushWidth = (int)EnvironmentParameters.BrushWidth;
    
    System.Drawing.PointF org =new System.Drawing.PointF( (float)Amount1.First, (float)Amount1.Second);
    
    
    float range =  (float)Amount2;
    
    ColorBgra CP;
    for (int y = rect.Top; y < rect.Bottom; y++)
    {
        if (IsCancelRequested) return;
        for (int x = rect.Left; x < rect.Right; x++)
        {
            float relx = (float)(x -  CenterX) / (float)CenterX;   
            float rely = (float)(y -  CenterY) / (float)CenterY;    
            float dist =(float) Math.Sqrt((org.X - relx )*(org.X - relx )
                    + (org.Y - rely)*(org.Y - rely));   
            float coeff = (dist > range)? 0: (1f - dist/range);    
            
            coeff *= (float)Amount4;
            
            
            if (Amount3==1)
            {
                coeff = (float)Math.Sqrt(coeff);
            }else if (Amount3==2)
            {
                coeff *= coeff;
            }
                
            CP = src[x,y];
            float tmp = (float)CP.R * coeff; 
            tmp = (tmp > 255) ? 255: tmp;
            CP .R = (byte)tmp;
            
            tmp = (float)CP.G * coeff;  
            tmp = (tmp>255) ? 255: tmp;
            CP .G = (byte)tmp;
            
            tmp = (float)CP.B * coeff;     
            tmp = (tmp>255) ? 255: tmp;
            CP .B = (byte)tmp;
            
            CP.A = (byte)CP.A;
            dst[x,y] = CP;
        }
    }
}

 

not published yet - need to make it 3.5 and Plugin browser compatible.

Go out there and be amazing. Have Fun, TR
TRsSig.png?raw=1
Some Pretty Pictures Some Cool Plugins

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...