• Content count

  • Joined

  • Last visited

Community Reputation

128 Neutral

About dila_

  • Rank
  1. My point is that lighting in world space will be different to lighting in view space. distance(vertex*view - light) != distance(vertex - light*view^-1) this is clear if we let the light origin be 0,0,0, and consider a matrix with no translation, then we have that: length(vertex*view) != length(vertex) which is true In other words, the transformation distorts the lighting So I wonder why opengl does lighting in view space and not in world space. Is it for the the sake of having a single modelview matrix instead of separate model and view matrices in the pipeline?
  2. My question is not about the effect that the transformation has on the normals. From the documentation I can see that OpenGL has a MODELVIEW matrix, which is a concatenation of the MODEL and VIEW matrices, so from that point of view OpenGL can support separate model and view matrices. Now consider the difference between: distance(vertex*model - world_light) and distance(vertex*modelview - view_light). Notice how the distance between the vertex and the light can change, potentially depending on the non-uniform scaling in the matrix.
  3. [color=#000000][font=Arial,]Does the OpenGL fixed function pipeline compute lighting in view-space?[/font][/color] [color=#000000][font=Arial,]If the answer is yes, then how does it cope with view transformations with non-uniform scale? Actually, how does it cope with view transformations incorporating [i]any[/i] scale at all?[/font][/color] [color=#000000][font=Arial,]If this is true then scaling the view space will result in different light-to-vertex distances, meaning the lighting intensity for point-lights will change as the view matrix is scaled.[/font][/color] [color=#000000][font=Arial,]Lighting in world-space would make the computed point-light intensity independent of view space scaling, but would require:[/font][/color] [list] [*]That an object-to-world matrix is supplied to the API (such as in DirectX, where the light positions are specified in world-space). [*]That the API transform all geometry twice when drawing. Once by world*view*proj into clip space, and again by world, in order to compute lighting at the vertices in world space. [/list] [color=#000000][font=Arial,]I also posted this to stackoverflow, perhaps you want to answer it there too: [url="http://stackoverflow.com/questions/10830759/does-the-opengl-fixed-function-pipeline-compute-lighting-in-view-space"]http://stackoverflow...g-in-view-space[/url][/font][/color]