[X3D-Public] convert x3d zu wrl

Michalis Kamburelis michalis.kambi at gmail.com
Fri Jul 20 06:44:10 PDT 2012


Chris wrote:
> Hello people,
>
> I want to convert a x3d file to a wrl file.
>
> Would somebody be so kind and explain me how that works?
>

Note that conversion from X3D to VRML inherently means loosing some 
things. VRML (2.0, and 1.0 even more so) is an older standard, and just 
cannot express many things that are possible in X3D. I would advise to 
use modern tools that can work with X3D. Converting your models from X3D 
to VRML is a little step backward...

That said, for simple models you can do it like this:

1. If your X3D file is in XML encoding (.x3d extension), convert it to 
X3D in classic encoding first (.x3dv extension). E.g. view3dscene allows 
to do this (http://castle-engine.sourceforge.net/view3dscene.php , 
conversion can be done by menu items or command-line options 
http://castle-engine.sourceforge.net/view3dscene.php#section_converting 
). And probably all other converters mentioned in a link from Roland, 
http://www.web3d.org/x3d/content/examples/X3dResources.html#Conversions 
, as far as I know at least InstantReality can convert between encodings.

Save the resulting file under .wrl extension, and do the rest of 
conversion by opening the file in a text editor:

2. Replace the header, removing lines:

#X3D V3.2 utf8
PROFILE ...
COMPONENT ...
META ...

and adding instead

#VRML V2.0 utf8

3. Replace some keywords (X3D -> VRML 2.0):
inputOnly -> eventIn
outputOnly -> eventOut
inputOutput -> exposedField
initializeOnly -> field

That's it. This should work Ok for simple models, that use the basic 
nodes that exist in both VRML 2.0 and X3D. (Converting X3D to VRML 1.0 
is more involved, but I guess you don't want this, as VRML 1.0 is really 
ancient.)

Hope this helps,
Michalis



More information about the X3D-Public mailing list