#### Archived

This topic is now archived and is closed to further replies.

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

## Recommended Posts

I''m bored... So let''s stir up some controversy In a recent thread, Calculating Normals for Smooth Shading, a person said about Phong Shading:
quote:
cedricl, no matter if you use vertical or horizontal scan lines for filling if you interpolate the normals across the face to calculate the light you should get the same results. scanlines are the result of the 2d rasterization process. if you rotate the object by 90 degrees then its just like you were using vertical scanlines.
I asked for a proof of this claim, and I''m still waiting! I think the same problem applies to Gouraud Shading. If you interpolate color accross vertical scan lines, you won''t get the same results as if you used horizontal scan lines. I''m more convinced than ever of this! Does anyone disagree? Please? Cédric

##### Share on other sites
the color would be interpolated across the face, but you have a LUT for the edges so you get the correct values since you interpolate from the edge LUT the correct values across the scanline.

i never suggested nor implied that interpolating normals across a scanline would give correct results. i merely pointing out that scanlines dont matter if you interpolate across the face (ie use a LUT that contains the correct values across the edges).

i assume you mean to interpolate across the edges then interpolate along the scanline using the edge LUT, so you can fill using scanlines. if you think this will be different, then you are wrong. heck, we might as well get rid of our 3d hardware while we are at it (most work on the same scanline principle, some render in tiles to reduce fillrate, but thats beyond the discussion)

basically you are suggesting that rotating a polygon will result in the shading to change. i never witnessed this in any software engine. the EXACT same "problem" comes with texture mapping as well. you have 3 sets of value you need to interpolate. you dont seem to think that texture mapping would be affected, why would other interpolations be affected?

i guess you could read and mess with:
http://freespace.virgin.net/hugo.elias/graphics/x_polysc.htm
http://freespace.virgin.net/hugo.elias/graphics/x_polyfc.htm
http://freespace.virgin.net/hugo.elias/graphics/x_polygo.htm
http://freespace.virgin.net/hugo.elias/graphics/x_polyop.htm

why dont you post a proof of your claim, i use any decent software engine written as my proof. i dont understand how you can believe something to be true when you cant even think up an example of it being true. your belief seems logical until you realize that you are just rotating the polygon by 90 degrees and thus are saying that rotations of a polygon change how its shaded giving different results.

the reason you use horizontal scanlines is because its faster (due to cache, and simply how cpus access memory). there is no difference between interpolating for phong shading, texture mapping, or gouraud shading. granted each one has a different number of values being interpolated, they all are interpolated across the face using the vertices.

if i had the time i would implement a simple rasterizer that used vertical and horizontal scanlines to show you there is no difference.

oh well, i typed more then i probably should have. probably not any more convincing, heh.

##### Share on other sites
Maybe I don''t understand correctly... I don''t understand what look-up tables have to do with Gouraud shading.

Anyway, yes, what I do mean is interpolate accross the edge, then interpolate accross the scanline.

If we''re both talking about the same technique, then I''ve got an example...
A -------------- B  \            /   \          /    \XXXXXXXX/     \      /      \    /       \  /        \/        C

Let''s look at the XXXXX line of pixel (with both horizontal and vertical scan lines). My main point is that, using horizontal scan lines, the XXXX line will be continuous, and its derivative is constant (it''s a linear interpolation). But if you look at the same pixels, but using the vertical scanline approach, I''ve got a hard time convincing myself that its derivative will be constant, especially when it stops interpolating between AB-AC and starts interpolating between AB-BC.

I thought my example was "In your face, a person", but it''s not really convincing right now. I tried doing the whole maths, but there are so many variables and interpolations, it takes a long time.

Oh well... If I can figure it out, I''ll post again. I didn''t mean to sound offensive. Thanks for your post.

Cédric

##### Share on other sites
You won''t run into a problem if you stick with rasterizing triangles. As soon as you try to rasterize something with more than 3 sides you will see a difference in vertical vs. horizontal interpolation. This is explained in Foley/van Dam.

##### Share on other sites
Ok, thanks, although you could''ve specified the page number...

If anyone is interested, the excerpt is on p. 740

They don''t provide a demonstration, but it''d be hard to argue against Computer Graphics: Principles and Practice.

Cédric

##### Share on other sites
If I had the book in front of me I would have posted the page number, however I was recalling the subject from memory from reading the section on interpolative shading a month or so ago. Glad I could help.

1. 1
2. 2
Rutin
21
3. 3
4. 4
A4L
15
5. 5
khawk
14

• 13
• 26
• 10
• 11
• 44
• ### Forum Statistics

• Total Topics
633742
• Total Posts
3013636
×