Archived

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

SoaringTortoise

D3DSHADE_GOURAUD & D3DSHADE_PHONG

Recommended Posts

mohamed adel    174
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
mohamed adel    174
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
mohamed adel    174
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