10

I'm working on a web application that manages VRML files. I also want to let users see the uploaded files, without requiring a specific plug-in or player. X3DOM allows viewing X3D files without plug-ins on most browsers, so I'd like to use it.

Alas, it works on X3D files, and not VRML files. I need to convert VRML files to the X3D format.

The same people behind X3DOM released a package called InstantReality that has a utility that converts VRML to X3D. However, I'd much rather not use an external utility (I'm not even sure I'm allowed to use it on a commercial environment, I couldn't find its terms of use) but call a conversion routine from my application code.

zmbq
  • 38,013
  • 14
  • 101
  • 171

7 Answers7

9

MeshLab! There's an opensource project called MeshLab that does all sorts of processing on 3D meshes. It also has a command-line tool called MeshlabServer.

Running meshlabserver.exe -i <wrl file> -o <x3d file> performs the conversion (very quickly). Since it's open-source, I don't have any licensing issues.

Him
  • 5,257
  • 3
  • 26
  • 83
zmbq
  • 38,013
  • 14
  • 101
  • 171
  • 1
    Open-source software may have license, too. Open-source doesn't means that you can use it to do anything you like. – Ray Feb 18 '13 at 14:54
  • 1
    In their case, the license fits my needs very well. – zmbq Feb 18 '13 at 15:41
  • This saved me a day, thanks! It's really hard to find any mention of MashLab Server on their web page. BTW, there is another great conversion command line tool [meshconv](http://www.cs.princeton.edu/~min/meshconv/) but it only supports OBJ, WRL, STL, OFF, PLY. – yablokoff Mar 22 '14 at 17:39
  • 1
    I have since developed my own conversion code - both from WRL and PLY to X3D. That way I have full control over everything. – zmbq Mar 22 '14 at 18:06
  • @zmbq did you reveal it somewhere? Or it's under commercial licence? – yablokoff Mar 22 '14 at 19:38
  • I didn't. It's too half-baked for it, it only supports part of the WRL specification - the part that is used by the 3D scanners I need. – zmbq Mar 23 '14 at 11:18
6

are you talking about this online converter? http://doc.instantreality.org/tools/x3d_encoding_converter/ you could probably build some scripting to convert the vrml to x3d/x3dom and then store and or display

as well blender aopt and others should be able to convert vrml to x3d on the command line. depending on your servers os this could be batched/scripted as well

im in a rush to get some other work done but hope this helps.

let me know if you need more info or examples and ill see what i can do

drfrog
  • 347
  • 2
  • 9
  • I want an offline converter. What is this Blender aopt you speak of? – zmbq Feb 13 '13 at 20:38
  • there are lots of ways to do offline conversion, blender has a command line way of doing this although i have never used it. http://www.web3d.org/x3d/content/examples/X3dResources.html has lots of resources under conversion , including xslt's to convert from vrml to x3d. as well please look at http://www.x3dom.org/?page_id=532 which has an explain on how to use aopt. – drfrog Feb 15 '13 at 00:49
  • xslts would have been awesome. Unfortunately, the xslts there all convert from X3D to something else. I need the other way around. The problem with aopt, is that I don't know if I'm allowed to use it (it says it's free in non-commercial environment, and my environment is potentially commercial, but with an organization that is not going to pay any license fee). – zmbq Feb 15 '13 at 06:07
  • 1
    thats really wierd i cant seem to find the vrml2 2 x3d xslt either but i know it exists as i developed a perl script that did that wrl -> x3d conversion same as http://doc.instantreality.org/tools/x3d_encoding_converter/ does . ill ask on the x3dom-users mailllist and see if anyone can point us to the right place – drfrog Feb 15 '13 at 08:32
  • Excellent. In the mean time I've found this: http://ovrt.nist.gov/v2_x3d.html . Once more, I couldn't find any licensing information. – zmbq Feb 15 '13 at 09:04
  • using aopt you can do this: aopt -i input.wrl -o output.x3d – drfrog Feb 15 '13 at 18:45
3

I also needed to convert VRML .wrl to .x3d; I tried meshlab (meshlabserver), but unfortunately, the version I have (.deb 2016.12~trusty2 on Ubuntu 14.04) compacts everything to a single mesh, and looses color in the process.

I found that view3dscene can do conversion from the command line, where the materials/colors are preserved in .x3d, as they were in .wrl:

view3dscene mymodel.wrl --write --write-encoding xml > mymodel.x3d

Since view3dscene functions as a viewer for both .wrl and .x3d files, it can also be used immediately, to check if the converted (or the original) file has colors or not.

sdaau
  • 36,975
  • 46
  • 198
  • 278
  • There's also a standalone command line converter included with view3dscene, for example you can convert all files in a dir with this: for %%f in (*.wrl) do tovrmlx3d.exe %%f --encoding=xml > %%f.x3d – kgz Apr 19 '18 at 11:04
2

ok so i think this is the full solution for you

1) user uploads a vrml file

2) that file gets saved to (file or db)

3) upon confirmation that the vrml file has been saved (and possibly validated as correct vrml syntax) it gets converted and saved to x3d (again as file or db) , with aopt this would be accomplished by aopt -i input.wrl -o output.x3d

FYI: aopt is avail for linux windows and mac

since you use python this maybe a way you could do it as well with blender although there are no full example of vrml to x3d this link should get you started http://wiki.blender.org/index.php/Extensions:2.6/Py/Scripts/Import-Export/Wavefront_OBJ#Command_Line_Converting

4) display the x3d via x3dom

drfrog
  • 347
  • 2
  • 9
  • Again, unless aopt's license is not the one I've seen (can you find its license?), I can't use it. – zmbq Feb 16 '13 at 20:37
  • yeah their usage right on legal page here http://www.instantreality.org/legals/ state you must get permission. blender is open source and usng the link in my second answer should provide u the ability to convert from vrml to x3d . see here for more on their liscencing http://www.blender.org/Community/?sub=Professionals – drfrog Feb 17 '13 at 00:38
2

Since the ClassicVRML X3D Encoding is a direct successor of the VRML97 standard, in most cases you can copy the file, rename the .wrl file extension to a .x3dv file extension, and change the scene header from

#VRML V2.0 utf8

to

#VRML V3.3 utf8
PROFILE Immersive

Many converters exist, both commercial and open source. Several are integrated with X3D-Edit. A full list is maintained at

Personal favorite:

Don Brutzman
  • 141
  • 12
1

If you simply want to convert X3D XML encoded files to VRML Classic encoded files you can use Titania, http://titania.create3000.de/. Open your .x3d file and save it as .x3dv or .wrl.

Titania also comes with a command line utitity »x3dtidy« that can do the conversion too.

  • apparently, `x3dtidy` is an XSLT stylesheet, so it can only convert .x3d to .wrl - not the other way around, as the question asks? – sdaau Jan 11 '18 at 14:15
1

You can use this tool (a java jar that can be run from the command line) to convert VRML to X3D:

http://www.deem7.com/vrmlmerge/howto.php

java -jar VrmlMerge-[version].jar -convert inputfile.wrl [outputfile.x3d] 

The license:

VrmlMerge is free for non-commercial use. If you somehow make money out of VrmlMerge then I'd like you to contact me to agree on some terms of use. VrmlMerge is provided "as is" and I don't take any responsibility for any damage it can make to you, your computer, files, data, wife, brain etc..

dayer4b
  • 978
  • 14
  • 26