Results 1 to 2 of 2

Thread: Lighting + Texture + Shadow-Color

  1. #1
    Junior Member Newbie
    Join Date
    Oct 2011

    Lighting + Texture + Shadow-Color


    I have a textured scene. For each vertex I calculated a shadow color which I assign via glColor3f: black: full shadow, white: no shadow. Now I want to add a light-source which darkens faces that are not facing it but does not enlight the shadow.

    Adding a simple Light and enabling GL_COLOR_MATERIAL gives me a good starting Point: dark faces stay dark and faces which not face the light source a darkened too. But unfortunatley they are darkened too much.

    How can I make them brighter? If I add GL_EMISSION to [.5, .5, .5, 1] they get brighter, but my shadows are also lit up (what I dont want)..

    Does someone know a good reference for OpenGL lighting or can give me a Hint how I get the desired effect?

  2. #2

    Re: Lighting + Texture + Shadow-Color

    GL_AMBIENT is what you are looking for. It simulates... you guessed it, ambient lighting.
    I have used the Red Book as my reference when I was first learning GL. The lighting equation is explained there and probably all other sources.

    There is also glLightModel which has a ambient thing. You can set it to {0, 0, 0, 0}.

    You also need to set the glLight GL_AMBIENT value. I suggest {1, 1, 1}.

Similar Threads

  1. Replies: 1
    Last Post: 04-09-2017, 08:09 AM
  2. Replies: 0
    Last Post: 06-08-2013, 01:30 AM
  3. Volumetric lighting using Shadow volumes
    By greeniekin in forum OpenGL: Advanced Coding
    Replies: 5
    Last Post: 05-11-2012, 02:06 AM
  4. Shadow maps without border color
    By LaBasX2 in forum OpenGL: Advanced Coding
    Replies: 3
    Last Post: 04-12-2009, 06:21 AM
  5. lighting + shadow
    By zed in forum OpenGL: Advanced Coding
    Replies: 13
    Last Post: 11-08-2002, 06:40 AM

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