VRML and X3D are very similar, if you use the classic VRML encoding for VRML (the files with .x3dv extension). In fact, you can take any VRML file and convert it to X3DV following some simple steps.
1) Open the VRML file with your favorite editor, for example, Netbeans with the X3DV Module Suite
2) Change its header from #VRML V2.0 utf8 to:
#X3D V3.0 utf8
4) Make this changes in Script nodes, and PROTOS:
5) There are minor changes in some nodes.
Switch no longer uses choice, use children instead of choice.
LOD has also changed and no longer uses level, use children instead of level.
6) Of course, save the file with the extension .x3dv instead of .wrl
Style changes and error removing in Xj3D
Most of the X3D plugins and viewers will run the files, but Xj3D may give you some errors and not run the file at all. Flux may simply hang, and BSContact may give you strange console errors.
Specially when using Xj3D, the code style must be perfect. This viewer is specially strict with the X3D specifications. In my programming with it, I found some things that are detected as errors, and are errors in fact, although the old VRML browser allowed them.
So if you want to remove all possible errors from your X3D files, thus preventing frustrations, just watch out and correct these points:
- DEF names can't start with a number. Ej: 2towers is not allowed, but towers2 is.
- Bars like \ in urls are not good, / are.
- ROUTEs must be gathered together at the end of the file.
- PROTOs inside PROTOs must be at the start of the proto.
- EXTERNPROTOs can't be placed inside a PROTO. (It is not clear if it's an error or a Xj3D bug)
- The types of field and exposedField routed one to the other must be the same.
If you have noticed any more changes or know a good conversion tool, you can help us all adding your comment.
© 2008 by Jordi R. Cardona. Link to this post without copying the text.If you liked this post, get updates of Hiperia3D News for FREE