webgl-fundamentals icon indicating copy to clipboard operation
webgl-fundamentals copied to clipboard

halfVector in diagram seems to be off

Open trusktr opened this issue 7 years ago • 3 comments

In the diagram the "halfVector" doesn't visually seem right. If I complete the rectangle and get the long vector (surface2view + surface2light vectors), then half of that doesn't not align with the rendered "halfVector".

trusktr avatar May 29 '17 19:05 trusktr

You're not adding the vectors, you're adding the direction of the vectors. In other words you add the normalized vectors, not the vectors themselves to get the halfVector.

greggman avatar May 29 '17 23:05 greggman

The simplest update might just be to change it from

If we know the direction from the surface of our model to the light (which we do since we just did that). And if we know the direction from the surface to view/eye/camera, which we can compute, then we can add those 2 vectors and normalize them to get the halfVector

to

If we know the direction from the surface of our model to the light (which we do since we just did that). And if we know the direction from the surface to view/eye/camera, which we can compute, then we can add those 2 directions and normalize the result to get the halfVector. Note: by direction I mean the normalized values of the 2 vectors, surface2View and surface2Light.

Or something simple like that. I don't want to add paragraphs of text if it's not needed.

greggman avatar May 31 '17 08:05 greggman

I think

Note: by adding those 2 directions I mean adding the normalized values of each of the 2 vectors, surface2View and surface2Light.

sounds good, with the rest the same. 👍

trusktr avatar Jun 13 '17 17:06 trusktr