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 6798217
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T18:42:13+00:00 2026-05-26T18:42:13+00:00

I have been reading a pdf file on OpenGL lighting . It says for

  • 0

I have been reading a pdf file on OpenGL lighting.

It says for the Gouraud Shading:

• Gouraud shading
– Set vertex normals
– Calculate colors at vertices
– Interpolate colors across polygon
• Must calculate vertex normals!
• Must normalize vertex normals to unit length!

So that’s what I did.
Here is my Vertex and Fragment Shader file

V_Shader:

#version 330

layout(location = 0) in vec3 in_Position; //declare position
layout(location = 1) in vec3 in_Color;

// mvpmatrix is the result of multiplying the model, view, and projection matrices */
uniform mat4 MVP_matrix;
vec3 ambient;

out vec3 ex_Color;

void main(void) {

   // Multiply the MVP_ matrix by the vertex to obtain our final vertex position (mvp was created in *.cpp)
   gl_Position = MVP_matrix * vec4(in_Position, 1.0);
   ambient = vec3(0.0f,0.0f,1.0f);
   ex_Color = ambient * normalize(in_Position) ; //anti ex_Color=in_Color;
}

F_shader:

#version 330

in vec3 ex_Color;
out vec4 gl_FragColor;

void main(void) {
   gl_FragColor = vec4(ex_Color,1.0);
}

The interpolation is taken care by the fragment shader right?

so here is my sphere (it is low polygon btw):

enter image description here

Is this the standard way of implementing Gouraud Shading?
(my sphere has a center of (0,0,0))
Thanks for your patience

  • 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-26T18:42:14+00:00Added an answer on May 26, 2026 at 6:42 pm
    ex_Color = ambient * normalize(in_Position) ; //anti ex_Color=in_Color;
    

    Allow me to quote myself, “It certainly doesn’t qualify as ‘lighting’.” That didn’t stop being true between the first time you asked this question and now.

    This is not lighting. This is just normalizing the model-space position and multiplying it by the ambient color. Even if we assume that the model-space position is centered at zero and represents a point on the sphere, multiplying a light by a normal is meaningless. It is not lighting.

    If you want to learn how lighting works, read this. Or this.

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

Sidebar

Related Questions

Have been reading about async and tasks and been attempting to convert the CopyFileEx
i have been reading this interesting article which is increasing my every growing confusion
I have been reading up on multiple PHP frameworks, especially the Zend Framework but
I have been reading the docs and playing with different EventQuery parameters for days
I have been reading over some code lately and came across some lines such
I have been reading through this wonderful website regarding the recommended Python IDEs and
I have been reading about collision detection in games on stackoverflow and other sites.
I have been reading about the continuation passing style programming technique (C# 3.0 implementation).
I have been reading up on the SimpleMessageListenerContainer to ease the pain of subscribing
I have been reading through the documentation on the JavaScriptMVC framework and it looks

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.