I see a clear difference between flat interpolation and Gouraud/Phong, but the two latter look pixel-identical to me. I’ve tried with specular=1, high and low specular powers, and still can’t spot any difference, except that the vtkOpenGLProperty object reports it’s using one or the other. Is there any requirement from the graphics driver? Any particular setting where I could see their difference? Sample images?
Gourand computes post lit color at the points, then interpolates the color across the cell. Phong interpolates the normal across the cell computing post lit colors at many places across the cell.
There is a difference between the" phong lighting model" and “phong shading”.
I’m aware of the theoretical differences, and the picture does indeed show a clear difference. However, I still don’t see any difference in my local renderings, they both look more like right ball (which I believe is Phong). Can you see any difference with this?
import vtk # create a rendering window and renderer ren = vtk.vtkRenderer() renWin = vtk.vtkRenderWindow() renWin.AddRenderer(ren) # create a renderwindowinteractor iren = vtk.vtkRenderWindowInteractor() iren.SetRenderWindow(renWin) # create source source = vtk.vtkSphereSource() source.SetCenter(0,0,0) source.SetRadius(5.0) # mapper mapper = vtk.vtkPolyDataMapper() if vtk.VTK_MAJOR_VERSION <= 5: mapper.SetInput(source.GetOutput()) else: mapper.SetInputConnection(source.GetOutputPort()) # actor actor = vtk.vtkActor() actor.SetMapper(mapper) actor.GetProperty().SetDiffuseColor(1,0,0) actor.GetProperty().SetDiffuse(1) actor.GetProperty().SetSpecular(1) actor.GetProperty().SetSpecularPower(30.0) #actor.GetProperty().SetInterpolationToGouraud() actor.GetProperty().SetInterpolationToPhong() # assign actor to the renderer ren.AddActor(actor) light = vtk.vtkLight() light.SetPosition(10, 10, 10) light.SetColor(1.0, 1.0, 1.0) light.SetLightTypeToCameraLight() #ren.AutomaticLightCreationOff() ren.AddLight(light) # enable user interface interactor iren.Initialize() iren.SetInteractorStyle(vtk.vtkInteractorStyleTrackballCamera()) renWin.Render() iren.Start()
I’m running VTK 8.1.0, with python 2.7 or 3.4, on an Intel integrated graphics card (Ubuntu 14.04).
Set the tesselatiaon of your sphere source to a very small number, like 6, and you should see a difference.
It’s already quite small (the default, 8), setting it to 6 or 3 doesn’t bring up any difference. If I understand it correctly, with Gouraud I shouldn’t be able to see a small highlight in the center of a large triangular face, with its 3 corners highlight-less… well, I see it, just the same as with Phong. For more information, I’m using the VTK installed through pip.