Improve company productivity with a Business Account.Sign Up

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1033
  • Last Modified:

Phong Shading

Im sick and tired all textbook answers to phong shading, has anyone got a simple explanation on how do phong shade a polygon?
0
n1875621
Asked:
n1875621
1 Solution
 
clancyoCommented:
I don't think there is a simple answer.  If you haven't read it, try this address
http://www.cmlab.csie.ntu.edu.tw/~qvr/mdc97/icg/page26.html
0
 
JaccoCommented:
Can you explain in what environment you need to implement Phong Shading ? I mean what programming language.

I can explain it, but it requires some more information.
0
 
JaccoCommented:
I have looked up your info.

So pascal or C++

Do you use Delphi ?
0
Get 10% Off Your First Squarespace Website

Ready to showcase your work, publish content or promote your business online? With Squarespace’s award-winning templates and 24/7 customer service, getting started is simple. Head to Squarespace.com and use offer code ‘EXPERTS’ to get 10% off your first purchase.

 
LischkeCommented:
Phong shading can easily be described by comparing it with other technics like Gouraud shading. What you normally are doing is to calculate the color of your polygon's vertices depending on their normal vectors, distance to the lights etc.

Now comes the difference. To render your polygon you can either interpolate the calculated colors of your vertices (Gouraud shading) or you can interpolate the normal vectors of your vertices along the scanlines and redo the color calculation for each pixel based on the interpolated normal vector (Phong shading). The latter requires more calculation time, but leads to better results. In particular specular highlights look more realistic.

Is this answer simple enough?

Ciao, Mike
0
 
n1875621Author Commented:
yes, its to simple - for 200 points ill need some c++ code
0
 
LischkeCommented:
Oh, unfortunately I do my programming in Delphi and assembler and the code is a bit *bit* more complex than my answer. I wish you luck getting someone writing you this code.

Ciao, Mike
0
 
euclid091498Commented:
n1875621,

I find Lischke's answer perfectly acceptable given your initial request. If C/C++ source code is what you want, have a look at http://www.ssec.wisc.edu/~brianp/Mesa.html. Mesa implements something very close to OpenGL and you can get the complete source (C/C++) code for it. You will find code for a great deal of graphics algorithms if you are willing to dig.
If you want a simple way to understand how it's done, to the extent that you can implement it yourself, you might not want to be burried in the details of a full implementation. Given a minimum mathematical background and the willingness to use your brains, Lishke's answer should point you in the right direction. As clancyo exemplified, there's lots of info on the internet you can look at, but in the end, it's simple and easy in the textbooks.
0
 
ironheardtCommented:
I am agreed with euclid, you should award the points to Lischke based on the information in the question you were given the correct answer, unless you already knew the answer you wanted to hear and didnt hear it.In which case that does not make your answer correct and it does not make the answer Lischke gave wrong, but you dont need to ask a question if you already have the answer. On that I know I am correct.
0
 
LischkeCommented:
Hi euclid, ironheartd

thanks for your support :-), but don't care about this. I gave an answer and it wasn't enough, so n1875621 has to look elsewhere to find another one.

Let's take it easy...

Ciao, Mike
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now