specular.py 708 B

123456789101112131415161718192021222324252627282930313233
  1. """Setting illumination properties:
  2. ambient, diffuse, specular power and color."""
  3. from vedo import Plotter, Mesh, dataurl
  4. ambient = 0.1
  5. diffuse = 0
  6. specular = 0
  7. specular_power = 20
  8. specular_color = "white"
  9. apple = Mesh(dataurl + "apple.ply")
  10. apple.flat().c("gold")
  11. plt = Plotter(axes=1, bg='black', bg2='white')
  12. for i in range(8):
  13. x = (i % 4) * 2.2
  14. y = int(i < 4) * 3
  15. apple_copy = apple.clone().pos(x, y)
  16. # modify the default with specific values
  17. apple_copy.lighting(
  18. "default", ambient, diffuse,
  19. specular, specular_power, specular_color
  20. )
  21. plt += apple_copy
  22. ambient += 0.125
  23. diffuse += 0.125
  24. specular+= 0.125
  25. plt += __doc__
  26. plt.show().close()