<div dir="auto"><div>Thanks for the nice glTF example.</div><div dir="auto"><br></div><div dir="auto">It turns that the broken window example uses another technique to model holes. It uses a single shape for the window and then uses an alpha texture to define the hole:</div><div dir="auto"><br></div><div dir="auto"><a href="https://github.com/KhronosGroup/glTF-Sample-Assets/blob/main/Models/GlassBrokenWindow/glTF/WindowGlass_ColorAlpha.png">https://github.com/KhronosGroup/glTF-Sample-Assets/blob/main/Models/GlassBrokenWindow/glTF/WindowGlass_ColorAlpha.png</a></div><div dir="auto"><br></div><div dir="auto">Textures are probably a more standard way to have cutouts but are less applicable to shape differencing or CSG. So the depthmask plus sort order technique solves a different problem which glTF cannot directly address. </div><div dir="auto"><br></div><div dir="auto">Andreas<br><div class="gmail_quote" dir="auto"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><br>
Date: Wed, 5 Jul 2023 08:33:41 -0700<br>
From: Leonard Daly <<a href="mailto:Leonard.Daly@realism.com" target="_blank" rel="noreferrer">Leonard.Daly@realism.com</a>><br>
To: <a href="mailto:x3d-public@web3d.org" target="_blank" rel="noreferrer">x3d-public@web3d.org</a><br>
Subject: Re: [x3d-public] visual shape differencing with x3d<br>
Message-ID: <<a href="mailto:2b27d08a-6db9-4f5b-27f6-5409fc631dc4@realism.com" target="_blank" rel="noreferrer">2b27d08a-6db9-4f5b-27f6-5409fc631dc4@realism.com</a>><br>
Content-Type: text/plain; charset="utf-8"; Format="flowed"<br>
<br>
Hi Andreas,<br>
<br>
The BrokenWindow glTF model <br>
(<a href="https://github.com/KhronosGroup/glTF-Sample-Assets/blob/main/Models/GlassBrokenWindow/README.md" rel="noreferrer noreferrer" target="_blank">https://github.com/KhronosGroup/glTF-Sample-Assets/blob/main/Models/GlassBrokenWindow/README.md</a>) <br>
shows the use of transparency (for the glass) and alpha masking (not <br>
blending) for the "holes" (actually breaks). You can see the model and <br>
work with various backgrounds at <br>
<a href="https://github.khronos.org/glTF-Sample-Viewer-Release/?model=https://raw.GithubUserContent.com/KhronosGroup/glTF-Sample-Assets/main/./Models/GlassBrokenWindow/glTF-Binary/GlassBrokenWindow.glb" rel="noreferrer noreferrer" target="_blank">https://github.khronos.org/glTF-Sample-Viewer-Release/?model=https://raw.GithubUserContent.com/KhronosGroup/glTF-Sample-Assets/main/./Models/GlassBrokenWindow/glTF-Binary/GlassBrokenWindow.glb</a><br>
<br>
There is a discussion of various alpha modes at <br>
<a href="https://github.com/KhronosGroup/glTF-Sample-Assets/blob/main/Models/AlphaBlendModeTest/README.md" rel="noreferrer noreferrer" target="_blank">https://github.com/KhronosGroup/glTF-Sample-Assets/blob/main/Models/AlphaBlendModeTest/README.md</a><br>
<br>
glTF uses transparency for "see through" material. Alpha blending is use <br>
when a transition from one material to another is required. For example <br>
metallic coating on a surface that goes from fully opaque to fully <br>
transparent over a visible distance.<br>
<br>
Custom and embedded shaders were removed in glTF 2.0 for security and <br>
other reasons.<br>
<br>
Leonard<br>
<br>
<br>
<br>
On 7/3/2023 8:51 AM, Andreas Plesch wrote:<br>
> Thanks, Don, for the positive feedback.<br>
><br>
> Let me just adjust expectations a bit. This is a useful technique but<br>
> only approximates actual CSG. The full hole shape is always rendered<br>
> which means it may obscure other shapes in addition to the intended<br>
> shape. This can be mitigated by making the hole shape only protrude a<br>
> little bit outside of the solid shape intended to become cut out.<br>
> Also, the way sorting works in x3dom the solid shape has to have a<br>
> nominal amount of transparency to ensure it is rendered after the<br>
> transparent hole shape, using the explicit sortkey.<br>
><br>
> On the plus side, the technique allows for material inside the<br>
> cutouts, eg. tinted, shiny glass windows.<br>
><br>
> <a href="https://andreasplesch.github.io/Library/Viewer/index.html?url=https://gist.githubusercontent.com/andreasplesch/415d151abee114858c79c20c8c4b49e0/raw/0e8e270901077a2165d9d99b139eab27c10b0584/BoxWithHoles183.x3d" rel="noreferrer noreferrer" target="_blank">https://andreasplesch.github.io/Library/Viewer/index.html?url=https://gist.githubusercontent.com/andreasplesch/415d151abee114858c79c20c8c4b49e0/raw/0e8e270901077a2165d9d99b139eab27c10b0584/BoxWithHoles183.x3d</a><br>
> is slightly updated with a longer cone.<br>
><br>
> With regards to glTF, it looks like glTF v.1.0 had the option to<br>
> define a custom transparent rendering technique with depthmask=true.<br>
> But the now prevalent glTF v.2.0 does not seem to have explicit<br>
> depthmask control.<br>
><br>
> Here is a related, complicated discussion which mentions cutouts:<br>
> <a href="https://github.com/KhronosGroup/glTF/issues/822" rel="noreferrer noreferrer" target="_blank">https://github.com/KhronosGroup/glTF/issues/822</a><br>
><br>
> It may be that glTF has an alphablend mode which enables cutouts,<br>
> instead of standard blending. This may then also imply enabled<br>
> z-buffer rendering. But the official glTF alpphablendmode test does<br>
> not test for cutouts:<br>
> <a href="https://github.com/KhronosGroup/glTF-Sample-Models/blob/master/2.0/AlphaBlendModeTest/README.md" rel="noreferrer noreferrer" target="_blank">https://github.com/KhronosGroup/glTF-Sample-Models/blob/master/2.0/AlphaBlendModeTest/README.md</a>.<br>
> So I do not think currently glTF has that capability although it had<br>
> been discussed and there may be a glTF extension for that.<br>
><br>
> Like depthmask sorting seems to be considered exclusively in the<br>
> domain of the viewer which implements glTF.<br>
><br>
> All the best, Andreas<br>
><br>
> On Sun, Jul 2, 2023 at 10:13?PM Brutzman, Donald (Don) (CIV)<br>
> <<a href="mailto:brutzman@nps.edu" target="_blank" rel="noreferrer">brutzman@nps.edu</a>> wrote:<br>
>> Andreas, thanks for sharing on x3d public mailing list. Agreed that this is an extremely powerful rendering technique - high "wow factor" for sure.<br>
>><br>
>><br>
>><br>
>> Perhaps of note is that the X3D working group spent a few years pursuing Constructive Solid Geometry (CSG) with little to show for it, since such approaches can be computationally intensive and not well suited to real-time rendering on diverse devices.<br>
>><br>
>><br>
>><br>
>> Wikipedia: Constructive solid geometry (CSG)<br>
>> <a href="https://en.wikipedia.org/wiki/Constructive_solid_geometry" rel="noreferrer noreferrer" target="_blank">https://en.wikipedia.org/wiki/Constructive_solid_geometry</a><br>
>><br>
>><br>
>><br>
>> Avoiding the need for any geometry modification whatsoever when creating visual "holes" - totally sidestepping CSG modeling - seems quite novel.<br>
>><br>
>><br>
>><br>
>> Wondering if this differencing (see-through) technique is possible today using glTF 2.0 models? If a supporting X3D4 player might load it as glTF, then that might be a fast path to usage.<br>
>><br>
>><br>
>><br>
>> Looking ahead, when ready, this seems like the nodes you are using in X3DOM (or some version thereof) might be strong candidates for inclusion in a future X3D 4.1 specification.<br>
>><br>
>><br>
>><br>
>> Meanwhile (as you also recently discussed) we might experiment with extensions to X3D 4.0, perhaps through metadata for forwards/backwards compatibility and validation. (Wish list: the ImageAtlas node never made the cut for X3D 4.0 and seems like a candidate for broader implementation as well.) The X in X3D is Extensibility...<br>
>><br>
>><br>
>> Congratulations on what seems to be a major achievement! 8)<br>
>><br>
>><br>
>><br>
>> all the best, Don<br>
>><br>
>> --<br>
>><br>
>> Don Brutzman Naval Postgraduate School, Code USW/<a href="mailto:Brbrutzman@nps.edu" target="_blank" rel="noreferrer">Brbrutzman@nps.edu</a><br>
>><br>
>> Watkins 270, MOVES Institute, Monterey CA 93943-5000 USA +1.831.656.2149<br>
>><br>
>> X3D graphics, virtual worlds, navy roboticshttps://<a href="http://faculty.nps.edu/brutzman" rel="noreferrer noreferrer" target="_blank">faculty.nps.edu/brutzman</a><br>
>><br>
>><br>
>><br>
>> -----Original Message-----<br>
>> From: x3d-public<<a href="mailto:x3d-public-bounces@web3d.org" target="_blank" rel="noreferrer">x3d-public-bounces@web3d.org</a>> On Behalf Of Andreas Plesch<br>
>> Sent: Sunday, July 2, 2023 9:20 AM<br>
>> To: X3D Graphics public mailing list<<a href="mailto:x3d-public@web3d.org" target="_blank" rel="noreferrer">x3d-public@web3d.org</a>><br>
>> Subject: [x3d-public] visual shape differencing with x3d<br>
>><br>
>><br>
>><br>
>> 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:<br>
>><br>
>><br>
>><br>
>> <a href="https://andreasplesch.github.io/Library/Viewer/index.html?url=https://gist.githubusercontent.com/andreasplesch/415d151abee114858c79c20c8c4b49e0/raw/4c70463321df267b28298462af76b869adbfdfdb/BoxWithHoles183.x3d" rel="noreferrer noreferrer" target="_blank">https://andreasplesch.github.io/Library/Viewer/index.html?url=https://gist.githubusercontent.com/andreasplesch/415d151abee114858c79c20c8c4b49e0/raw/4c70463321df267b28298462af76b869adbfdfdb/BoxWithHoles183.x3d</a><br>
>><br>
>><br>
>><br>
>><br>
>><br>
>> 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).<br>
>><br>
>><br>
>><br>
>> 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.<br>
>><br>
>><br>
>><br>
>> 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.<br>
>><br>
>><br>
>><br>
>> 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.<br>
>><br>
>><br>
>><br>
>> Andreas<br>
>><br>
>><br>
>><br>
>> --<br>
>><br>
>> Andreas Plesch<br>
>><br>
>> Waltham, MA 02453<br>
>><br>
>><br>
>><br>
>> _______________________________________________<br>
>><br>
>> x3d-public mailing list<br>
>><br>
>> <a href="mailto:x3d-public@web3d.org" target="_blank" rel="noreferrer">x3d-public@web3d.org</a><br>
>><br>
>> <a href="http://web3d.org/mailman/listinfo/x3d-public_web3d.org" rel="noreferrer noreferrer" target="_blank">http://web3d.org/mailman/listinfo/x3d-public_web3d.org</a><br>
><br>
><br>
-- <br>
*Leonard Daly*<br>
3D Systems Engineering<br>
President, Daly Realism - /Creating the Future/<br>
-------------- next part --------------<br>
An HTML attachment was scrubbed...<br>
URL: <<a href="http://web3d.org/pipermail/x3d-public_web3d.org/attachments/20230705/ce3ca302/attachment.html" rel="noreferrer noreferrer" target="_blank">http://web3d.org/pipermail/x3d-public_web3d.org/attachments/20230705/ce3ca302/attachment.html</a>><br>
<br>
------------------------------<br>
<br>
Subject: Digest Footer<br>
<br>
_______________________________________________<br>
x3d-public mailing list<br>
<a href="mailto:x3d-public@web3d.org" target="_blank" rel="noreferrer">x3d-public@web3d.org</a><br>
<a href="http://web3d.org/mailman/listinfo/x3d-public_web3d.org" rel="noreferrer noreferrer" target="_blank">http://web3d.org/mailman/listinfo/x3d-public_web3d.org</a><br>
<br>
<br>
------------------------------<br>
<br>
End of x3d-public Digest, Vol 172, Issue 24<br>
*******************************************<br>
</blockquote></div></div></div>