Relation between material colors and light colors.

This is a discussion on Relation between material colors and light colors. within the Game Programming forums, part of the General Programming Boards category; I have been wondering how to figure out how the colors I set for objects (ambient, diffuse, specular) are affected ...

  1. #1
    Ethernal Noob
    Join Date
    Nov 2001
    Posts
    1,901

    Relation between material colors and light colors.

    I have been wondering how to figure out how the colors I set for objects (ambient, diffuse, specular) are affected by the ambient, diffuse and specular colors of a lights source. I know what the attributes of lighting represent, but when it comes to the object's ambient, specular, and diffuse attributes I get lost.

  2. #2
    Frequently Quite Prolix dwks's Avatar
    Join Date
    Apr 2005
    Location
    Canada
    Posts
    8,046
    You mean, you set some attributes on an object, and some attributes for a light source that is shining on that object, and you want to figure out the resulting attributes for that object with the attributes of the light source applied to it?

    Are you using DirectX, OpenGL, or something else?
    dwk

    Seek and ye shall find. quaere et invenies.

    "Simplicity does not precede complexity, but follows it." -- Alan Perlis
    "Testing can only prove the presence of bugs, not their absence." -- Edsger Dijkstra
    "The only real mistake is the one from which we learn nothing." -- John Powell


    Other boards: DaniWeb, TPS
    Unofficial Wiki FAQ: cpwiki.sf.net

    My website: http://dwks.theprogrammingsite.com/
    Projects: codeform, xuni, atlantis, nort, etc.

  3. #3
    Lean Mean Coding Machine KONI's Avatar
    Join Date
    Mar 2007
    Location
    Luxembourg, Europe
    Posts
    444
    Imagine a shiny white surface onto which you point a red light source ... try to close your eyes and imagine the scene in your mind. And now, try the same thing with a black shiny surface. The result is quite different...since the value of the reflexion color is not only dependent on the light source but also the material of the object.

    If you're not convinced, try to download a 3D editor like 3DS Max and play around with the material editor, you'll immediately notice the difference.

  4. #4
    Captain Crash brewbuck's Avatar
    Join Date
    Mar 2007
    Location
    Portland, OR
    Posts
    7,160
    Quote Originally Posted by indigo0086 View Post
    I have been wondering how to figure out how the colors I set for objects (ambient, diffuse, specular) are affected by the ambient, diffuse and specular colors of a lights source. I know what the attributes of lighting represent, but when it comes to the object's ambient, specular, and diffuse attributes I get lost.
    Not sure exactly what question you're asking. The ambient property determines how the object "self-lights," i.e. light contributions from the environment as a whole as opposed to a particular light source. Diffuse property describes how non-specular interactions color the object. Specular property describes specular interactions.

    The difference between specular and diffuse reflection has to do with how the color of the light source interacts with the color of the object. In the specular region, the reflected color is almost entirely determined by the light source. In the diffuse region it is determined by the color of the object.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Critique my lighting model.
    By psychopath in forum Game Programming
    Replies: 4
    Last Post: 08-12-2006, 06:23 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21