<div dir="auto">Sorry to hear that custom shaders were removed from glTF.  I fear this doesn’t bode well for their use in x3dom, x_ite and PlayCanvas.   What is the alternative for performative animated surfaces, like warped spheres?</div><div dir="auto"><br></div><div dir="auto">Can we have a serious discussion about this?  How do i do something like animated math?</div><div dir="auto"><br></div><div dir="auto">With reflection, refraction, declarative etc.</div><div dir="auto"><br></div><div dir="auto">Here’s one of my requirements:</div><div dir="auto"><br></div><div dir="auto"><div><a href="https://playcanv.as/p/wQgQBgkE/">https://playcanv.as/p/wQgQBgkE/</a></div><br></div><div dir="auto">I don’t think raytracing is a requirement.</div><div dir="auto"><br></div><div dir="auto">I did warn a security expert that there might be an issue with shaders on the web a very long time ago.</div><div dir="auto"><br></div><div dir="auto">Is this forcing people to use webgpu?</div><div dir="auto"><br></div><div dir="auto">Should we bring back FVRML and FX3D?</div><div dir="auto"><br></div><div dir="auto">John </div><div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Jul 5, 2023 at 10:34 AM Leonard Daly <<a href="mailto:Leonard.Daly@realism.com">Leonard.Daly@realism.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;padding-left:1ex;border-left-color:rgb(204,204,204)">
  
    
  
  <div>
    <p>Hi Andreas,</p>
    <p>The BrokenWindow glTF model
(<a href="https://github.com/KhronosGroup/glTF-Sample-Assets/blob/main/Models/GlassBrokenWindow/README.md" target="_blank">https://github.com/KhronosGroup/glTF-Sample-Assets/blob/main/Models/GlassBrokenWindow/README.md</a>)
      shows the use of transparency (for the glass) and alpha masking
      (not blending) for the "holes" (actually breaks). You can see the
      model and work with various backgrounds at
<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" 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></p>
    <p>There is a discussion of various alpha modes at
<a href="https://github.com/KhronosGroup/glTF-Sample-Assets/blob/main/Models/AlphaBlendModeTest/README.md" target="_blank">https://github.com/KhronosGroup/glTF-Sample-Assets/blob/main/Models/AlphaBlendModeTest/README.md</a><br>
    </p>
    <p>glTF uses transparency for "see through" material. Alpha blending
      is use when a transition from one material to another is required.
      For example metallic coating on a surface that goes from fully
      opaque to fully transparent over a visible distance.<br>
    </p>
    <p>Custom and embedded shaders were removed in glTF 2.0 for security
      and other reasons.</p>
    <p>Leonard</p></div><div>
    <p><br>
    </p>
    <p><br>
    </p>
    <div>On 7/3/2023 8:51 AM, Andreas Plesch
      wrote:<br>
    </div>
    <blockquote type="cite">
      <pre style="font-family:monospace">Thanks, Don, for the positive feedback.

Let me just adjust expectations a bit. This is a useful technique but
only approximates actual CSG. The full hole shape is always rendered
which means it may obscure other shapes in addition to the intended
shape. This can be mitigated by making the hole shape only protrude a
little bit outside of the solid shape intended to become cut out.
Also, the way sorting works in x3dom the solid shape has to have a
nominal amount of transparency to ensure it is rendered after the
transparent hole shape, using the explicit sortkey.

On the plus side, the technique allows for material inside the
cutouts, eg. tinted, shiny glass windows.

<a href="https://andreasplesch.github.io/Library/Viewer/index.html?url=https://gist.githubusercontent.com/andreasplesch/415d151abee114858c79c20c8c4b49e0/raw/0e8e270901077a2165d9d99b139eab27c10b0584/BoxWithHoles183.x3d" target="_blank" style="font-family:monospace">https://andreasplesch.github.io/Library/Viewer/index.html?url=https://gist.githubusercontent.com/andreasplesch/415d151abee114858c79c20c8c4b49e0/raw/0e8e270901077a2165d9d99b139eab27c10b0584/BoxWithHoles183.x3d</a>
is slightly updated with a longer cone.

With regards to glTF, it looks like glTF v.1.0 had the option to
define a custom transparent rendering technique with depthmask=true.
But the now prevalent glTF v.2.0 does not seem to have explicit
depthmask control.

Here is a related, complicated discussion which mentions cutouts:
<a href="https://github.com/KhronosGroup/glTF/issues/822" target="_blank" style="font-family:monospace">https://github.com/KhronosGroup/glTF/issues/822</a>

It may be that glTF has an alphablend mode which enables cutouts,
instead of standard blending. This may then also imply enabled
z-buffer rendering. But the official glTF alpphablendmode test does
not test for cutouts:
<a href="https://github.com/KhronosGroup/glTF-Sample-Models/blob/master/2.0/AlphaBlendModeTest/README.md" target="_blank" style="font-family:monospace">https://github.com/KhronosGroup/glTF-Sample-Models/blob/master/2.0/AlphaBlendModeTest/README.md</a>.
So I do not think currently glTF has that capability although it had
been discussed and there may be a glTF extension for that.

Like depthmask sorting seems to be considered exclusively in the
domain of the viewer which implements glTF.

All the best, Andreas

On Sun, Jul 2, 2023 at 10:13 PM Brutzman, Donald (Don) (CIV)
<a href="mailto:brutzman@nps.edu" target="_blank" style="font-family:monospace"><brutzman@nps.edu></a> wrote:
</pre>
      <blockquote type="cite">
        <pre style="font-family:monospace">Andreas, thanks for sharing on x3d public mailing list.  Agreed that this is an extremely powerful rendering technique - high "wow factor" for sure.



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.



Wikipedia: Constructive solid geometry (CSG)
<a href="https://en.wikipedia.org/wiki/Constructive_solid_geometry" target="_blank" style="font-family:monospace">https://en.wikipedia.org/wiki/Constructive_solid_geometry</a>



Avoiding the need for any geometry modification whatsoever when creating visual "holes" - totally sidestepping CSG modeling - seems quite novel.



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.



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.



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...


Congratulations on what seems to be a major achievement!  8)



all the best, Don

--

Don Brutzman  Naval Postgraduate School, Code USW/Br        <a href="mailto:brutzman@nps.edu" target="_blank" style="font-family:monospace">brutzman@nps.edu</a>

Watkins 270,  MOVES Institute, Monterey CA 93943-5000 USA    +1.831.656.2149

X3D graphics, virtual worlds, navy robotics <a href="https://faculty.nps.edu/brutzman" target="_blank" style="font-family:monospace">https://faculty.nps.edu/brutzman</a>



-----Original Message-----
From: x3d-public <a href="mailto:x3d-public-bounces@web3d.org" target="_blank" style="font-family:monospace"><x3d-public-bounces@web3d.org></a> On Behalf Of Andreas Plesch
Sent: Sunday, July 2, 2023 9:20 AM
To: X3D Graphics public mailing list <a href="mailto:x3d-public@web3d.org" target="_blank" style="font-family:monospace"><x3d-public@web3d.org></a>
Subject: [x3d-public] visual shape differencing with x3d



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:



<a href="https://andreasplesch.github.io/Library/Viewer/index.html?url=https://gist.githubusercontent.com/andreasplesch/415d151abee114858c79c20c8c4b49e0/raw/4c70463321df267b28298462af76b869adbfdfdb/BoxWithHoles183.x3d" target="_blank" style="font-family:monospace">https://andreasplesch.github.io/Library/Viewer/index.html?url=https://gist.githubusercontent.com/andreasplesch/415d151abee114858c79c20c8c4b49e0/raw/4c70463321df267b28298462af76b869adbfdfdb/BoxWithHoles183.x3d</a>





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



_______________________________________________

x3d-public mailing list

<a href="mailto:x3d-public@web3d.org" target="_blank" style="font-family:monospace">x3d-public@web3d.org</a>

<a href="http://web3d.org/mailman/listinfo/x3d-public_web3d.org" target="_blank" style="font-family:monospace">http://web3d.org/mailman/listinfo/x3d-public_web3d.org</a>
</pre>
      </blockquote>
      <pre style="font-family:monospace">

</pre>
    </blockquote>
    <div>-- <br>
      <b>Leonard Daly</b><br>
      3D Systems Engineering<br>
      President, Daly Realism - <i>Creating the Future</i><br>
    </div>
  </div>

_______________________________________________<br>
x3d-public mailing list<br>
<a href="mailto:x3d-public@web3d.org" target="_blank">x3d-public@web3d.org</a><br>
<a href="http://web3d.org/mailman/listinfo/x3d-public_web3d.org" rel="noreferrer" target="_blank">http://web3d.org/mailman/listinfo/x3d-public_web3d.org</a><br>
</blockquote></div></div>