Blinn Phong rendering I am trying to render Blinn Phong as a BRDF model on a surface plane. I assume that every normal in every pixel is perpendicular with the plane.
I know that to do a rendering we have to use 3d programing API such as OpenGL or WebGL and so on.
My purpose is to render the surface plane without those APIs. The steps that I take are, I create 2 spaces:


image space: (0,0) is at the top left of the image.
camera space: (0,0) is at the middle of the image.


For vector computation, I convert every pixel position of image space to camera space then to world space.

double[] cam=((new double[]{0,0,1}));
double[] lum=((new double[]{0,0,1}));
double[] E=new double[3];
double[] L=new double[3];
double[] H=new double[3];
double D2;
Mat image=new Mat(rows,cols,CvType.CV_8UC3);
System.out.println("Start!!");
System.out.println("ok");
for(int i=0;i&lt;tileHNumber;i++)
{
    for(int j=0;j&lt;tileWNumber;j++)
    {
        for(int s=0;s&lt;192;s++)
        {
            for(int t=0;t&lt;192;t++)
            {
                originS=s+192*i;//ligne
                originT=t+192*j;//colonne
                double[] pos=(Image2Cam(new double[]{originT,originS,0}));
                E=normalize(XY(cam,pos));
                L=normalize(XY(lum, pos);
                double[] le=addXY(L,E);
                H=normalize(le);
                D2=dot(E,E);
                double blue=color(blueColor,pos,E,L,H,D2);
                double green=color(greenColor,pos,E,L,H,D2);
                double red=color(redColor,pos,E,L,H,D2);
                image.put(originS, originT, new byte[]{(byte)(blue),(byte)(green),(byte)(red)});
            }
        }
    }
}
public static double color(double col,double[] pos,double[] E,double[] L,double[] H,double D2)
{
    double value=0;
    double[] N=normalize((new double[]{pos[0],pos[1],1}));
    double diffuse=Math.max(0, dot(N,L));
    double specular=Math.pow(Math.max(0, dot(N,H)),60);
    value=d*diffuse*0.5+0.2*d+specular*255*0.3;
    return value;
}


The 2 images below show my results: the first one shows diffuse image only. The second one shows specular image only represented by the white color. 

My question is why the lobe specular is not surrounding the center of the image.
If I'm guessing right, you are drawing a plane which is facing the camera, so your normals need to be 0,0,-1.

change

double[] N=normalize((new double[]{pos[0],pos[1],1}));

to

double[] N=normalize((new double[]{0,0,-1}));