[x3d-public] Using IMPORT / EXPORT to selectively include parts of glTF file in X3D, and multiply them as much as necessary

John Carlson yottzumm at gmail.com
Tue Apr 5 01:14:01 PDT 2022


My understanding is that once you set up an IMPORT/EXPORT pair m, you can
create ROUTEs that flow in either direction through.

On Tue, Apr 5, 2022 at 1:30 AM Brutzman, Donald (Don) (CIV) <
brutzman at nps.edu> wrote:

> Correct.  Also, the reason an author might want to do this is easily to
> ROUTE events from parent scene to child scene, or vice versa.  Much less
> work than creating a prototype, too.
>
>
>
>    - https://www.web3d.org/x3d/content/X3dTooltips.html#IMPORT
>
>
>
>
> *IMPORT provides ROUTE access to a node that has a corresponding EXPORT
> statement within an Inline scene. These connections allow event values to
> be passed via ROUTE statements between a parent model and a child Inline
> model.**Hint:*
> * it is good practice to place IMPORT statements next to corresponding
> Inline scenes for readability.**Hint:*
> * see EXPORT statement for corresponding functionality within the related
> Inline model.**Warning:*
> * corresponding parent-scene IMPORT and child Inline-scene EXPORT
> statements are necessary in order to ROUTE values between a parent model
> and a child Inline model.**Hint:** X3D Architecture 4.4.6 Import/Export
> semantics **https://www.web3d.org/specifications/X3Dv4Draft/ISO-IEC19775-1v4-CD1/Part01/concepts.html#ImportExportsemantics
> <https://www.web3d.org/specifications/X3Dv4Draft/ISO-IEC19775-1v4-CD1/Part01/concepts.html#ImportExportsemantics>*
>
>
>
>    - https://www.web3d.org/x3d/content/X3dTooltips.html#EXPORT
>
>
>
>
> *EXPORT exposes a local node for ROUTE passing of event values when the
> current Scene is included via Inline by a parent external world. These
> connections allow event values to be exchanged via ROUTE statements between
> a parent model and a child Inline model.**Hint:*
> * you can place EXPORT statements after Scene tag to show interfaces at
> top.**Hint:*
> * see IMPORT statement for corresponding functionality in the parent
> external world.**Warning:*
> * EXPORT statements are not allowed in prototype declarations.**Warning:*
> * corresponding parent-scene IMPORT and child Inline-scene EXPORT
> statements are necessary in order to ROUTE values between a parent model
> and a child Inline model.**Hint:** X3D Architecture 4.4.6 Import/Export
> semantics **https://www.web3d.org/specifications/X3Dv4Draft/ISO-IEC19775-1v4-CD1/Part01/concepts.html#ImportExportsemantics
> <https://www.web3d.org/specifications/X3Dv4Draft/ISO-IEC19775-1v4-CD1/Part01/concepts.html#ImportExportsemantics>*
>
>
>
> all the best, Don
>
> --
>
> Don Brutzman  Naval Postgraduate School, Code USW/Br
> brutzman at nps.edu
>
> Watkins 270,  MOVES Institute, Monterey CA 93943-5000 USA
> +1.831.656.2149
>
> X3D graphics, virtual worlds, Navy robotics https://
> faculty.nps.edu/brutzman
>
>
>
> *From:* x3d-public <x3d-public-bounces at web3d.org> *On Behalf Of *Michalis
> Kamburelis
> *Sent:* Monday, April 4, 2022 8:00 PM
> *To:* John Carlson <yottzumm at gmail.com>
> *Cc:* X3D Graphics public mailing list <x3d-public at web3d.org>
> *Subject:* Re: [x3d-public] Using IMPORT / EXPORT to selectively include
> parts of glTF file in X3D, and multiply them as much as necessary
>
>
>
> The idea of IMPORT / EXPORT is that you use EXPORT within the "inner"
> file, and then you use Inline and IMPORT statements in the "outer" file to
> bring nodes from inner file into the outer file namespace.
>
>
>
> Regards,
>
> Michalis
>
>
>
> W dniu wt., 5.04.2022 o 04:39 John Carlson <yottzumm at gmail.com>
> napisał(a):
>
> Looks super-exciting Michalis.    I haven’t had much chance to work with
> IMPORT/EXPORT.   Can including file export to an included file?
>
>
>
> J
>
>
>
> On Mon, Apr 4, 2022 at 9:23 PM Michalis Kamburelis <
> michalis.kambi at gmail.com> wrote:
>
> ( No real avocados were hurt while generating screenshots for this email
> :) )
>
> I started to write an answer to Doug email "Other ways to use gltf >
> like ExternProto" and then I realized that I just pursue a different
> approach, so I may as well create a new thread. The goal is similar:
> how to get *part* of glTF scene into X3D file? But here I decided to
> do it using IMPORT / EXPORT + Inline, not ExternProto.
>
> I thought that IMPORT / EXPORT may be nice, as IMPORT / EXPORT have an
> explicit purpose "make something available to the outer scene".
>
> So I tried how far can I take it. And  implemented it in
> CGE/view3dscene, and made demos :) You can now use IMPORT / EXPORT to
> selectively take (and reuse as many times as you wish) parts of inner
> glTF models inside outer X3D file.
>
> 1. Older demo: I have already used this approach for animations in
> glTF in CGE/view3dsdcene, i.e. I export them from glTF and you can
> IMPORT and control them. See
>
> https://github.com/castle-engine/demo-models/tree/master/blender/skinned_animation
> <https://nam10.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fcastle-engine%2Fdemo-models%2Ftree%2Fmaster%2Fblender%2Fskinned_animation&data=04%7C01%7Cbrutzman%40nps.edu%7C90fe545048fe487a05a108da16b073ac%7C6d936231a51740ea9199f7578963378e%7C0%7C0%7C637847244970756710%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=y5Mh8sqteN6MFYSFuR3vlJevG%2FTWs0wUQqxjCjQvmvY%3D&reserved=0>
> , file skinned_anim_run_animations_from_x3d.x3dv does
>
> """
> DEF InlinedAnimations Inline {
>    url "skinned_anim.glb"
> }
> IMPORT InlinedAnimations.jump AS jump
> IMPORT InlinedAnimations.walk AS walk
> """
>
> and then it can start  animations jump, walk. They are just TimeSensor
> nodes in X3D. I can ROUTE events to them.
>
> 2. I have now extended this approach to glTF materials (X3D Appearance
> nodes) and transformation groups and cameras (X3D Viewpoint /
> OrthoViewpoint nodes). I can export anything named from glTF this way.
>
> See
> https://github.com/michaliskambi/x3d-tests/tree/master/gltf/avocado_and_exports
> <https://nam10.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fmichaliskambi%2Fx3d-tests%2Ftree%2Fmaster%2Fgltf%2Favocado_and_exports&data=04%7C01%7Cbrutzman%40nps.edu%7C90fe545048fe487a05a108da16b073ac%7C6d936231a51740ea9199f7578963378e%7C0%7C0%7C637847244970756710%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=9jRLppQrO0q6GPqX9tOEAR62mXEw8vWR3NzSS1HRVPE%3D&reserved=0>
> and attached screenshot with scene that can reuse Avocado appearance,
> or transformation, or mesh.
>
> It looks like this:
>
> """
> Switch {
>   children DEF InlinedAvocado Inline {
>     url "glTF/Avocado.gltf"
>   }
> }
> IMPORT InlinedAvocado.Avocado_2 AS AvocadoMeshes
> IMPORT InlinedAvocado.CastleEncoded_2256_Avocado_d AS AvocadoAppearance
> IMPORT InlinedAvocado.Avocado AS AvocadoTransform
>
> Shape {
>   appearance USE AvocadoAppearance
>   geometry IndexedFaceSet { ... }
> }
> ...
> """
>
> 3. Why IMPORT / EXPORT? I felt this way there's less extra concepts.
>
>   A. Do not want to see original glTF? Then place "Inline" inside "Switch".
>
>   B. Writing "IMPORT" is simpler than ExternProto, no need to repeat
> the node declaration.
>
> 4. To make this work:
>
>   A. The browser must make sure to generate EXPORT for all named
> things when importing glTF file.
>
>   B. The browser must be more tolerant for USE clauses than spec.
>
>     X3D spec says (
>
> https://www.web3d.org/specifications/X3Dv4Draft/ISO-IEC19775-1v4-CD1/Part01/components/networking.html#IMPORTStatement
> ) """Nodes imported into an X3D scene using the IMPORT statement may
> not be instanced via the USE statement. """. I decided to ignore this
> limit now in CGE/view3dscene, you can reUSE nodes you get with IMPORT.
>
>     There seems to be no drawback from this. We only resolve USE
> looking at IMPORTed names if the name cannot be found in non-imported
> nodes. And it makes IMPORT / EXPORT much more powerful, also for
> X3D<->X3D interaction.
>
> 5. Note: I'm not really trying to make a case that "IMPORT / EXPORT is
> a better approach than ExternProto". They both seem reasonable
> approaches. I just decided to test IMPORT / EXPORT approach to the
> fullest, and I dabbled with it already in the demo with
> skinned_anim_run_animations_from_x3d.x3dv .
>
> Regards,
> Michalis
>
> _______________________________________________
> x3d-public mailing list
> x3d-public at web3d.org
> http://web3d.org/mailman/listinfo/x3d-public_web3d.org
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://web3d.org/pipermail/x3d-public_web3d.org/attachments/20220405/c70397c9/attachment-0001.html>


More information about the x3d-public mailing list