Wings 3D Development Forum
X3D / VRML import plugin - Printable Version

+- Wings 3D Development Forum (https://www.wings3d.com/forum)
+-- Forum: Wings 3D (https://www.wings3d.com/forum/forumdisplay.php?fid=1)
+--- Forum: Design & Development (https://www.wings3d.com/forum/forumdisplay.php?fid=6)
+--- Thread: X3D / VRML import plugin (/showthread.php?tid=3084)

Pages: 1 2


X3D / VRML import plugin - edb - 12-01-2022

I'm making an import plugin to complement the VRML export plugin already in Wings3D. It can import from X3D, VRML 2.0, a bit of VRML 1.0 and possibly SGI Inventor files as they are very similar to VRML 1.0 files.

Example X3D file:
Code:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE X3D PUBLIC "ISO//Web3D//DTD X3D 3.0//EN" "http://www.web3d.org/specifications/x3d-3.0.dtd">
<X3D version="3.0" profile="Immersive" xmlns:xsd="http://www.w3.org/2001/XMLSchema-instance" xsd:noNamespaceSchemaLocation="http://www.web3d.org/specifications/x3d-3.0.xsd">
    <head>
        <meta name="filename" content="untitled.x3d" />
        <meta name="generator" content="Blender 2.77 (sub 0)" />
    </head>
    <Scene>
        <NavigationInfo headlight="false"
                        visibilityLimit="0.0"
                        type='"EXAMINE", "ANY"'
                        avatarSize="0.25, 1.75, 0.75"
                        />
        <Background DEF="WO_World"
                    groundColor="0.051 0.051 0.051"
                    skyColor="0.051 0.051 0.051"
                    />
        <Transform DEF="Cube_TRANSFORM"
                   translation="0.000000 0.000000 0.000000"
                   scale="1.000000 1.000000 1.000000"
                   rotation="0.000000 0.707107 0.707107 3.141593"
                   >
            <Transform DEF="Cube_ifs_TRANSFORM"
                       translation="0.000000 0.000000 0.000000"
                       scale="1.000000 1.000000 1.000000"
                       rotation="1.000000 0.000000 0.000000 0.000000"
                       >
                <Group DEF="group_ME_Cube">
                    <Shape>
                        <Appearance>
                            <Material DEF="MA_Material"
                                      diffuseColor="0.800 0.800 0.800"
                                      specularColor="0.401 0.401 0.401"
                                      emissiveColor="0.000 0.000 0.000"
                                      ambientIntensity="0.333"
                                      shininess="0.098"
                                      transparency="0.0"
                                      />
                        </Appearance>
                        <IndexedFaceSet solid="true"
                                        coordIndex="0 1 2 3 -1 4 7 6 5 -1 0 4 5 1 -1 1 5 6 2 -1 2 6 7 3 -1 4 0 3 7 -1 "
                                        >
                            <Coordinate DEF="coords_ME_Cube"
                                        point="1.000000 1.000000 -1.000000 1.000000 -1.000000 -1.000000 -1.000000 -1.000000 -1.000000 -1.000000 1.000000 -1.000000 1.000000 0.999999 1.000000 0.999999 -1.000001 1.000000 -1.000000 -1.000000 1.000000 -1.000000 1.000000 1.000000 "
                                        />
                        </IndexedFaceSet>
                    </Shape>
                </Group>
            </Transform>
        </Transform>
        <Transform DEF="Lamp_TRANSFORM"
                   translation="-4.076245 5.903862 1.005454"
                   scale="1.000000 1.000000 1.000000"
                   rotation="-0.498084 -0.762016 -0.413815 1.513875"
                   >
            <PointLight DEF="LA_Lamp"
                        ambientIntensity="0.0000"
                        color="1.0000 1.0000 1.0000"
                        intensity="0.5714"
                        radius="30.0000"
                        location="-0.0000 -0.0000 0.0000"
                        />
        </Transform>
        <Transform DEF="Camera_TRANSFORM"
                   translation="-7.481132 5.343665 -6.507640"
                   scale="1.000000 1.000000 1.000000"
                   rotation="-0.093039 -0.968741 -0.229967 2.347036"
                   >
            <Viewpoint DEF="CA_Camera"
                       centerOfRotation="0 0 0"
                       position="0.00 0.00 -0.00"
                       orientation="-0.92 0.35 0.17 0.00"
                       fieldOfView="0.858"
                       />
        </Transform>
    </Scene>
</X3D>

[Image: MbDJZ2T1_o.png]


RE: X3D / VRML import plugin [WIP] - micheus - 12-01-2022

Quote:I'm making an import plugin to complement the VRML export plugin already in Wings3D.
In this case, I suggest you work over the current code and create a PR at Wings3D's GitHub repository in order to get it approved by dgud.


RE: X3D / VRML import plugin [WIP] - edb - 12-02-2022

I can make a PR for this one pretty soon, I just have the textures part to do I think. Thank you.


RE: X3D / VRML import plugin [WIP] - edb - 03-08-2023

I've made a branch eb/x3d-import with my changes so far but there is still a little bit to complete. There are also changes to wpc_wrl.erl that adds X3D export support.


RE: X3D / VRML import plugin [WIP] - edb - 03-09-2023

It took a bit of time but I think this importer is now generally usable.

Apart from IndexedFaceSet, it also implements many of the other geometry nodes, making it useful not only to import meshes from other programs, but also to create geometries from VRML code to import directly into wings. Basic geometries like Box, Cylinder, Cone, Sphere are available, as well as the Extrusion and ElevationGrid node. Transforms (translate, rotation, scale) that the shapes are in, are also applied to the shapes.

beam file available:
wpc_wrl.tar

This installs over the stock wpc_wrl plugin to provide X3D export support.

Example ElevationGrid:

[Image: u5Qor2bE_o.png]
Code:
#VRML V2.0 utf8
DEF elevation2x2 Transform {
  children [
    Shape {
      appearance Appearance {
        material DEF default Material { }
      }
      geometry ElevationGrid {
        xDimension 3
        zDimension 3
        colorPerVertex FALSE
        height [ 0.0 0.2 0.4  0.2 0.4 0.6  0.4 0.6 0.8  ]
        color Color { color [ 1 0 0  0 1 0  0 0 1  1 1 0  1 0 1  0 1 1 ] }
      }
    }

  ]
}



RE: X3D / VRML import plugin [WIP] - edb - 04-10-2023

Updated with improvements for multi byte identifiers and texture file paths:
wpc_wrl.tar


RE: X3D / VRML import plugin [WIP] - tkbd - 05-22-2023

Hello edb!

I installed your VRML/X3D importer and exporter,and done some tests.
And tried to readVRML data of DEM(Digital Elevation Model)
Wings3D could displayed two Materials and one Texture loaded,The material referenced the texture correctly
but UVdata missing.

The file can dowoload in a following site.
https://maps.gsi.go.jp/index_3d.html?z=10&lat=45.166547157856016&lon=141.25671386718753&w=256&h=256&ls=std%7Cmodis&blend=0#&cpx=-18.388&cpy=-149.605&cpz=27.241&cux=-0.094&cuy=-0.563&cuz=0.821&ctx=0.000&cty=0.000&ctz=0.000&a=3.3&b=0&dd=0
You can also download two file,dem.wrl and texture.png
Unfortunately English interface is not supported..and .the wrl file size is 13.8MB
(Therefore, I posted the image with English annotations.)

Note: This site is Geospatial Information Authority of Japan (GSI)
https://www.gsi.go.jp/ENGLISH/index.html

I examine the file by a text editor.
The wrl file has texCoord TextureCoordinate field, but texCoordIndex field missing.
MeshLab and Blender can see UVdata correctly and textured terrain.
Would it be possible Wings could as well the data display correctly in the cases texCoordIndex missing too?


[Image: hVMcAcE.jpg]
[Image: AzR1H8l.jpg]
[Image: SKdxeba.jpg]
[Image: 1PNCoI6.jpg]
[Image: 62g5m3V.png]

[Image: afvpMYk.png]


Best regard!
------------------
tkbd


RE: X3D / VRML import plugin [WIP] - edb - 05-23-2023

Hello tkbd,

I'll be looking at it soon to see what needs to be changed for the absent texCoordIndex.
Thanks for letting me know.


RE: X3D / VRML import plugin [WIP] - edb - 05-28-2023

I've made the fix for when texCoordIndex isn't specified. Thanks tbkd for finding the bug.

Newest build:
wpc_wrl.tar


RE: X3D / VRML import plugin - tkbd - 05-28-2023

Thank you for update!.
I checked it working good!!
I'm glad because this specification will possibly many people will benefit from it.