# normal interpolation

This topic is 3589 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Hi, im trying to simulate a phong shading in my scene. i already able to calculate the vertex normal but i cant find the way to interpolate it to find a normals in every pixel. i got this link: http://www.vhml.org/theses/usher/node31.html but i cant understand what the value of alpha and beta should be. any1 have an idea? thanks in advance

##### Share on other sites
That is how you interpolate anything on a triangle (color and texture coordinates in particular). alpha and beta are the barycentric coordinates of the point in the triangle.

If you are using that code to implement Phong shading, you should know that a weighted average of vectors with length 1 doesn't have length 1 (it's actually a little shorter). You'll have to renormalize or find some approximation to the renormalization that can be computed fast.

##### Share on other sites
sorry im a little bit lost. so this is what i did:

i calculate normal on each vertex, which is the sum of the normals of adjacent polygon divided by the number of of the polygons. then i use bilinear interpolation:

http://en.wikipedia.org/wiki/Bilinear_interpolation

to calculate the normal according to Y, then to X ( since my scanline is botom-top then left right). but what i got is a wrong normal. when calculated with light vector, its very small almost zero.

any1 can help me where i did wrong?

ps:how can i use code tag in here?

1. 1
2. 2
Rutin
19
3. 3
4. 4
5. 5

• 9
• 9
• 9
• 14
• 12
• ### Forum Statistics

• Total Topics
633297
• Total Posts
3011251
• ### Who's Online (See full list)

There are no registered users currently online

×