Solved

Phong Shading

Posted on 1998-06-27
9
1,020 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
 
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
Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

 

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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

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 this tutorial viewers will learn how to create blended and gradiated shapes in Illustrator using the blend tool Draw two shapes, one of them in a different color: Select both and create a blend by going to Object > Blend > Make: Blends can also b…
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…

707 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

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now