hacked shadows
This commit is contained in:
parent
6e98a76e03
commit
5e5a19dd06
22
visu.py
22
visu.py
|
|
@ -1,7 +1,27 @@
|
||||||
def add_domain_bounds(plotter,bounds,color='black',line_width=2.):
|
def add_domain_bounds(plotter,bounds,color='black',line_width=2.):
|
||||||
import pyvista
|
import pyvista
|
||||||
domain = pyvista.Box(bounds=bounds)
|
domain = pyvista.Box(bounds=bounds)
|
||||||
plotter.add_mesh(domain,color=color,style='wireframe',line_width=line_width)
|
plotter.add_mesh(domain,color=color,style='wireframe',line_width=line_width,opacity=0.999,lighting=False)
|
||||||
|
return
|
||||||
|
|
||||||
|
def enable_shadows_hacked():
|
||||||
|
# Reimplements pyvistas "enable_shadows()" method to also render translucent
|
||||||
|
# objects (without shadows). Can be used to add objects which do not throw
|
||||||
|
# shadows (but may look weird) by setting their opacity to a value close to 1,
|
||||||
|
# e.g. 0.999. This is useful when drawing a bounding box using "add_domain_bounds()".
|
||||||
|
import vtk
|
||||||
|
shadows = vtk.vtkShadowMapPass()
|
||||||
|
transl = vtk.vtkTranslucentPass()
|
||||||
|
seq = vtk.vtkSequencePass()
|
||||||
|
passes = vtk.vtkRenderPassCollection()
|
||||||
|
passes.AddItem(shadows.GetShadowMapBakerPass())
|
||||||
|
passes.AddItem(shadows)
|
||||||
|
passes.AddItem(transl)
|
||||||
|
seq.SetPasses(passes)
|
||||||
|
# Tell the renderer to use our render pass pipeline
|
||||||
|
cameraP = vtk.vtkCameraPass()
|
||||||
|
cameraP.SetDelegatePass(seq)
|
||||||
|
pl.renderer.SetPass(cameraP)
|
||||||
return
|
return
|
||||||
|
|
||||||
def setup_camera(pl,bounds,viewvec,dist=None,parallel_projection=False,
|
def setup_camera(pl,bounds,viewvec,dist=None,parallel_projection=False,
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue