Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

X3D Exporter #2

Open
7 of 8 tasks
brutzman opened this issue Apr 26, 2018 · 5 comments
Open
7 of 8 tasks

X3D Exporter #2

brutzman opened this issue Apr 26, 2018 · 5 comments
Assignees

Comments

@brutzman
Copy link

brutzman commented Apr 26, 2018

X3D Exporter

The X3D Exporter by Tob is great - thanks!.

We're hoping to help with improvement of this important tool. It is in the "top ten" items of Web3D Consortium X3D Projects Wish List.

David Tan tested it on the following example. Exported results worked without modifications in InstantReality but not in any other X3D tool. Attached in next post please find

  • Directions for installing plugin (see README for list of steps)
  • Model source:
  • Screenshots attached of model in Unity
  • Screenshots of Unity interface invocation
  • Screenshots attached of exported X3D model in InstantReality

Here are some issues with the X3D output:

<?xml version="1.0" encoding="UTF-8"?>
<?!DOCTYPE X3D PUBLIC "ISO//Web3D//DTD X3D 3.3//EN" "http://www.web3d.org/specifications/x3d-3.3.dtd">
<?X3D profile='Immersive' version='3.3' xmlns:xsd='http://www.w3.org/2001/XMLSchema-instance' xsd:noNamespaceSchemaLocation='http://www.web3d.org/specifications/x3d-3.3.xsd'>

List of illegal X3D nodes (InstantReality extensions perhaps?) and potential X3D replacements:

  • SolidBackground to Background
  • TextureCoordinate2D as
  • 'TRUE' is not a valid value for SFBool, instead use 'true' in .x3d XML encoding
  • Similarly for 'FALSE'
  • CommonSurfaceShader - see X3D Programmable Shaders Component

All X3D scene export results can be checked online using the X3D Validator

@datan8457
Copy link

datan8457 commented Apr 26, 2018

I've summarized the process / outputs of my use of the X3D Exporter in this post.

Disclaimer -
My x3d experience is limited to exactly the below. I made no edits to theFranke's .cs script.
I am also not a Unity/.cs expert. I have only worked in this area for a few months.


I placed the unityx3d.cs file in my Unity project's "Assets" folder as shown below:
explorerdirectoryview_s

My Unity project consists of a semi-spherical volume composed of scaled cubes.
unitysceneview1

The individual cubes are untextured and simply have a material with the shader qualities noted below:
gameobjectmaterial

Then per the readme, I selected the empty gameObject that contains all the cells and selected "Assets-> X3D -> Export X3D...":
unitysceneview2

It then runs for a few minutes and the .x3d file appears.

Opening the file in InstantReality and selecting Navigation -> Show All provides the below view:
x3doutputwhite

I then opened the .x3d file in a text editor and did a find+replace all "<appearance />" with the below:
x3dappearancechanged

There was no specific reason why I chose the RGB values, Any valid color should work.

This then produced:
x3doutputfront
x3doutputiso
x3doutputtop


In summary, works pretty well (though the output file is over 10mb in size).

I have attached an output from a much coarser run of the project that is ~500kb.

smallX3DoutputSample.txt

@thefranke thefranke self-assigned this Jun 16, 2018
@thefranke
Copy link
Owner

TextureCoordinate2D as

@brutzman The potential fix is missing. Which node did you mean?

@thefranke
Copy link
Owner

CommonSurfaceShader - see X3D Programmable Shaders Component

@brutzman The CommonSurfaceShader is an Avalon-only component and is used because the regular Material node does not support the rich variety of parameters used commonly in renderers today. You can however switch it off if you untick Unity -> Preferences -> UnityX3D -> Use CommonSurfaceShader

@thefranke
Copy link
Owner

I've pushed a round of fixes for everything except the header part "ISO//Web3D//DTD X3D 3.3//EN", which somehow I can't get to work right now with the XML C# API.

@andreasplesch
Copy link

doctype = doc.CreateDocumentType("X3D", "ISO//Web3D//DTD X3D 3.3//EN", "http://www.web3d.org/specifications/x3d-3.3.dtd", null);

seems to work, at least here:

https://dotnetfiddle.net/d3UFIt

I can submit an (untested) PR if desired.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants