[x3d-public] visual shape differencing with x3d
Andreas Plesch
andreasplesch at gmail.com
Sun Jul 2 09:20:12 PDT 2023
Let me share that we found that it is possible to simulate
differencing of shapes in x3dom to a useful degree. This allows for
transparent cutouts or holes:
https://andreasplesch.github.io/Library/Viewer/index.html?url=https://gist.githubusercontent.com/andreasplesch/415d151abee114858c79c20c8c4b49e0/raw/4c70463321df267b28298462af76b869adbfdfdb/BoxWithHoles183.x3d
The idea is to draw first transparent shapes which define the holes,
including to the depth buffer. Then standard drawing of the solid
shape will be hidden where the holes 'obscure' it (although the holes
are actually transparent).
To do that requires two changes to default rendering of transparent
shapes. For best rendering normally transparent shapes are rendered
last and do not write to the depth buffer. Here they are drawn first
and do write to the depth buffer.
In x3dom this is implemented by allowing explicit definition of the
sort (rendering) order of shapes (with a sortKey field), and by
allowing direct access to the gl depthmask function with a Depthmode
node.
An easy way to generate cutouts or holes which is otherwise only
possible with external CSG tools is a powerful use case for these
lower-level x3d extensions. Perhaps other browsers have similar
features or are inspired to consider those.
Andreas
--
Andreas Plesch
Waltham, MA 02453
More information about the x3d-public
mailing list