Solved

Phong Shading

Posted on 1998-06-27
9
1,026 Views
Last Modified: 2008-02-20
Im sick and tired all textbook answers to phong shading, has anyone got a simple explanation on how do phong shade a polygon?
0
Comment
Question by:n1875621
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
9 Comments
 
LVL 1

Expert Comment

by:clancyo
ID: 1112811
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
 
LVL 10

Expert Comment

by:Jacco
ID: 1112812
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
 
LVL 10

Expert Comment

by:Jacco
ID: 1112813
I have looked up your info.

So pascal or C++

Do you use Delphi ?
0
On Demand Webinar: Networking for the Cloud Era

Ready to improve network connectivity? Watch this webinar to learn how SD-WANs and a one-click instant connect tool can boost provisions, deployment, and management of your cloud connection.

 
LVL 10

Expert Comment

by:Lischke
ID: 1112814
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
 

Author Comment

by:n1875621
ID: 1112815
yes, its to simple - for 200 points ill need some c++ code
0
 
LVL 10

Expert Comment

by:Lischke
ID: 1112816
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
 

Expert Comment

by:euclid091498
ID: 1112817
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
 
LVL 1

Accepted Solution

by:
ironheardt earned 200 total points
ID: 1112818
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
 
LVL 10

Expert Comment

by:Lischke
ID: 1112819
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

Featured Post

Enroll in June's Course of the Month

June's Course of the Month is now available! Every 10 seconds, a consumer gets hit with ransomware. Refresh your knowledge of ransomware best practices by enrolling in this month's complimentary course for Premium Members, Team Accounts, and Qualified Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Keep your audience engaged and get the most out of your next presentation with these quick Prezi tips.
Many programs have tried to outwit PowerPoint in terms of technology and skill. These programs, however, still lack several characteristics that PowerPoint has possessed from the start. Here's why PowerPoint replacements won't entirely work for desi…
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
Learn the basics of inputting and editing your text components in Prezi. We will cover how to set styles, position, and group your text components. In your Prezi editor, click anywhere on the canvas to add text: A flashing cursor informs you that yo…

688 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question