Realtime Boolean Shader in Maya Viewport

We are looking for a shader (or to build one with ShaderFX) that does the same as the Arnold ClipGeo.
In Modo those are called ‘Render Booleans’

Arnold’s ClipGeo is a great shader that opens up a lot of unique workflows.
The problem is that this happens at rendertime. So there is no way that Animators can preview this in the Maya viewport.

Here is an example of what we’d like to achieve. But with the classic booleans.
It’s a simple ‘punch hole’ boolean of a sphere and a deformed cylinder. (Possible Easy/Versatile and Fast workflow for cartoony Facials!)

ShaderFx_BooleanShader_002.gif

The problem is that the classic booleans are way too slow to use in animation, do cause the geometry to be unstable and are messing with the vertex-count/order.

But how should one implement this in the Maya Viewport… ?

I’m allowed only 1 embedded media file as a new user so excuse me for the multiple posts…

We could also use a ‘TRANSPARENCY MAP’ to achieve the same result (fast + clean geo + point order unchanged)
But there’s no way to control the transparency map directly from Maya.

My pinky tells me that there must be a solution using ShaderFX to make ‘@ Render Booleans’.

Halfway there:
We managed to make an intersection colorSet in Bifrost and link this colorSet to the opacity of the viewport shader in ShaderFX.

mitchs_0-1718187232890.png

I’m allowed only 1 embedded media file as a new user so excuse me for the multiple posts…

ShaderFX_Boolean_wire_Hires.gif

I’m allowed only 1 embedded media file as a new user so excuse me for the multiple posts…

ShaderFX_Boolean_Hires.gif

But we cannot use this in production:
The resolution of the mesh/vertex-map needs to be high enough to properly display.
Bifrost bottlenecks when calculating the intersecting verts on a hires mesh…
Framerate drops from over 200fps to 40fps

I’m allowed only 1 embedded media file as a new user so excuse me for the multiple posts…

Blistering fast but insufficient quality @lores

mitchs_1-1718187704876.png

I’m allowed only 1 embedded media file as a new user so excuse me for the multiple posts…

mitchs_2-1718187752371.png

I’m allowed only 1 embedded media file as a new user so excuse me for the multiple posts…

Acceptable quality but way too slow @hires:

mitchs_3-1718187832205.png

I’m allowed only 1 embedded media file as a new user so excuse me for the multiple posts…

mitchs_4-1718187869070.png

So we are looking for a resolution (subdiv) independent solution @shader-level. ShaderFX is probably the way to go but we don’t have the expertise:

  • Mimic the Bifrost workflow in ShaderFX.
    In short: Dot product of the vectors of the closest points and the intersecting object’s normals. negative dotproducts do intersect/positive do not.
  • Another approach would be to transfer the occlusion casted by the intersection object to the opacity or transparency in ShaderFX

But the best would be to have full fledged boolean viewport shader (similar to Arnold’s clipGeo)
Like the code on shadertoy : https://www.shadertoy.com/view/mlfGRM

But how should one implement this in the Maya Viewport… ?