• Advertisement

Archived

This topic is now archived and is closed to further replies.

D3DSHADE_GOURAUD & D3DSHADE_PHONG

This topic is 5439 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

What''s the difference between these, and why isn''t Phong supported yet (if even only in software)? Learning to fly is easy, but as a tortoise, the landings are really rough.

Share this post


Link to post
Share on other sites
Advertisement
1-In GOURAUD shading you perform a dot product operation between (the normal on each vertex and the vector between the vertex and the light source) to get the color of the vertex.then interpolation is done on the whole face to find the color of each pixel.
2-In phong shading,at each pixel interpolation for the normals is done to find the normal at each pixel,then dot product between (the normal and the vector between the pixel and the light source) is done to find the color at each pixel.

as you see,phong shading is more realistic and more accurate ,but is very slow as the dot produt operation is done once for each pixel,while GOURAUD shading is done once for each vertex.for this reason phong shading is not supported in the fixed functin pipeline.
3-there are two ways to perform phong shading though it is not supported

a)Increasing the number of vertices very much of the model you are rendering.
b)using the vertex and pixel shaders ,you can enter the normals as texture coordinates as interpolation is always done for texture coordinates,and then calculate the color for each pixel using the dot product operation.there is a source code by wolfGang on his site of shaderx.com using this technique.

Share this post


Link to post
Share on other sites
1-In GOURAUD shading you perform a dot product operation between (the normal on each vertex and the vector between the vertex and the light source) to get the color of the vertex.then interpolation is done on the whole face to find the color of each pixel.
2-In phong shading,at each pixel interpolation for the normals is done to find the normal at each pixel,then dot product between (the normal and the vector between the pixel and the light source) is done to find the color at each pixel.

as you see,phong shading is more realistic and more accurate ,but is very slow as the dot produt operation is done once for each pixel,while GOURAUD shading is done once for each vertex.for this reason phong shading is not supported in the fixed functin pipeline.
3-there are two ways to perform phong shading though it is not supported

a)Increasing the number of vertices very much of the model you are rendering.
b)using the vertex and pixel shaders ,you can enter the normals as texture coordinates as interpolation is always done for texture coordinates,and then calculate the color for each pixel using the dot product operation.there is a source code by wolfGang on his site of shaderx.com using this technique.

Share this post


Link to post
Share on other sites
1-In GOURAUD shading you perform a dot product operation between (the normal on each vertex and the vector between the vertex and the light source) to get the color of the vertex.then interpolation is done on the whole face to find the color of each pixel.
2-In phong shading,at each pixel interpolation for the normals is done to find the normal at each pixel,then dot product between (the normal and the vector between the pixel and the light source) is done to find the color at each pixel.

as you see,phong shading is more realistic and more accurate ,but is very slow as the dot produt operation is done once for each pixel,while GOURAUD shading is done once for each vertex.for this reason phong shading is not supported in the fixed functin pipeline.
3-there are two ways to perform phong shading though it is not supported

a)Increasing the number of vertices very much of the model you are rendering.
b)using the vertex and pixel shaders ,you can enter the normals as texture coordinates as interpolation is always done for texture coordinates,and then calculate the color for each pixel using the dot product operation.there is a source code by wolfGang on his site of shaderx.com using this technique.

Share this post


Link to post
Share on other sites
Just a little note: The act of "Gouraud" shading means interpolating between vertex colors as you''re rasterizing the triangle. i.e. It works even when lighting''s disabled.

Cheers,
Muhammad Haggag

Share this post


Link to post
Share on other sites

  • Advertisement