Jump to content

  • Log In with Google      Sign In   
  • Create Account


I'm new in GLSL, whats the difference between per-vertex lighting & per-pixel lighting?


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
4 replies to this topic

#1 50_Cal   Members   -  Reputation: 110

Like
0Likes
Like

Posted 23 August 2012 - 07:16 PM

As the title, im wondering whats the difference between them.
Cuz vertex shader deals with every vertex the program transfers, and how can it deal with the pixels ?

Sponsor:

#2 Jivi   Members   -  Reputation: 268

Like
4Likes
Like

Posted 23 August 2012 - 08:55 PM

in per-vertex lighting, lighting computation is done at each of the vertices of a model in the glsl vertex shader and the resulting pixel color is an interpolation of the color values of vertices on a face passed from the vertex shader. In per pixel lighting, all lighting computation is done pixel wise in the fragment shader. If the faces on a model are too big, per vertex lighting produces incorrect and undesirable and will require tessellation or subdivision of the faces.
Per vertex is faster since less computation is involved. Per pixel lighting gives correct result but requires pixel wise computation.

#3 Jivi   Members   -  Reputation: 268

Like
0Likes
Like

Posted 23 August 2012 - 08:56 PM

Information from the vertex shader is interpolated pixel wise into the fragment shader

#4 przemoli   Members   -  Reputation: 111

Like
2Likes
Like

Posted 24 August 2012 - 03:35 AM

1) Per vertex lighting is computed in vertex (or geometry or tessel) shader, with setting apropriate interpolation that OpenGL will use to get lighting per pixel.
2) Per pixel lighting is computed in part on vertex (geo or tess) shader for normal vectors, with setting apropriate interpolation that OpenGL will use to get normals per pixel. But actual lightning is computed in fragment shader based on that interpolated normal, with manual control over how relusting color must be incorporated into framebuffer.

There are few consequences:
Per vertex lighting put computation in vertex (geo or tess) shader stages so it is less computational intensive.
Per pixel lighting allow for more accurate color for every pixel.
Per vertex lighting interpolate color but only inside of primitive so it there is other primitive near by it can have different color which reasult in more artificial look.
Per pixel lighting interpolate normals but only inside of primitive *but* for near by primitives normals will vary only slightly, so relusting color should be not so different, giving impresion of "smoothnes".

#5 50_Cal   Members   -  Reputation: 110

Like
0Likes
Like

Posted 27 August 2012 - 07:42 PM

Thanks for your replies. Now I get the differences between them.




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS