Phong Shading
hey
I am trying to implement phong shaded spheres. I dont really no where to start, anyone have any pointers? I want to avoid short cuts such as texture mapping a lightmap over the sphere
cheers
benchparkgreen,
If by phong shaded you mean per-pixel, then the best way to do that w/o short cuts is by using Pixel Shaders. These are small programs which run on your video hardware that perform lighting calculations, etc... on a per-pixel basis.
This is of course speaking from a DirectX background, but I'm fairly certain OpenGL has something similar.
If by phong shaded you mean per-pixel, then the best way to do that w/o short cuts is by using Pixel Shaders. These are small programs which run on your video hardware that perform lighting calculations, etc... on a per-pixel basis.
This is of course speaking from a DirectX background, but I'm fairly certain OpenGL has something similar.
Jeromy Walsh
Sr. Tools & Engine Programmer | Software Engineer
Microsoft Windows Phone Team
Chronicles of Elyria (An In-development MMORPG)
GameDevelopedia.com - Blog & Tutorials
GDNet Mentoring: XNA Workshop | C# Workshop | C++ Workshop
"The question is not how far, the question is do you possess the constitution, the depth of faith, to go as far as is needed?" - Il Duche, Boondock Saints
Sr. Tools & Engine Programmer | Software Engineer
Microsoft Windows Phone Team
Chronicles of Elyria (An In-development MMORPG)
GameDevelopedia.com - Blog & Tutorials
GDNet Mentoring: XNA Workshop | C# Workshop | C++ Workshop
"The question is not how far, the question is do you possess the constitution, the depth of faith, to go as far as is needed?" - Il Duche, Boondock Saints
yeah, thats kinda the jist i was getting from stuff i had been reading. do you no of any source code or 'tutorials' on the subject. and dont really have any experience on this subject at all. i understand the theory but dont really no how to implement it
benchparkgreen,
Some quick research has lead me to some useful information. First, OpenGL does have extensions which provide similar functionality as is available with DirectX's Pixel and Vertex Shaders. The OpenGL extensions are ARB_vertex_program and ARB_fragment_program. Doing a google search on these terms or going directly to www.opengl.org should provide you with some useful demos and tutorials.
As well, there is a high level shader language that is provided by nVidia called Cg (C for Graphics). This language looks similar to C and has a compiler which you can obtain from nVidia free of charge. Whenever you compile a program in Cg it can be converted into assembly supported by OpenGL's extensions mentioned above. This can then be used by video hardware to compute per-pixel lighting.
Good Luck!
Some quick research has lead me to some useful information. First, OpenGL does have extensions which provide similar functionality as is available with DirectX's Pixel and Vertex Shaders. The OpenGL extensions are ARB_vertex_program and ARB_fragment_program. Doing a google search on these terms or going directly to www.opengl.org should provide you with some useful demos and tutorials.
As well, there is a high level shader language that is provided by nVidia called Cg (C for Graphics). This language looks similar to C and has a compiler which you can obtain from nVidia free of charge. Whenever you compile a program in Cg it can be converted into assembly supported by OpenGL's extensions mentioned above. This can then be used by video hardware to compute per-pixel lighting.
Good Luck!
Jeromy Walsh
Sr. Tools & Engine Programmer | Software Engineer
Microsoft Windows Phone Team
Chronicles of Elyria (An In-development MMORPG)
GameDevelopedia.com - Blog & Tutorials
GDNet Mentoring: XNA Workshop | C# Workshop | C++ Workshop
"The question is not how far, the question is do you possess the constitution, the depth of faith, to go as far as is needed?" - Il Duche, Boondock Saints
Sr. Tools & Engine Programmer | Software Engineer
Microsoft Windows Phone Team
Chronicles of Elyria (An In-development MMORPG)
GameDevelopedia.com - Blog & Tutorials
GDNet Mentoring: XNA Workshop | C# Workshop | C++ Workshop
"The question is not how far, the question is do you possess the constitution, the depth of faith, to go as far as is needed?" - Il Duche, Boondock Saints
for anyone interested in the basics of phong shading i found a good coded example at
http://cs1.bradley.edu/public/jcm/cs535PhongExample.html
its just a simple 2D implementation but can easily be changed into 3D.
it just uses glPoints to represent points on a circle rather than changing pixels on a screen.
hope it helps someone!
http://cs1.bradley.edu/public/jcm/cs535PhongExample.html
its just a simple 2D implementation but can easily be changed into 3D.
it just uses glPoints to represent points on a circle rather than changing pixels on a screen.
hope it helps someone!
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement