Disclaimer: I’m a regular contributor to the three.js library, an author of A-Frame VR, and an author of the glTF format.
glTF and X3D are at very levels of abstraction, and if you’re choosing between the two you’ve probably misunderstood something … A glTF file represents a 3D model, similar to an FBX or OBJ file, but optimized for use in a realtime engine. It can contain animation, but doesn’t have any sort of interactivity. It’s meant to be loaded into an engine, perhaps with other models, and it doesn’t really matter what engine – three.js, BabylonJS, A-Frame VR, and even native engines like Unity and Unreal can all load glTF models. For the very simplest way of displaying a glTF model on the web, if that’s what you want to do, check out the <model-viewer/>
component, similar to an HTML <video/>
tag for 3D models.
X3D is more complex than just a model format – it also includes scripting, audio, video, and interactivity. See a full comparison here or here. It’s almost more similar to a whole application like an A-Frame VR page than it is to a model format like glTF. You could even load a glTF model into an X3D scene. As a result of that more complex scope, engines like BabylonJS and A-Frame don’t support X3D, and support in three.js is very limited.
If you want to do 3D on the web, I’d suggest these steps:
(1) Figure out what sort of application you want to build. Just view a model? Something interactive? VR? Build a whole game?
(2) Based on that, choose a 3D engine that is reasonable for your goals and skillset. ThreeJS, BabylonJS, A-FrameVR, Unity, X3DOM, PlayCanvas, and others might be reasonable choices here.
(3) Once you’ve chosen an engine, decide how to export content to that engine.
For three.js, BabylonJS, and A-Frame VR, using glTF is the officially recommended way to load a model. If you want to use X3DOM, then X3D is probably the right choice (I’m not personally familiar with either, so maybe someone else can comment). If you’re building in Unity and packaging for Web, then glTF is an option, but FBX might be easier given the long history of support there.
Hope this is helpful.