[x3d-public] visual shape differencing with x3d

Andreas Plesch andreasplesch at gmail.com
Thu Jul 6 05:08:14 PDT 2023


It would be best to check the spec. but glTF typically multiplies material
parameters with corresponding texture map values. I would expect that the
material alpha is multiplied with the texture alpha to get an effective
alpha. Then the example uses MASK mode to threshold that effective alpha to
fully opaque or transparent. Opaque in the example means transmissive for
fancy transparency independent from alpha.

I did not look more closely at the glTF json or spec. and there are
probably other things going on as well.

Hope that helps,

Andreas

On Thu, Jul 6, 2023, 12:14 AM Joseph D Williams <joedwil at earthlink.net>
wrote:

>
>
>    - then uses an alpha texture to define the hole:
>
>
>
> What I am seeing is where the texture isn’t painted, the shape is
> completely transparent.
>
>
>
>    - .. window example uses another technique to model holes.
>
>
>
> So; how do I get it to show the material, instead of making material
> transparency 1 for high (presumably) alpha areas of the texture?.
>
> In fact, if I make the Material transparent, ImageTexture and Shape all
> disappear. That is, the texture can become transparent by changing Material.
>
> So the texture alpha overrides Material transparency and Material
> transparency can somehow control in some way to override texture alpha.
> Seems to me more like the texture high alpha areas should expose the
> Material. After all, the material transparency overrides texture alpha. Do
> mid-alphas allow material to show?
>
> Thanks,
>
> Joe
>
>
>
> *From: *Andreas Plesch <andreasplesch at gmail.com>
> *Sent: *Wednesday, July 5, 2023 2:37 PM
> *To: *X3D Graphics public mailing list <x3d-public at web3d.org>
> *Subject: *Re: [x3d-public] visual shape differencing with x3d
>
>
>
> Thanks for the nice glTF example.
>
>
>
> 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:
>
>
>
>
> https://github.com/KhronosGroup/glTF-Sample-Assets/blob/main/Models/GlassBrokenWindow/glTF/WindowGlass_ColorAlpha.png
>
>
>
> 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.
>
>
>
> Andreas
>
>
> Date: Wed, 5 Jul 2023 08:33:41 -0700
> From: Leonard Daly <Leonard.Daly at realism.com>
> To: x3d-public at web3d.org
> Subject: Re: [x3d-public] visual shape differencing with x3d
> Message-ID: <2b27d08a-6db9-4f5b-27f6-5409fc631dc4 at realism.com>
> Content-Type: text/plain; charset="utf-8"; Format="flowed"
>
> Hi Andreas,
>
> The BrokenWindow glTF model
> (
> https://github.com/KhronosGroup/glTF-Sample-Assets/blob/main/Models/GlassBrokenWindow/README.md)
>
> 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
>
> https://github.khronos.org/glTF-Sample-Viewer-Release/?model=https://raw.GithubUserContent.com/KhronosGroup/glTF-Sample-Assets/main/./Models/GlassBrokenWindow/glTF-Binary/GlassBrokenWindow.glb
>
> There is a discussion of various alpha modes at
>
> https://github.com/KhronosGroup/glTF-Sample-Assets/blob/main/Models/AlphaBlendModeTest/README.md
>
> 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.
>
> Custom and embedded shaders were removed in glTF 2.0 for security and
> other reasons.
>
> Leonard
>
>
>
> On 7/3/2023 8:51 AM, Andreas Plesch wrote:
> > 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.
> >
> >
> https://andreasplesch.github.io/Library/Viewer/index.html?url=https://gist.githubusercontent.com/andreasplesch/415d151abee114858c79c20c8c4b49e0/raw/0e8e270901077a2165d9d99b139eab27c10b0584/BoxWithHoles183.x3d
> > 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:
> > https://github.com/KhronosGroup/glTF/issues/822
> >
> > 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:
> >
> https://github.com/KhronosGroup/glTF-Sample-Models/blob/master/2.0/AlphaBlendModeTest/README.md
> .
> > 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)
> > <brutzman at nps.edu>  wrote:
> >> 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)
> >> https://en.wikipedia.org/wiki/Constructive_solid_geometry
> >>
> >>
> >>
> >> 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/Brbrutzman at nps.edu
> >>
> >> Watkins 270,  MOVES Institute, Monterey CA 93943-5000 USA
> +1.831.656.2149
> >>
> >> X3D graphics, virtual worlds, navy roboticshttps://
> faculty.nps.edu/brutzman
> >>
> >>
> >>
> >> -----Original Message-----
> >> From: x3d-public<x3d-public-bounces at web3d.org>  On Behalf Of Andreas
> Plesch
> >> Sent: Sunday, July 2, 2023 9:20 AM
> >> To: X3D Graphics public mailing list<x3d-public at web3d.org>
> >> 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:
> >>
> >>
> >>
> >>
> 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
> >>
> >>
> >>
> >> _______________________________________________
> >>
> >> x3d-public mailing list
> >>
> >> x3d-public at web3d.org
> >>
> >> http://web3d.org/mailman/listinfo/x3d-public_web3d.org
> >
> >
> --
> *Leonard Daly*
> 3D Systems Engineering
> President, Daly Realism - /Creating the Future/
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL: <
> http://web3d.org/pipermail/x3d-public_web3d.org/attachments/20230705/ce3ca302/attachment.html
> >
>
> ------------------------------
>
> Subject: Digest Footer
>
> _______________________________________________
> x3d-public mailing list
> x3d-public at web3d.org
> http://web3d.org/mailman/listinfo/x3d-public_web3d.org
>
>
> ------------------------------
>
> End of x3d-public Digest, Vol 172, Issue 24
> *******************************************
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://web3d.org/pipermail/x3d-public_web3d.org/attachments/20230706/8a0b59cb/attachment-0001.html>


More information about the x3d-public mailing list