Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6247573
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T12:54:07+00:00 2026-05-24T12:54:07+00:00

I am currently looking for information on how to get the final flat color

  • 0

I am currently looking for information on how to get the final flat color value of a given face within a lit 3d scene. I have a Material class that contains the following 4 colors:

ambient, specular, diffuse & emissive

My Color class has methods for simple blend effects such as add, multiply etc

From a list of lights, camera position, material, face normal & face position. I would like to calculate the final color of a face to be filled using a software render pipeline using the standard 4 color material model.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T12:54:08+00:00Added an answer on May 24, 2026 at 12:54 pm

    I assume you want the standard Phong or Blinn-Phong lighting model, which the fixed-function GL uses, too.

    The emissive term is the color the material emits by itself (for example when modeling a light). So it just adds to the final color.

    color = emissive;
    

    The ambient term simulates the indirect lighting computation due to infinitely reflected light, so it doesn’t depend on the position of the light and is approximately everywhere. So the material’s ambient is just multiplied by the light’s color and adds to the final color.

    color += ambient * lightColor;
    

    The diffuse term simulates a standard Lambertian reflector, that reflects light equally in all directions. It depends on the angle between the direction to the light and the surface normal, with smaller angles resulting in more light.

    lightDir = normalize(lightPos-facePos);
    color += dot(lightDir, normal) * diffuse * lightColor;
    

    The specular term finally simulates specular surfaces, that reflect more light into a singular direction (the perfect reflection direction). So it depends on the direction you are looking onto the face in. Additionally the reflectivity depends on another parameter that describes the roughness of the surface (or actually its shininess which is also the name GL uses, with higher values making sharper highlights and thus being more “shiny”).

    viewDir = normalize(cameraPos-facePos);
    halfVec = normalize(lightDir+viewDir);
    color += pow(dot(normal, halfVec), shininess) * specular * lightColor;
    

    Of course the ambient, diffuse and specular term have to be computed for every light.

    For more complex lights other than simple point lights without distance attenuation, you have to consider other things, but this simple model should get you started.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

   I'm currently looking for a more efficient method, via VBA, to get information transferred
I'm currently looking for a way to get backtrace information under Windows, from C
I'm currently looking at a hefty Rails test suite. It's nothing I can get
I am currently looking to design some WCF services and wanted to get the
I'm currently trying to get g++ working, and looking at http://gcc.gnu.org/install/build.html , I can't
I am currently using libproxy to get the proxy information (if any) on RedHat
I am looking for information on Windows network programming. Mainly how to get a
Thans for looking, I hope you could help me. Currently, I want to get
I have a profile object in session with profile information for the currently logged
I am looking for information concerning a proven process to interrogate the current user's

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.