注意
跳至末尾以下載完整的範例程式碼。或者透過 JupyterLite 或 Binder 在您的瀏覽器中執行此範例
照明屬性#
控制渲染網格照明的各個方面,例如環境光、漫射光和鏡面反射光。這些選項僅在 add_mesh
的 lighting
參數為 True
時才有效(預設為 True
)。
您可以透過傳遞 lighting=False
給 add_mesh
來關閉指定網格的所有照明。
首先,讓我們看一下預設照明條件下的網格

沒有照明會怎麼樣呢

鏡面反射屬性的示範
p = pv.Plotter(shape=(1, 2), window_size=[1500, 500])
p.subplot(0, 0)
p.add_mesh(mesh, show_scalar_bar=False)
p.add_text("No Specular")
p.subplot(0, 1)
s = 1.0
p.add_mesh(mesh, specular=s, show_scalar_bar=False)
p.add_text(f"Specular of {s}")
p.link_views()
p.view_isometric()
p.show(cpos=cpos)

僅有鏡面反射

鏡面反射強度

示範三者同時使用

腳本總執行時間: (0 分鐘 10.601 秒)
預估記憶體使用量: 246 MB