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
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.
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..
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.
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.
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
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