[X3D-Ecosystem] claude code example: producing a simple X3D scene

Don Brutzman don.brutzman at gmail.com
Fri Feb 27 17:32:44 PST 2026


I tried a simple query on Claude code this morning.  Interesting
trajectory.  Chat log follows, all products are now available online.

   - https://claude.ai

==========================

"show me a simple x3d model" (my prompts are quoted in this log)

Here's an interactive X3D scene rendered in the browser using the X3DOM
> library:
> Created a file, read a file
> X3D model viewer
> x3d_model.html
> Presented file
> Done
> This X3D scene features four geometric primitives — a sphere, cube, cone,
> and cylinder — orbiting slowly around a central axis, floating above a
> translucent disc. Built with X3DOM, which renders the X3D XML standard
> natively in the browser.
> Controls: drag to orbit, scroll to zoom, right-drag to pan.

X3d model
> Code · HTML


"the model did not render"

Let me try a different approach using Three.js instead, which is more
> reliably supported:
> > Created 2 files, ran a command, read a file
> I switched from X3DOM to Three.js, which has much better browser support.
> You should now see a blue sphere at the center with a red cube, green cone,
> and yellow cylinder orbiting around it — drag to rotate, scroll to zoom.


"that is not X3D"

You're right, I apologize. X3DOM was the correct approach — it renders
> actual X3D markup in the browser. Let me debug why it didn't render.
> The issue was likely that X3DOM's CDN failed to load. Let me try with a
> more reliable setup:

Created a file, read a file

X3D model using X3DOM with fallback CDNx3d_scene.html

Presented file

Done

This uses proper X3D markup rendered via X3DOM, loaded directly from
> x3dom.org (more reliable than the cdnjs mirror). The scene contains:
>
>    - A sphere at center, with a box, cone, and cylinder orbiting via
>    OrientationInterpolator + TimeSensor — standard X3D animation nodes
>    - Full <scene>, <shape>, <appearance>, <material> X3D structure
>
> Note: X3DOM requires network access to load from x3dom.org. If the
> Claude.ai sandbox blocks external scripts, X3D won't render — that may have
> been the issue before. You can also open the downloaded HTML file directly
> in Chrome/Firefox where it will load fine.


"it still did not render" (though once downloaded, the first attached file
did work in Firefox)

> The issue is that the Claude.ai sandbox blocks external scripts like
> X3DOM. Let me instead create a true X3D file (.x3d) — pure XML — that you
> can open directly in a browser with X3DOM, or in any X3D viewer.
> Created a file, read a file
> Created a file, read a file
> Pure X3D XML file
> scene.x3d
> Presented file
> Done
>
> This is a proper *.x3d file* — pure X3D XML with no dependencies. It
> contains a sphere, box, cone, and cylinder with an animated orbit using
> TimeSensor + OrientationInterpolator + ROUTE nodes.
>
> To view it, open it in one of these X3D viewers:
>
>    - *Instant Reality <https://www.instantreality.org/>* — desktop X3D
>    player
>    - *View3dscene <https://castle-engine.io/view3dscene.php>* — free
>    cross-platform viewer
>    - *X3DOM online viewer
>    <https://x3dom.org/x3dom/example/x3dom_multiTouch.html>* — drag the
>    file in
>    - *FreeWRL* or *Octaga Player*
>
> The sandbox here can't render it inline because external JS libraries like
> X3DOM are blocked by the network policy.
> Scene
> X3D
> Download
>

(attached result: scene.x3d)

Here are validation checks using latest X3D-Edit:

--------- X3D Validator checks commenced for scene.x3d ---------
>
> Performing well-formed XML check...
> Checking file:/C:/Users/donbr/Desktop/scene.x3d...
> Well-formed XML check: pass
>
> Performing DOCTYPE check...
> [X3dDoctypeChecker] success: valid XML declaration
> found.[X3dDoctypeChecker] success: final X3D 3.3 DOCTYPE found.
>
> Performing DTD validation...
> Checking file:/C:/Users/donbr/Desktop/scene.x3d...
> Referenced entity at "
> http://www.w3.org/TR/2002/REC-xmldsig-core-20020212/xmldsig-core-schema.xsd
> ".
> Referenced entity at "http://www.w3.org/2001/XMLSchema.dtd".
> Referenced entity at
> "jrt:/java.xml/jdk/xml/internal/jdkcatalog/w3c/dtd/schema10/datatypes.dtd".
> cvc-maxInclusive-valid: Value '1.5' is not facet-valid with respect to
> maxInclusive '1.0E0' for type 'unitIntervalType'.
> cvc-attribute.3: The value '1.5' of attribute 'intensity' on element
> 'PointLight' is not valid with respect to its type, 'unitIntervalType'.
> XML DTD validation: fail!
>
> Performing X3D schema validation...
> Checking file:/C:/Users/donbr/Desktop/scene.x3d...
> Referenced entity at "
> http://www.w3.org/TR/2002/REC-xmldsig-core-20020212/xmldsig-core-schema.xsd
> ".
> Referenced entity at "http://www.w3.org/2001/XMLSchema.dtd".
> Referenced entity at
> "jrt:/java.xml/jdk/xml/internal/jdkcatalog/w3c/dtd/schema10/datatypes.dtd".
> cvc-maxInclusive-valid: Value '1.5' is not facet-valid with respect to
> maxInclusive '1.0E0' for type 'unitIntervalType'.
> cvc-attribute.3: The value '1.5' of attribute 'intensity' on element
> 'PointLight' is not valid with respect to its type, 'unitIntervalType'.
> XML schema validation: fail!
>
> Performing X3D regular expression (regex) values check...
> X3D regex check: complete
>
> Performing X3D Schematron check...
> <X3D profile='Interchange'> doesn't match contained nodes, increase
> profile or add needed <X3D><head><component> statements [/X3D, error]
> <X3D profile='Interchange'> definition is insufficient since nodes in
> scene have actual profile='Interactive' [/X3D, info]
> <X3D profile='Interchange'> definition is insufficient since nodes in
> scene have actual profile='CADInterchange' [/X3D, info]
> <X3D profile='Interchange'> definition is insufficient since nodes in
> scene have actual profile='MedicalInterchange' [/X3D, info]
> <X3D profile='Interchange'> definition is insufficient since nodes in
> scene have actual profile='CADInterchange', so ensure
> <X3D><head><component> statements are sufficient to provide coverage [/X3D,
> info]
> <X3D profile='Interchange'> definition is insufficient since nodes in
> scene have actual profile='MedicalInterchange', so ensure
> <X3D><head><component> statements are sufficient to provide coverage [/X3D,
> info]
> <X3D profile='Interchange'> definition is insufficient since nodes in
> scene have actual profile='Interactive', so ensure <X3D><head><component>
> statements are sufficient to provide coverage [/X3D, info]
>
> --------- X3D Validator checks complete for scene.x3d ---------


"that worked, thank you"

Glad it worked! The .x3d format is clean, readable XML — great for 3D
> content that needs to be portable and standards-based. Let me know if you'd
> like to add more geometry, textures, lighting, or animations to the scene.


"add textures"

> Let me update the X3D file with image textures on each shape.
> Check skills available
> Check skills available
> Check skills available
> Done
>
> X3D supports textures via ImageTexture nodes pointing to URLs. I'll use
> freely available texture URLs from the web so they'll load in any X3D
> viewer:
> X3D scene with textures on each shape
> X3D scene with textures on each shape
> X3D scene with textures on each shape
> scene_textured.x3d
> Done
>
> Hmm, the ground disc texture URL was wrong. Let me fix that with a proper
> stone texture:
> Edited a file, read a file
> Edited a file, read a file
> Fix ground disc texture to a proper stone/concrete URL
> scene_textured.x3d+2-2
> Presented file
> Done
>
> Here's the textured X3D scene. Each shape has an ImageTexture node with a
> TextureTransform for tiling:
>
>    - 🌍 *Sphere* — Earth satellite image
>    - 🧱 *Box* — brick texture
>    - 🪵 *Cone* — wood grain
>    - 🪨 *Cylinder* — marble
>    - *Ground disc* — concrete/stone
>
> The textures are loaded from Wikimedia URLs, so your X3D viewer will need
> internet access to fetch them. If any fail to load, the shape will just
> fall back to its Material color.
> Scene textured
> X3D
>

"three images not found" (the urls were properly formed but only one was
correct at wikimedia)

Let me find working texture URLs before updating the file.
> Searched the web
> Searched the web
> wikimedia commons direct image URL brick texture jpg
>
> 10 results
> [image: favicon]
> File:Red brick wall texture.JPG - Wikimedia Commons
> commons.wikimedia.org
> [image: favicon]
> Category:Brick wall textures - Wikimedia Commons
> commons.wikimedia.org
> [image: favicon]
> File:Brick texture - Saint-Omer (Pas-de-Calais) - 01.JPG - Wikimedia
> Commons
> commons.wikimedia.org
> [image: favicon]
> File:Brick texture - Saint-Omer (Pas-de-Calais) - 02.JPG - Wikimedia
> Commons
> commons.wikimedia.org
> [image: favicon]
> Get direct URL of Wiki Commons image by filename from Media Wiki API in
> R/rstats – Katharina Brunner
> katharinabrunner.de
> [image: favicon]
> Category:Brick textures - Wikimedia Commons
> commons.wikimedia.org
> [image: favicon]
> How I Add Wikimedia Images to My Websites
> briantomasik.com
> [image: favicon]
> Category:Brick pavement textures - Wikimedia Commons
> commons.wikimedia.org
> [image: favicon]
> Commons:Reusing content outside Wikimedia/technical - Wikimedia Commons
> commons.wikimedia.org
> [image: favicon]
> Category:SVG brick wall textures - Wikimedia Commons
> commons.wikimedia.org
> Done
>
> Rather than guessing URLs, let me fetch the actual direct image URLs from
> the Wikimedia API for reliable textures:
> Searched the web
> Searched the web
> [image: favicon]
> Failed to fetch
> https://en.wikipedia.org/w/api.php?action=query&titles=File:Red_brick_wall_texture.JPG|File:Aa_wooden_texture.jpg|File:White_marble_texture.jpg|File:Land_ocean_ice_2048.jpg&prop=imageinfo&iiprop=url&format=json
> [image: favicon]
> Failed to fetch
> https://commons.wikimedia.org/w/api.php?action=query&titles=File:Red_brick_wall_texture.JPG|File:Aa_wooden_texture.jpg|File:White_marble_texture.jpg|File:Land_ocean_ice_2048.jpg&prop=imageinfo&iiprop=url&format=json
> Done
>
> The sandbox blocks API calls too. Instead of relying on external URLs that
> may break, let me embed the textures directly as base64-encoded PNG data
> URIs generated right here — guaranteed to always work:
>
This time the textures are *embedded directly* as base64 data URIs inside
> the file — no internet connection needed, so they'll always load. Each
> shape has a procedurally generated texture:
>
>    - 🌍 *Sphere* — ocean/continent Earth-like pattern
>    - 🧱 *Box* — brick rows
>    - 🪵 *Cone* — wood grain rings
>    - 🪨 *Cylinder* — white marble with veins
>    - *Ground disc* — rough stone/concrete
>
> Scene textured
> X3D
>

"thank you"

  You're welcome! Let me know if you'd like to expand the scene further —
> more shapes, animations, lighting effects, or anything else.


"add head/meta information to X3D model"

Ran 2 commands, viewed a file, edited a file

The <head> block has been added with the following standard X3D metadata
elements:

   - <meta> tags for title, description, author, created date, generator,
   license, and spec reference
   - <component> declarations for Lighting, Texturing, Interpolation, and
   Time — these formally declare which X3D feature sets the scene uses,
   which is good practice for conformance and validation

(which added)

  <head>
>     <meta name="title"       content="Orbiting Primitives with Textures"/>
>     <meta name="description" content="Four textured 3D primitives —
> sphere, box, cone, cylinder — orbiting on an animated platform."/>
>     <meta name="author"      content="Claude (Anthropic)"/>
>     <meta name="created"     content="2026-02-27"/>
>     <meta name="generator"   content="Claude Sonnet 4.6"/>
>     <meta name="license"     content="
> https://creativecommons.org/licenses/by/4.0/"/>
>     <meta name="reference"   content="
> https://www.web3d.org/specifications/x3d-3.3.pdf"/>
>     <component name="Lighting"       level="1"/>
>     <component name="Texturing"      level="1"/>
>     <component name="Interpolation"  level="1"/>
>     <component name="Time"           level="1"/>
>   </head>


Pretty good meta information...  Of note:

   - "title" should actually be the file name
      - for details see  DCMI: DCMI Metadata Terms
      <https://www.dublincore.org/specifications/dublin-core/dcmi-terms/#title>
at

      https://www.dublincore.org/specifications/dublin-core/dcmi-terms/#title
   - invalid reference provided:
   https://www.web3d.org/specifications/x3d-3.3.pdf
   - easier than many component statements is to instead use X3D
   profile='Immersive'
   - validation error found, incorrect order of elements:
   check DTD validation  of canonical form
   C:\x3d-code\www.web3d.org\x3d\content\examples\X3dForAdvancedModeling\LLM\ClaudeCodeSimpleModelCanonical.xml:16:10:
   The content of element type "head" must match "(component*,unit*,meta*)".

==========================

Have saved original models and added updates, along with screenshots, at

   - X3D Example Archives: X3D4AM, X3D for Advanced Modeling, Large
   Language Models
   -
   https://www.web3d.org/x3d/content/examples/X3dForAdvancedModeling/LargeLanguageModels
   -

   This chapter shows initial experiments asking Claude Code Large Language
   Model (LLM) to create simple X3D models. These are corrected versions of
   the originals
   <https://www.web3d.org/x3d/content/examples/X3dForAdvancedModeling/LargeLanguageModels/originals/index.html>
that
   are minimally modified for cataloging purposes.

   See ClaudeCodeSimpleModelHtmlX3DOM.html
   <https://www.web3d.org/x3d/content/examples/X3dForAdvancedModeling/LargeLanguageModels/ClaudeCodeSimpleModelHtmlX3DOM.html>
    (screenshot
   <https://www.web3d.org/x3d/content/examples/X3dForAdvancedModeling/LargeLanguageModels/ClaudeCodeSimpleModelHtmlX3DOM.png>)
   for first response, which utilized X3DOM <https://www.x3dom.org/>.


   -
   https://www.web3d.org/x3d/content/examples/X3dForAdvancedModeling/LargeLanguageModels/ClaudeCodeSimpleModelScreenshots.png
   -
   https://www.web3d.org/x3d/content/examples/X3dForAdvancedModeling/LargeLanguageModels/ClaudeCodeSimpleModelScreenshotCastle.png
   - with unmodified originals at
   -
   https://www.web3d.org/x3d/content/examples/X3dForAdvancedModeling/LargeLanguageModels/originals


Plus two new TODO items, possibly overstrict specification requirements
worth discussion:

a. required ordering of component, unit, meta... there are no
interdependencies and load-time performance is not an issue, so I'm not
sure why we did that.

b. given X3D4 close support for glTF physically based rendering (PBR), are
upper limits of 1.0 for some rendering fields overly strict, e.g.
PointLight intensity?


Have fun with X3D LLMs, but be careful out there!  🤔

all the best, Don
-- 
X3D Graphics, Maritime Robotics, Distributed Simulation
Relative Motion Consulting  https://RelativeMotion.info
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://web3d.org/pipermail/x3d-ecosystem_web3d.org/attachments/20260227/843833ff/attachment-0002.html>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://web3d.org/pipermail/x3d-ecosystem_web3d.org/attachments/20260227/843833ff/attachment-0003.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: scene.x3d
Type: text/xml
Size: 3220 bytes
Desc: not available
URL: <http://web3d.org/pipermail/x3d-ecosystem_web3d.org/attachments/20260227/843833ff/attachment-0001.xml>


More information about the X3D-Ecosystem mailing list