Results 1 to 5 of 5

Thread: local viewer - specular lights

  1. #1
    Junior Member Newbie
    Join Date
    Apr 2000
    Location
    Singapore/Sweden
    Posts
    16

    local viewer - specular lights

    I have a problem with the specular highlights. I use the function call

    glLightModeli( GL_LIGHT_MODEL_LOCAL_VIEWER, 1);

    But still the specular highlight is calculated as if I always stand at one point, facing the negative z axis. It doesn't matter how I move around - the specular light remains "static" on the surface.

    How come? Does anybody have an idea?

  2. #2
    Junior Member Newbie
    Join Date
    May 2000
    Location
    france
    Posts
    11

    Re: local viewer - specular lights

    I'm not sure, but you should check the order in which you set your Matrices and your light. If you set ModelView Matrix before, your light will always appear in the same place (in camera space) so the hilight seems to come from the same point.

  3. #3
    Junior Member Newbie
    Join Date
    Apr 2000
    Location
    Singapore/Sweden
    Posts
    16

    Re: local viewer - specular lights

    Hmm... thanks for your comment, but I think the problem is elsewhere. To me it seems like the line

    glLightModeli( GL_LIGHT_MODEL_LOCAL_VIEWER, true);

    does not have any effect. The specular light remains on the surface exactly where it would be if I was facing the negative Z all the time. As I rotate around the object the highlight doesn't move around on the surface at all... looks more like a texture wrapped onto the object.

    However that line of code has one effect: it seems like it makes the shininess increase. The size of the highlight becomes smaller in size!!! Well... isn't that weird?

  4. #4
    Junior Member Newbie
    Join Date
    Jan 2002
    Location
    Frankfurt, germany
    Posts
    4

    Re: local viewer - specular lights

    Hy!

    I've experienced exactly the same problem!
    Unfortunately I haven't found a solution yet. Maybe a closer look to the situation will help others to understand the Problem.
    about GL_LIGHT0:
    - Position is (0,10,0,1)
    - Direction is (0,-1,0)
    - Colors are also set right (Specular & Diffuse)

    I set the Localviewer to true and activated normaizing.
    Here is the display code:
    *****code begin*******
    glClear(GL_COLOR_BUFFER_BIT or GL_DEPTH_BUFFER_BIT);
    glMatrixMode(GL_MODELVIEW);
    glLoadIdentity();
    gluLookAt(cam_x, cam_y, cam_z, 0, 0, 0, 0, 1, 0);

    glrotatef(anim, 1, 0, 0)

    SetLight; //Updates the Position and Direction
    sglSetMatConsts(PolishedSilver, TRUE);
    DrawPlane; //tesselated
    DrawBall; //Pos (0,5,0)
    DrawLight; //Sphere @ Ball's position

    glutSwapBuffers();
    *****code end*******
    The Light doesn't move. Fixed local position.
    But as the scene spins, the specular component of the light moves across the plane. The diffuse component looks right (stationary from top). Very Wired.

  5. #5
    Junior Member Newbie
    Join Date
    Sep 2002
    Location
    Starkville,Mississippi,USA
    Posts
    20

    Re: local viewer - specular lights

    try using your lookat(..) in the projection matrix instead of modelview matrix..that should fix the problem
    Dont argue with fools, they bring you down to their level and beat you with experience.

Similar Threads

  1. Point Lights producing hard lines through Specular comp?
    By ParagonArcade in forum OpenGL: Advanced Coding
    Replies: 0
    Last Post: 01-22-2015, 06:30 AM
  2. Specular Lighting with directional lights
    By welford in forum OpenGL: GLSL
    Replies: 4
    Last Post: 05-13-2009, 04:37 PM
  3. local viewing and specular lighting
    By mikau in forum OpenGL: Basic Coding
    Replies: 1
    Last Post: 08-16-2008, 01:56 PM
  4. Specular Highlights and Directional lights
    By doc_colgate in forum OpenGL: Basic Coding
    Replies: 2
    Last Post: 09-06-2002, 01:04 AM
  5. Replies: 13
    Last Post: 11-29-2000, 02:19 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Proudly hosted by Digital Ocean