# Process hardware cliping using implicit function

**URL:** https://discourse.vtk.org/t/process-hardware-cliping-using-implicit-function/8635
**Category:** Support
**Created:** [May 31, 2022, 5:49am UTC](https://discourse.vtk.org/t/process-hardware-cliping-using-implicit-function/8635 "2022-05-31T05:49:07Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![xxyyy159](https://discourse.vtk.org/user_avatar/discourse.vtk.org/xxyyy159/32/4528_2.png) [@xxyyy159](https://discourse.vtk.org/u/xxyyy159)
#### Post date: [May 31, 2022, 5:49am UTC](https://discourse.vtk.org/t/process-hardware-cliping-using-implicit-function/8635/1 "2022-05-31T05:49:07Z")

</div>

vtkAbstractMapper provides a function,SetClippingPlanes, to cut the actor at hardware level,which might be several magnitudes faster. But I can’t set implicit function to it to get specific shape like below.

```auto
    vtkNew<vtkImplicitBoolean> boolean;
    boolean->SetOperationTypeToIntersection();
    boolean->AddFunction(p1);
    boolean->AddFunction(p2);
    boolean->AddFunction(p3);
    boolean->AddFunction(p4);

```

If there are any methods to do so please let me know.

---

<div class="post-metadata">

### Author: ![mau\_igna\_06](https://discourse.vtk.org/user_avatar/discourse.vtk.org/mau_igna_06/32/8064_2.png) [@mau\_igna\_06](https://discourse.vtk.org/u/mau_igna_06)
#### Post date: [May 31, 2022, 9:33am UTC](https://discourse.vtk.org/t/process-hardware-cliping-using-implicit-function/8635/2 "2022-05-31T09:33:04Z")

</div>

Please check this out:

> <https://github.com/Kitware/VTK/blob/6ec7669b382808d91d75d97be715b732e1cf3510/Rendering/VolumeOpenGL2/vtkOpenGLGPUVolumeRayCastMapper.cxx#L1325>

---

<div class="post-metadata">

### Author: ![xxyyy159](https://discourse.vtk.org/user_avatar/discourse.vtk.org/xxyyy159/32/4528_2.png) [@xxyyy159](https://discourse.vtk.org/u/xxyyy159)
#### Post date: [June 1, 2022, 6:25am UTC](https://discourse.vtk.org/t/process-hardware-cliping-using-implicit-function/8635/3 "2022-06-01T06:25:56Z")

</div>

I post a gif below to to show the result that the implicit function with four planes cuts a piece of mass out of a sphere.  
And I tested the function you provided with the same planes, nothing was left in the renderer, much the same with what I experienced before.  
 ![want](https://discourse.vtk.org/uploads/default/original/2X/4/43c4e0231a680292d21675792325e726124bdb96.gif)

---

<div class="post-metadata">

### Author: ![mau\_igna\_06](https://discourse.vtk.org/user_avatar/discourse.vtk.org/mau_igna_06/32/8064_2.png) [@mau\_igna\_06](https://discourse.vtk.org/u/mau_igna_06)
#### Post date: [June 1, 2022, 7:58am UTC](https://discourse.vtk.org/t/process-hardware-cliping-using-implicit-function/8635/4 "2022-06-01T07:58:11Z")

</div>

Maybe you need to create your own shader for this class  
[https://vtk.org/doc/nightly/html/classvtkOpenGLPolyDataMapper.html](https://vtk.org/doc/nightly/html/classvtkOpenGLPolyDataMapper.html)

I guess you would need to give different scalar values to the inside and the outside regions

Edit:

> I’m not sure you can achieve want you want with a a mapper.  
> Unless you are rendering a tetrahedral mesh maybe.  
> Maybe you want to use a vtkClipPolyData and a vtkAppendFilter, but I’m not sure if it will work at the end

---

<div class="post-metadata">

### Author: ![xxyyy159](https://discourse.vtk.org/user_avatar/discourse.vtk.org/xxyyy159/32/4528_2.png) [@xxyyy159](https://discourse.vtk.org/u/xxyyy159)
#### Post date: [June 2, 2022, 4:09am UTC](https://discourse.vtk.org/t/process-hardware-cliping-using-implicit-function/8635/5 "2022-06-02T04:09:45Z")

</div>

> [@mau\_igna\_06](#):
>
> shader

That’s pretty hardcore for me. I’m looking for a solution to process cliping faster than vtkTableBasedClipDataSet with 10 milions of cells rendering together and dynamically updating the result after per cliping.
