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
Solved

Phong Shading

Posted on 1998-06-27
9
1,024 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
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
Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
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

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

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

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…
Technology opened people to different means of presenting information, but PowerPoint remains to be above competition. Know why PPT still works today.
In addition to being a great web-based presentation tool, Prezi also makes it easy to save your presentation as a PDF to share with others as well. Learn how in this tutorial. Select the share icon from the top menu in your Prezi editor: Select "D…
Learn how to download your full Prezi presentation for offline presenting. Prezi doesn’t have to be viewed and shared in a web browser, even with a free account you can download your full presentation to share with others. Be sure to download any vi…

856 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