<div dir="auto">Michalis, I am not mentally capable of doing what you outlined. I can generate DOM and XML fairly successfully, if CGE works with that. I might need to download that again, because I can’t even get the template model viewer working with .x3d files, just replacing car.x3d with:</div><div dir="auto"><br></div><div dir="auto"><br></div><div dir="auto"><div><a href="https://github.com/coderextreme/X3DJSONLD/blob/master/src/main/data/rubikPly.x3d">https://github.com/coderextreme/X3DJSONLD/blob/master/src/main/data/rubikPly.x3d</a></div><div dir="auto"><br></div>I can’t get car.x3d working either, just knight.gltf.</div><div dir="auto"><br></div><div dir="auto">My current approach is to get my .x3d file working under the template model viewer project, and then add a .x3dj loader.</div><div dir="auto"><br></div><div dir="auto">John <br><div class="gmail_quote gmail_quote_container" dir="auto"><div dir="ltr" class="gmail_attr">On Wed, Aug 6, 2025 at 7:13 AM Michalis Kamburelis <<a href="mailto:michalis.kambi@gmail.com">michalis.kambi@gmail.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)">John:<br>
<br>
I explained what I propose and why in Discord,<br>
<a href="https://discord.com/channels/389676745957310465/1168902964228931656/1400918074630340629" rel="noreferrer" target="_blank">https://discord.com/channels/389676745957310465/1168902964228931656/1400918074630340629</a><br>
. This email thread somewhat repeats your notions, forcing me to<br>
repeat my answers.. this is not optimal :) Please let's keep the<br>
communication on this topic on Discord (where also others familiar<br>
with Castle Game Engine are, and can help, or learn from<br>
developments).<br>
<br>
To summarize for others now, so they have the context :<br>
<br>
Ultimately, you can go with any solution you like naturally, it's your<br>
code and your choice.<br>
<br>
My advises aim to help you make what you want easier. Repeating what I<br>
said from Discord thread and why:<br>
<br>
1. I advise to implement X3D JSON reader just like all other readers<br>
in Castle Game Engine. So you read X3D file (using FpJson) and in turn<br>
you construct a graph of X3D nodes, represented by Castle Game Engine<br>
classes, like TSphereNode, TX3DRootNode etc.<br>
<br>
- It means you make a unit that implements a function like<br>
"function X3DJson(const Stream: TStream; const BaseUrl: String):<br>
TX3DRootNode;" and register it using RegisterModelFormat .<br>
<br>
- There's documentation of it, we have CGE manual, API reference<br>
and it's all open-source.<br>
<br>
- The requirement for this is that you need to learn CGE API to<br>
use X3D, naturally.<br>
<br>
- On the upside, if you follow this way, you are integrated with<br>
CGE on every level. So e.g. castle-model-viewer will be able to<br>
automatically view X3D JSON. And castle-model-converter will be able<br>
to read (and validate, and convert to other encodings like X3D<br>
classic,xml) X3D JSON. And you can use existing infrastructure of CGE,<br>
where all X3D nodes, with all their fields, are already defined, and<br>
can be accessed in various ways (also by just knowing their name as a<br>
string). All the existing loading, from glTF, from X3D classic, from<br>
X3D XML, goes this route.<br>
<br>
2. In contrast, if you just convert X3D JSON -> X3D XML, then you need<br>
to reinvent things which already exist in CGE. You will need to deal<br>
with DOM, you will need to invent knowledge about X3D nodes and<br>
fields. And in the end you do a specific conversion that will have to<br>
be "chained" with e.g castle-model-converter to get e.g. X3D classic<br>
output.<br>
<br>
Again, in the end you can follow any approach you like in the end.<br>
Note that for AD 2, you don't really CGE. FPC includes already JSON<br>
and XML support (FpJson, DOM units).<br>
<br>
Regards,<br>
Michalis<br>
<br>
śr., 6 sie 2025 o 00:34 John Carlson <<a href="mailto:yottzumm@gmail.com" target="_blank">yottzumm@gmail.com</a>> napisał(a):<br>
><br>
> I am again stumbling over importing X3D JSON into a scenegraph, this time with Castle Game Engine. How is this beast crackable? I don’t seem to have the skill, but perhaps persistence pays off?<br>
><br>
> My wiser self says I should just go with converting DOM or XML, which worked well with X_ITE, X3DOM and X3DJSAIL. I will still apparently have to register classes, which shouldn’t be a problem. I don’t know how to register Proto stuff yet.<br>
> I am having better luck translating to XML. I’ll go that route for now. I’m thinking Michalis knows something I don’t, which might complicate things.<br>
><br>
> There’s a choice between fpjson/jsonparser, and CastlePasJson units, I’m not clear on advantages of one over the other.<br>
><br>
> John<br>
</blockquote></div></div>