VisTrails Home

User:Tohline/Appendix/Ramblings/VirtualReality

From VisTrailsWiki

(Difference between revisions)
Jump to: navigation, search
(Good Cube Examples)
(Good Cube Examples)
Line 459: Line 459:
</tr></table>
</tr></table>
 +
===Cube Trio by a Blender Developer===
 +
 +
We have found another relatively simple COLLADA-formatted 3D model file on a [https://developer.blender.org/F18376 web page titled, "cube.dae,"] that has been provided by [https://www.blender.org Blender] author, Martjn Berger.  The interactive scene that is generated by this model file includes three separate &#8212; but identical &#8212; cubes; four of the cube faces are painted with one color (e.g., blue), another face is painted with a different color (e.g., green), and the sixth face is painted with yet a different color (e.g., red).  The COLLADA-formatted (.dae) file presented immediately below as ''Example #4'' is modified slightly from this original [https://www.blender.org Blender] example; on my Mac, the filename is: '''/Dropbox/3Dviewers/Cube/FirstCube/colladaPlay06.dae'''
 +
 +
 +
<table border="0" align="center" width="80%">
 +
<tr><th align="center" colspan="2">Example #4 &#8212; A [https://developer.blender.org/F18376 cube trio], slightly modified from a COLLADA file posted by [https://www.blender.org Blender]</th></tr>
 +
<tr><td align="left">
 +
<div style="height: 400px; width: 700px; overflow: scroll;">
 +
<pre>
 +
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
 +
<COLLADA xmlns="http://www.collada.org/2005/11/COLLADASchema" version="1.4.1">
 +
    <asset>
 +
        <contributor>
 +
            <authoring_tool>Google SketchUp 8.0.11752</authoring_tool>
 +
        </contributor>
 +
        <created>2012-04-27T21:07:03Z</created>
 +
        <modified>2012-04-27T21:07:03Z</modified>
 +
        <unit meter="0.0254" name="inch" />
 +
        <up_axis>Z_UP</up_axis>
 +
    </asset>
 +
    <library_visual_scenes>
 +
        <visual_scene id="ID1">
 +
            <node name="SketchUp">
 +
                <node id="ID2" name="instance_0">
 +
                    <matrix>1 0 0 0 0 1 0 25 0 0 1 0 0 0 0 1</matrix>
 +
                    <instance_node url="#ID3" />
 +
                </node>
 +
                <node id="ID28" name="instance_1">
 +
                    <matrix>1 0 0 15 0 1 0 120 0 0 1 0 0 0 0 1</matrix>
 +
                    <instance_node url="#ID3" />
 +
                </node>
 +
                <node id="ID29" name="instance_2">
 +
                    <matrix>1 0 0 120 0 1 0 0 0 0 1 0 0 0 0 1</matrix>
 +
                    <instance_node url="#ID3" />
 +
                </node>
 +
            </node>
 +
        </visual_scene>
 +
    </library_visual_scenes>
 +
    <library_nodes>
 +
        <node id="ID3" name="cube_component">
 +
            <instance_geometry url="#ID4">
 +
                <bind_material>
 +
                    <technique_common>
 +
                        <instance_material symbol="Material2" target="#ID6">
 +
                            <bind_vertex_input semantic="UVSET0" input_semantic="TEXCOORD" input_set="0" />
 +
                        </instance_material>
 +
                    </technique_common>
 +
                </bind_material>
 +
            </instance_geometry>
 +
            <instance_geometry url="#ID12">
 +
                <bind_material>
 +
                    <technique_common>
 +
                        <instance_material symbol="Material2" target="#ID13">
 +
                            <bind_vertex_input semantic="UVSET0" input_semantic="TEXCOORD" input_set="0" />
 +
                        </instance_material>
 +
                    </technique_common>
 +
                </bind_material>
 +
            </instance_geometry>
 +
            <instance_geometry url="#ID20">
 +
                <bind_material>
 +
                    <technique_common>
 +
                        <instance_material symbol="Material2" target="#ID21">
 +
                            <bind_vertex_input semantic="UVSET0" input_semantic="TEXCOORD" input_set="0" />
 +
                        </instance_material>
 +
                    </technique_common>
 +
                </bind_material>
 +
            </instance_geometry>
 +
        </node>
 +
    </library_nodes>
 +
    <library_geometries>
 +
        <geometry id="ID4">
 +
            <mesh>
 +
                <source id="ID7">
 +
                    <float_array id="ID10" count="48">39.37007874015748 39.37007874015748 0 0 0 0 0 39.37007874015748 0 39.37007874015748 0 0 0 39.37007874015748 39.37007874015748 39.37007874015748 39.37007874015748 0 0 39.37007874015748 0 39.37007874015748 39.37007874015748 39.37007874015748 39.37007874015748 39.37007874015748 0 39.37007874015748 0 39.37007874015748 39.37007874015748 0 0 39.37007874015748 39.37007874015748 39.37007874015748 39.37007874015748 0 39.37007874015748 0 39.37007874015748 39.37007874015748 0 0 39.37007874015748 39.37007874015748 39.37007874015748 39.37007874015748</float_array>
 +
                    <technique_common>
 +
                        <accessor count="16" source="#ID10" stride="3">
 +
                            <param name="X" type="float" />
 +
                            <param name="Y" type="float" />
 +
                            <param name="Z" type="float" />
 +
                        </accessor>
 +
                    </technique_common>
 +
                </source>
 +
                <source id="ID8">
 +
                    <float_array id="ID11" count="48">0 0 -1 0 0 -1 0 0 -1 0 0 -1 0 1 0 0 1 0 0 1 0 0 1 0 1 0 0 1 0 0 1 0 0 1 0 0 0 0 1 0 0 1 0 0 1 0 0 1</float_array>
 +
                    <technique_common>
 +
                        <accessor count="16" source="#ID11" stride="3">
 +
                            <param name="X" type="float" />
 +
                            <param name="Y" type="float" />
 +
                            <param name="Z" type="float" />
 +
                        </accessor>
 +
                    </technique_common>
 +
                </source>
 +
                <vertices id="ID9">
 +
                    <input semantic="POSITION" source="#ID7" />
 +
                    <input semantic="NORMAL" source="#ID8" />
 +
                </vertices>
 +
                <triangles count="8" material="Material2">
 +
                    <input offset="0" semantic="VERTEX" source="#ID9" />
 +
                    <p>0 1 2 1 0 3 4 5 6 5 4 7 8 9 10 9 8 11 12 13 14 13 12 15</p>
 +
                </triangles>
 +
            </mesh>
 +
        </geometry>
 +
        <geometry id="ID12">
 +
            <mesh>
 +
                <source id="ID15">
 +
                    <float_array id="ID18" count="12">39.37007874015748 0 39.37007874015748 0 0 0 39.37007874015748 0 0 0 0 39.37007874015748</float_array>
 +
                    <technique_common>
 +
                        <accessor count="4" source="#ID18" stride="3">
 +
                            <param name="X" type="float" />
 +
                            <param name="Y" type="float" />
 +
                            <param name="Z" type="float" />
 +
                        </accessor>
 +
                    </technique_common>
 +
                </source>
 +
                <source id="ID16">
 +
                    <float_array id="ID19" count="12">-0 -1 -0 -0 -1 -0 -0 -1 -0 -0 -1 -0</float_array>
 +
                    <technique_common>
 +
                        <accessor count="4" source="#ID19" stride="3">
 +
                            <param name="X" type="float" />
 +
                            <param name="Y" type="float" />
 +
                            <param name="Z" type="float" />
 +
                        </accessor>
 +
                    </technique_common>
 +
                </source>
 +
                <vertices id="ID17">
 +
                    <input semantic="POSITION" source="#ID15" />
 +
                    <input semantic="NORMAL" source="#ID16" />
 +
                </vertices>
 +
                <triangles count="2" material="Material2">
 +
                    <input offset="0" semantic="VERTEX" source="#ID17" />
 +
                    <p>0 1 2 1 0 3</p>
 +
                </triangles>
 +
            </mesh>
 +
        </geometry>
 +
        <geometry id="ID20">
 +
            <mesh>
 +
                <source id="ID23">
 +
                    <float_array id="ID26" count="12">0 39.37007874015748 39.37007874015748 0 0 0 0 0 39.37007874015748 0 39.37007874015748 0</float_array>
 +
                    <technique_common>
 +
                        <accessor count="4" source="#ID26" stride="3">
 +
                            <param name="X" type="float" />
 +
                            <param name="Y" type="float" />
 +
                            <param name="Z" type="float" />
 +
                        </accessor>
 +
                    </technique_common>
 +
                </source>
 +
                <source id="ID24">
 +
                    <float_array id="ID27" count="12">-1 0 0 -1 0 0 -1 0 0 -1 0 0</float_array>
 +
                    <technique_common>
 +
                        <accessor count="4" source="#ID27" stride="3">
 +
                            <param name="X" type="float" />
 +
                            <param name="Y" type="float" />
 +
                            <param name="Z" type="float" />
 +
                        </accessor>
 +
                    </technique_common>
 +
                </source>
 +
                <vertices id="ID25">
 +
                    <input semantic="POSITION" source="#ID23" />
 +
                    <input semantic="NORMAL" source="#ID24" />
 +
                </vertices>
 +
                <triangles count="2" material="Material2">
 +
                    <input offset="0" semantic="VERTEX" source="#ID25" />
 +
                    <p>0 1 2 1 0 3</p>
 +
                </triangles>
 +
            </mesh>
 +
        </geometry>
 +
    </library_geometries>
 +
    <library_materials>
 +
        <material id="ID6" name="material">
 +
            <instance_effect url="#ID5" />
 +
        </material>
 +
        <material id="ID13" name="Color_005_">
 +
            <instance_effect url="#ID14" />
 +
        </material>
 +
        <material id="ID21" name="Color_A06_">
 +
            <instance_effect url="#ID22" />
 +
        </material>
 +
    </library_materials>
 +
    <library_effects>
 +
        <effect id="ID5">
 +
            <profile_COMMON>
 +
                <technique sid="COMMON">
 +
                    <lambert>
 +
                        <diffuse>
 +
                            <color>0 0 1 1</color>
 +
                        </diffuse>
 +
                    </lambert>
 +
                </technique>
 +
            </profile_COMMON>
 +
        </effect>
 +
        <effect id="ID14">
 +
            <profile_COMMON>
 +
                <technique sid="COMMON">
 +
                    <lambert>
 +
                        <diffuse>
 +
                            <color>0 1 0 1</color>
 +
                        </diffuse>
 +
                    </lambert>
 +
                </technique>
 +
            </profile_COMMON>
 +
        </effect>
 +
        <effect id="ID22">
 +
            <profile_COMMON>
 +
                <technique sid="COMMON">
 +
                    <lambert>
 +
                        <diffuse>
 +
                            <color>0.8 0 0 1</color>
 +
                        </diffuse>
 +
                    </lambert>
 +
                </technique>
 +
            </profile_COMMON>
 +
        </effect>
 +
    </library_effects>
 +
    <scene>
 +
        <instance_visual_scene url="#ID1" />
 +
    </scene>
 +
</COLLADA>
 +
</pre>
 +
</div>
 +
</td>
 +
<td align="center">[[File:ColladaPlay06.png|250px|ColladaPlay06]]</td>
 +
</tr></table>
{{LSU_HBook_footer}}
{{LSU_HBook_footer}}

Revision as of 11:32, 7 September 2019


Contents

Virtual Reality and 3D Printing

[Circa August 2019] I am once again considering whether steady improvements in certain digital technologies over the past half-a-dozen years can be straightforwardly called upon to display to a broad audience the three-dimensional characteristics of rapidly rotating fluid systems. Two specific technologies come to mind: (1) 3D printing; and (2) XR (virtual reality). A cursory online investigation suggests that we may be able to import OBJ-formatted files into the software algorithms that drive these two technologies. In addition, the popular Unity design tool may serve us well in our efforts to build/view/export such files.

Whitworth's (1981) Isothermal Free-Energy Surface
|   Tiled Menu   |   Tables of Content   |  Banner Video   |  Tohline Home Page   |

Initial Browsing of Online Resources

  • DAE files & XML COLLADA format   <--   the Preview application on my MacBook Air will open/display a .DAE file
    • A file with the DAE file extension is a Digital Asset Exchange file. DAE files are based on the COLLADA (COLLAborative Design Activity) XML schema, which is now owned and developed by Autodesk (e.g., Maya). DAE files allow users to transmit 3D graphics files across multiple graphics applications.
    • Examples:

      cube.dae  <--   NOTE: I have copied this "dae" file into a dropbox folder and have successfully modified it (changed color from red to purple) inside my txt editor.

      In March 2011, Khronos released the COLLADA Conformance Test Suite (CTS). The suite allows applications that import and export COLLADA to test against a large suite of examples, ensuring that they conform properly to the specification. In July 2012, the CTS software was released on GitHub — also see, an associated PDF document, and OpenCOLLADA hosted on Github — allowing for community contributions.

      Check out turbosquid.com; or Free3d

    • August 2013:  Autodesk has released Maya LT with COLLADA export capabilities.
  • Four most common 3D printer file formats in 2019.
    • STL:
      File Format Simply Explained.

      As of today, STL is the undisputed champion among 3D printer file formats. STL’s history goes back to the invention of 3D printing itself. The first 3D printer was invented by Chuck Hull in 1987 at 3D Systems. The same guy was behind the STL file format. If you are primarily printing with a single material and in a single color, STL will do the job. But the moment you move to multicolor printing, you have to ditch STL because it is simply not capable of storing colors.

      There are many repositories, marketplaces and search engines on the web containing literally millions of free STL files. Thingiverse is probably the largest STL file repository on the internet – so check it out. You can also refer to our regularly updated list: Best Sites for Free STL Files & 3D Printer Models.

      STL File Viewers

    • OBJ:

      File format explained.

      Format developed by Wavefront; note that a number of the above-referenced STL viewers will also view OBJ files.

    • AMF
    • 3MF
  • Try this online 3D converter; in principle, it can be used to convert a DAE (i.e., COLLADA) file to an STL or OBJ file, and visa versa.
  • Unity
    • See especially the Products page which briefly refers to …
      • Platforms: Build once, deploy anywhere to reach the largest possible audience on our industry-leading platform; 25+ platforms across mobile, desktop, console, TV, VR (virtual reality), AR (augmented reality) and the Web.
      • XR: Powering over two-thirds of VR and AR experiences; Unity is the preferred development tool for the majority of XR creators.
  • Unreal Engine 4 — competitor of Unity
  • Oculus Rift S driven by PC; or Oculus Quest, standalone 6DOF VR — looks like they both can be driven by either Unity or Unreal, or via the Native Platform provided by Oculus.
    • In principle, the Oculus Rift can import new, user-supplied 3D scenes — see the advanced help document — but, for now, it only accepts files in GLB format.
    • But see the import feature of Oculus Medium 2.0.
    • GLB format:  a binary form of glTF that includes textures instead of referencing them as external images.
    • glTF:   (derivative short form of GL Transmission Format) is a file format for 3D scenes and models using the JSON standard. It is an API-neutral runtime asset delivery format developed by the Khronos Group 3D Formats Working Group. It was announced at HTML5DevConf 2016. This format is intended to be an efficient, interoperable format with minimum file size and runtime processing by apps. As such, its creators have described it as the "JPEG of 3D."
  • Gear VR — Samsung's headset (powered by Oculus)

    GearVR Framework is the SDK for Samsung's Gear VR.
  • Also consider Oculus Go
  • vtk has vtkOBJExporter as well as vtkOBJReader
  • Kitware may also be relevant
  • Jinghua Ge's CCT-based visualization lab course
  • Look into the VR Model Viewer from MindRend Technologies, which "is a tool to import and view CAD models of various types in VR."

    It claims to provide support for three of the four formats identified above in connection with 3D printers, namely: STL, OBJ (with MTL file), and 3MF.

    It supports the following VR headsets: Oculus Rift and HTC Vive.

Best Info, to Date

  1. Check out the Khronos Group's Overview of glTF; note that GLB is the binary form of glTF.
  2. Evidently, a user's native 3D scene can be transferred (in GLB format) to the Oculus Medium 2.0, and then viewed with Oculus-supported headgear.

    An Oculus blog posted 14 February 2019 and titled, "Rift Platform Updates: Create Your Own Space," states the following … "Home is no longer limited to the stock cabin model. Now, we give you a couple templates, a cafe and theater, plus special themed decor and furniture items to play with — and you can upload any additional 3D models you’d like." See more details here.

  3. DAE (i.e., XML COLLADA-formatted) files …
    1. The Mac's Preview application can display DAE files — see, for example, cube.dae.
    2. Evidently I should expect most 3D printers to accept DAE-formatted files as well as the older and more familiar STL and OBJ files.
    3. Check out the Khronos Group's Overview of COLLADA.
    4. COLLADA Tutorials
    5. Animation Tutorial

I wonder if even very simple DAE files can be converted to glTF (and GLB) files; perhaps the tools, glTF API or COLLADA2GLTF will work. If so, then we can kill two birds with one stone; i.e., simply build DAE files, then they should be straightforwardly ported to Oculus headgear or a 3D printer.

Good Cube Examples

In the context of the following example discussions, I have relied upon just three available viewers to judge whether any/each <xml> file is properly formatted:

  • The Preview App on my desktop Mac;
  • The 3D Model Viewer App as installed on my Galaxy S8+ — the developer's name is Shyam Barange; and the relevant website appears to be GET INTO AR
  • The COLLADA Viewer App as installed on my Galaxy S8+ — the associated company is Googolplex Ltd

From COLLADA Release Notes

A useful Cube.dae example can be found in Appendix A of the PDF-formatted document titled, COLLADA — Digital Asset Schema Release 1.4.1 — Specification (2nd Edition), March 2008. I was able to execute/display this file using my Mac's Preview app after trimming it down a bit. (When I tried to "copy" then "paste" this text file into my Mac's vi editor, it did not initially execute properly in the Preview app, so I removed some lines of the xml code in an effort to debug my file. (I was guided in this effort by having access to a separately constructed example <xml> model file, named "cube001.dae", that was kindly sent to me by Shyam Barange, the developer of 3D model Viewer.) Much of this trimming may not have been necessary because, in the end, I realized that the essential spacings between integer vertex values and integer normal values in the polygons specification had disappeared during the copy-and-paste operation.) Here is my version of this executable COLLADA (.dae) file, created 2 September 2019; on my Mac, the filename is: /Dropbox/3Dviewers/Cube/ThirdCube/AppendA06Works.dae


Example #1 — Extracted from COLLADA release notes (modified here)
<?xml version="1.0" encoding="utf-8"?>
<COLLADA xmlns="http://www.collada.org/2005/11/COLLADASchema" version="1.4.1">
  <asset>
    <created>2005-11-14T02:16:38Z</created>
    <modified>2005-11-15T11:36:38Z</modified>
    <revision>1.0</revision>
  </asset>
  <library_effects>
    <effect id="whitePhong">
      <profile_COMMON>
        <technique sid="phong1">
          <phong>
            <diffuse>
              <color>0.8 0.0 0.8 1.0</color>
            </diffuse>
          </phong>
        </technique>
      </profile_COMMON>
    </effect>
  </library_effects>
<!--                 -->
  <library_materials>
    <material id="whiteMaterial">
      <instance_effect url="#whitePhong"/>
    </material>
  </library_materials>
  <library_geometries>
    <geometry id="box" name="box">
      <mesh>
        <source id="box-Pos">
          <float_array id="box-Pos-array" count="24">
           -0.5  0.5  0.5
            0.5  0.5  0.5
           -0.5 -0.5  0.5
            0.5 -0.5  0.5
           -0.5  0.5 -0.5
            0.5  0.5 -0.5
           -0.5 -0.5 -0.5
            0.5 -0.5 -0.5
          </float_array>
          <technique_common>
            <accessor source="#box-Pos-array" count="8" stride="3">
              <param name="X" type="float" />
              <param name="Y" type="float" />
              <param name="Z" type="float" />
            </accessor>
          </technique_common>
        </source>
        <source id="box-0-Normal">
          <float_array id="box-0-Normal-array" count="18">
           1.0  0.0  0.0
          -1.0  0.0  0.0
           0.0  1.0  0.0
           0.0 -1.0  0.0
           0.0  0.0  1.0
           0.0  0.0 -1.0
          </float_array>
          <technique_common>
            <accessor source="#box-0-Normal-array" count="6" stride="3">
              <param name="X" type="float"/>
              <param name="Y" type="float"/>
              <param name="Z" type="float"/>
            </accessor>
          </technique_common>
        </source>
        <vertices id="box-Vtx">
          <input semantic="POSITION" source="#box-Pos"/>
        </vertices>
<!--
The 6 separate polygons define the 6 sides of the "cube"; hence, each polygon will
have 4 vertices and 4 associated normals.
As identified in this xml file, the vertices + associated normal for each side/polygon
are listed between the <p></p> notation; the vertex number and associated normal
are interleaved such that the normal is offset by "1".  For example, the first of
the 6 sides/polygons is defined by connecting vertices:  0 -> 2 -> 3 -> 1 -> back to 0;
while all four normals are assigned the direction/number "4".
-->
        <polygons count="6" material="WHITE">
          <input semantic="VERTEX" source="#box-Vtx" offset="0"/>
          <input semantic="NORMAL" source="#box-0-Normal" offset="1"/>
          <p>0 4 2 4 3 4 1 4</p>
          <p>0 2 1 2 5 2 4 2</p>
          <p>6 3 7 3 3 3 2 3</p>
          <p>0 1 4 1 6 1 2 1</p>
          <p>3 0 7 0 5 0 1 0</p>
          <p>5 5 7 5 6 5 4 5</p>
        </polygons>
      </mesh>
    </geometry>
  </library_geometries>
  <library_visual_scenes>
    <visual_scene id="DefaultScene">
      <node id="Box" name="Box">
        <translate> 0  0  3</translate>
        <rotate> 0  0  1  0</rotate>
        <rotate> 0  1  0  0</rotate>
        <rotate> 1  0  0  0</rotate>
        <scale>  1  1  0.2</scale>
        <instance_geometry url="#box">
          <bind_material>
            <technique_common>
              <instance_material symbol="WHITE" target="#whiteMaterial"/>
            </technique_common>
          </bind_material>
        </instance_geometry>
      </node>
    </visual_scene>
  </library_visual_scenes>
  <scene>
    <instance_visual_scene url="#DefaultScene"/>
  </scene>
</COLLADA>


While I was able to view this file successfully within the Preview app on my Mac, it did not display at all on either of the above-identified 3D viewers that I had installed on my Galaxy S8+. As I discovered, the primary issue had to do with how the set of eight vertices were being connected in order to define the model's polygons. In the Example #1 <xml> code, the polygons instruction is used to define six 4-sided polygons. Evidently neither of the Galaxy S8+ viewers understands this polygons instruction. When I used, instead, the triangles instruction to define twelve 3-sided polygons, both of these viewers displayed a 3D object. Here is the relevant, modified executable COLLADA (.dae) file; on my Mac, the filename is: /Dropbox/3Dviewers/Cube/ThirdCube/AppendA08Works.dae


Example #2 — Basically the same as Example #1, but with <triangles> replacing <polygons>
<?xml version="1.0" encoding="utf-8"?>
<COLLADA xmlns="http://www.collada.org/2005/11/COLLADASchema" version="1.4.1">
  <asset>
    <created>2005-11-14T02:16:38Z</created>
    <modified>2005-11-15T11:36:38Z</modified>
    <revision>1.0</revision>
  </asset>
  <library_effects>
    <effect id="whitePhong">
      <profile_COMMON>
        <technique sid="phong1">
          <phong>
            <diffuse>
              <color>0.1 0.9 0.1 1.0</color>
            </diffuse>
          </phong>
        </technique>
      </profile_COMMON>
    </effect>
  </library_effects>
<!--                 -->
  <library_materials>
    <material id="whiteMaterial">
      <instance_effect url="#whitePhong"/>
    </material>
  </library_materials>
  <library_geometries>
    <geometry id="box" name="box">
      <mesh>
        <source id="box-Pos">
          <float_array id="box-Pos-array" count="24">
            0.5  0.5 -0.5
            0.5 -0.5 -0.5
           -0.5 -0.5 -0.5
           -0.5  0.5 -0.5
            0.5  0.5  0.5
            0.5 -0.5  0.5
           -0.5 -0.5  0.5
           -0.5  0.5  0.5
          </float_array>
          <technique_common>
            <accessor source="#box-Pos-array" count="8" stride="3">
              <param name="X" type="float" />
              <param name="Y" type="float" />
              <param name="Z" type="float" />
            </accessor>
          </technique_common>
        </source>
        <source id="box-0-Normal">
          <float_array id="box-0-Normal-array" count="18">
           0.0  0.0 -1.0
           0.0  0.0  1.0
           1.0  0.0  0.0
           0.0 -1.0  0.0
          -1.0  0.0  0.0
           0.0  1.0  0.0
          </float_array>
          <technique_common>
            <accessor source="#box-0-Normal-array" count="6" stride="3">
              <param name="X" type="float"/>
              <param name="Y" type="float"/>
              <param name="Z" type="float"/>
            </accessor>
          </technique_common>
        </source>
        <vertices id="box-Vtx">
          <input semantic="POSITION" source="#box-Pos"/>
        </vertices>
        <triangles count="12" material="WHITE">
          <input semantic="VERTEX" source="#box-Vtx" offset="0"/>
          <input semantic="NORMAL" source="#box-0-Normal" offset="1"/>
          <p>0 0 2 0 3 0   7 1 5 1 4 1   4 2 1 2 0 2   5 3 2 3 1 3   2 4 7 4 3 4   0 5 7 5 4 5   0 0 1 0 2 0   7 1 6 1 5 1   4 2 5 2 1 2   5 3 6 3 2 3   2 4 6 4 7 4   0 5 3 5 7 5</p>
        </triangles>
      </mesh>
    </geometry>
  </library_geometries>
  <library_visual_scenes>
    <visual_scene id="DefaultScene">
      <node id="Box" name="Box">
        <translate> 0  0  3</translate>
        <rotate> 0  0  1  0</rotate>
        <rotate> 0  1  0  0</rotate>
        <rotate> 1  0  0  0</rotate>
        <scale>  1  1  0.2</scale>
        <instance_geometry url="#box">
          <bind_material>
            <technique_common>
              <instance_material symbol="WHITE" target="#whiteMaterial"/>
            </technique_common>
          </bind_material>
        </instance_geometry>
      </node>
    </visual_scene>
  </library_visual_scenes>
  <scene>
    <instance_visual_scene url="#DefaultScene"/>
  </scene>
</COLLADA>
AppendA08Works

Here are a few additional items of note regarding Example #2:

  • I set the <color> value to (R, G, B, alpha) = (0.1, 0.9, 0.1, 1), so the resulting "cube" is colored green.
  • I set the coordinate <scale> factors to (X, Y, Z) = (1, 1, 0.2), so the resulting "cube" is actually a solid rectangle that is substantially flatter in the Z-direction than in the other two directions.
  • While the Preview app on the Mac and the COLLADA Viewer on the Galaxy S8+ both displayed a flattened, green solid rectangle as depicted here to the right of the Example #2 <xml> model file, the 3D Model Viewer displayed a white cube instead.

We played with the <xml> code a bit more, changing individual instructions and/or changing various attribute values in an effort to better understand the consequences. The Example #3 <xml> code, shown immediately below, includes many of these alterations; on my Mac the filename is: /Dropbox/3Dviewers/Cube/FourthCube/AppendD13.dae. Both the Preview app on the Mac and the COLLADA Viewer on my Galaxy S8+ generated the red, solid rectangular model depicted here to the right of the Example #3 <xml> model file. The 3D Model Viewer displayed a red, rather than a white, object, which we count as a measure of success; but the displayed 3D object was still an equal-sided cube.

In evolving from the <xml> code displayed here as Example #2 to the <xml> code labeled Example #3, the following two changes appear to have been necessary in order for the 3D Model Viewer to display a red — rather than a white — cube:

  • In both Example #2 code locations where the attribute "WHITE" appears, we substituted the attribute "whiteMaterial".
  • In Example #3, the <visual_scene> includes what appears to be a key additional instruction, namely, <matrix sid="transform">.


Example #3 — Basically the same as Example #2, but after playing with various code modifications
<?xml version="1.0" encoding="utf-8"?>
<COLLADA xmlns="http://www.collada.org/2005/11/COLLADASchema" version="1.4.1">
  <asset>
    <created>2005-11-14T02:16:38Z</created>
    <modified>2005-11-15T11:36:38Z</modified>
    <revision>1.0</revision>
    <unit meter="0.0254" name="inch" />
    <up_axis>Z_UP</up_axis>
  </asset>
  <library_effects>
    <effect id="whitePhong">
      <profile_COMMON>
        <technique sid="phong1">
          <phong>
            <diffuse>
              <color>0.8 0.2 0.2 1.0</color>
            </diffuse>
          </phong>
        </technique>
      </profile_COMMON>
    </effect>
  </library_effects>
<!--                 -->
  <library_materials>
    <material id="whiteMaterial">
      <instance_effect url="#whitePhong"/>
    </material>
  </library_materials>
  <library_geometries>
    <geometry id="box" name="box">
      <mesh>
        <source id="box-Pos">
          <float_array id="box-Pos-array" count="24">
            0.0  1.0  1.0
            1.0  1.0  1.0
            0.0  0.0  1.0
            1.0  0.0  1.0
            0.0  1.0  0.0
            1.0  1.0  0.0
            0.0  0.0  0.0
            1.0  0.0  0.0
          </float_array>
          <technique_common>
            <accessor source="#box-Pos-array" count="8" stride="3">
              <param name="X" type="float" />
              <param name="Y" type="float" />
              <param name="Z" type="float" />
            </accessor>
          </technique_common>
        </source>
        <source id="box-0-Normal">
          <float_array id="box-0-Normal-array" count="18">
           1.0  0.0  0.0
          -1.0  0.0  0.0
           0.0  1.0  0.0
           0.0 -1.0  0.0
           0.0  0.0  1.0
           0.0  0.0 -1.0
          </float_array>
          <technique_common>
            <accessor source="#box-0-Normal-array" count="6" stride="3">
              <param name="X" type="float"/>
              <param name="Y" type="float"/>
              <param name="Z" type="float"/>
            </accessor>
          </technique_common>
        </source>
        <vertices id="box-Vtx">
          <input semantic="POSITION" source="#box-Pos"/>
        </vertices>
        <triangles count="12" material="whiteMaterial">
          <input semantic="VERTEX" source="#box-Vtx" offset="0"/>
          <input semantic="NORMAL" source="#box-0-Normal" offset="1"/>
          <p>0 4 2 4 3 4   0 4 3 4 1 4   4 5 5 5 7 5   4 5 7 5 6 5   0 3 4 3 6 3   0 3 6 3 2 3   3 2 7 2 5 2   3 2 5 2 1 2   2 1 6 1 7 1   2 1 7 1 3 1   0 0 1 0 5 0   0 0 5 0 4 0</p>
        </triangles>
<!--
        <polygons count="6" material="whiteMaterial">
          <input semantic="VERTEX" source="#box-Vtx" offset="0"/>
          <input semantic="NORMAL" source="#box-0-Normal" offset="1"/>
          <p>0 4 2 4 3 4 1 4</p>
          <p>0 2 1 2 5 2 4 2</p>
          <p>6 3 7 3 3 3 2 3</p>
          <p>0 1 4 1 6 1 2 1</p>
          <p>3 0 7 0 5 0 1 0</p>
          <p>5 5 7 5 6 5 4 5</p>
        </polygons>
-->
      </mesh>
    </geometry>
  </library_geometries>
  <library_visual_scenes>
    <visual_scene id="DefaultScene">
      <node id="Box" name="Box">
<!--
        <translate> 0  0.5  0.5</translate>
        <rotate> 0  0  0  0</rotate>
        <rotate> 0  0  0  0</rotate>
        <rotate> 0  0  0  0</rotate>
        <scale>  1  0.2  0.1</scale>
        <matrix sid="transform">1 0 0 0 0 0.292 0 0 0 0 1 1.026 0 0 0 1</matrix>
-->
        <rotate> 0  0  1  0</rotate>
        <rotate> 0  1  0  45</rotate>
        <rotate> 1  0  0  0</rotate>
        <scale>  0.05  0.2  0.1</scale>
        <matrix sid="transform">1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1</matrix>
        <instance_geometry url="#box">
          <bind_material>
            <technique_common>
              <instance_material symbol="whiteMaterial" target="#whiteMaterial"/>
            </technique_common>
          </bind_material>
        </instance_geometry>
      </node>
    </visual_scene>
  </library_visual_scenes>
  <scene>
    <instance_visual_scene url="#DefaultScene"/>
  </scene>
</COLLADA>
AppendD13

Cube Trio by a Blender Developer

We have found another relatively simple COLLADA-formatted 3D model file on a web page titled, "cube.dae," that has been provided by Blender author, Martjn Berger. The interactive scene that is generated by this model file includes three separate — but identical — cubes; four of the cube faces are painted with one color (e.g., blue), another face is painted with a different color (e.g., green), and the sixth face is painted with yet a different color (e.g., red). The COLLADA-formatted (.dae) file presented immediately below as Example #4 is modified slightly from this original Blender example; on my Mac, the filename is: /Dropbox/3Dviewers/Cube/FirstCube/colladaPlay06.dae


Example #4 — A cube trio, slightly modified from a COLLADA file posted by Blender
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<COLLADA xmlns="http://www.collada.org/2005/11/COLLADASchema" version="1.4.1">
    <asset>
        <contributor>
            <authoring_tool>Google SketchUp 8.0.11752</authoring_tool>
        </contributor>
        <created>2012-04-27T21:07:03Z</created>
        <modified>2012-04-27T21:07:03Z</modified>
        <unit meter="0.0254" name="inch" />
        <up_axis>Z_UP</up_axis>
    </asset>
    <library_visual_scenes>
        <visual_scene id="ID1">
            <node name="SketchUp">
                <node id="ID2" name="instance_0">
                    <matrix>1 0 0 0 0 1 0 25 0 0 1 0 0 0 0 1</matrix>
                    <instance_node url="#ID3" />
                </node>
                <node id="ID28" name="instance_1">
                    <matrix>1 0 0 15 0 1 0 120 0 0 1 0 0 0 0 1</matrix>
                    <instance_node url="#ID3" />
                </node>
                <node id="ID29" name="instance_2">
                    <matrix>1 0 0 120 0 1 0 0 0 0 1 0 0 0 0 1</matrix>
                    <instance_node url="#ID3" />
                </node>
            </node>
        </visual_scene>
    </library_visual_scenes>
    <library_nodes>
        <node id="ID3" name="cube_component">
            <instance_geometry url="#ID4">
                <bind_material>
                    <technique_common>
                        <instance_material symbol="Material2" target="#ID6">
                            <bind_vertex_input semantic="UVSET0" input_semantic="TEXCOORD" input_set="0" />
                        </instance_material>
                    </technique_common>
                </bind_material>
            </instance_geometry>
            <instance_geometry url="#ID12">
                <bind_material>
                    <technique_common>
                        <instance_material symbol="Material2" target="#ID13">
                            <bind_vertex_input semantic="UVSET0" input_semantic="TEXCOORD" input_set="0" />
                        </instance_material>
                    </technique_common>
                </bind_material>
            </instance_geometry>
            <instance_geometry url="#ID20">
                <bind_material>
                    <technique_common>
                        <instance_material symbol="Material2" target="#ID21">
                            <bind_vertex_input semantic="UVSET0" input_semantic="TEXCOORD" input_set="0" />
                        </instance_material>
                    </technique_common>
                </bind_material>
            </instance_geometry>
        </node>
    </library_nodes>
    <library_geometries>
        <geometry id="ID4">
            <mesh>
                <source id="ID7">
                    <float_array id="ID10" count="48">39.37007874015748 39.37007874015748 0 0 0 0 0 39.37007874015748 0 39.37007874015748 0 0 0 39.37007874015748 39.37007874015748 39.37007874015748 39.37007874015748 0 0 39.37007874015748 0 39.37007874015748 39.37007874015748 39.37007874015748 39.37007874015748 39.37007874015748 0 39.37007874015748 0 39.37007874015748 39.37007874015748 0 0 39.37007874015748 39.37007874015748 39.37007874015748 39.37007874015748 0 39.37007874015748 0 39.37007874015748 39.37007874015748 0 0 39.37007874015748 39.37007874015748 39.37007874015748 39.37007874015748</float_array>
                    <technique_common>
                        <accessor count="16" source="#ID10" stride="3">
                            <param name="X" type="float" />
                            <param name="Y" type="float" />
                            <param name="Z" type="float" />
                        </accessor>
                    </technique_common>
                </source>
                <source id="ID8">
                    <float_array id="ID11" count="48">0 0 -1 0 0 -1 0 0 -1 0 0 -1 0 1 0 0 1 0 0 1 0 0 1 0 1 0 0 1 0 0 1 0 0 1 0 0 0 0 1 0 0 1 0 0 1 0 0 1</float_array>
                    <technique_common>
                        <accessor count="16" source="#ID11" stride="3">
                            <param name="X" type="float" />
                            <param name="Y" type="float" />
                            <param name="Z" type="float" />
                        </accessor>
                    </technique_common>
                </source>
                <vertices id="ID9">
                    <input semantic="POSITION" source="#ID7" />
                    <input semantic="NORMAL" source="#ID8" />
                </vertices>
                <triangles count="8" material="Material2">
                    <input offset="0" semantic="VERTEX" source="#ID9" />
                    <p>0 1 2 1 0 3 4 5 6 5 4 7 8 9 10 9 8 11 12 13 14 13 12 15</p>
                </triangles>
            </mesh>
        </geometry>
        <geometry id="ID12">
            <mesh>
                <source id="ID15">
                    <float_array id="ID18" count="12">39.37007874015748 0 39.37007874015748 0 0 0 39.37007874015748 0 0 0 0 39.37007874015748</float_array>
                    <technique_common>
                        <accessor count="4" source="#ID18" stride="3">
                            <param name="X" type="float" />
                            <param name="Y" type="float" />
                            <param name="Z" type="float" />
                        </accessor>
                    </technique_common>
                </source>
                <source id="ID16">
                    <float_array id="ID19" count="12">-0 -1 -0 -0 -1 -0 -0 -1 -0 -0 -1 -0</float_array>
                    <technique_common>
                        <accessor count="4" source="#ID19" stride="3">
                            <param name="X" type="float" />
                            <param name="Y" type="float" />
                            <param name="Z" type="float" />
                        </accessor>
                    </technique_common>
                </source>
                <vertices id="ID17">
                    <input semantic="POSITION" source="#ID15" />
                    <input semantic="NORMAL" source="#ID16" />
                </vertices>
                <triangles count="2" material="Material2">
                    <input offset="0" semantic="VERTEX" source="#ID17" />
                    <p>0 1 2 1 0 3</p>
                </triangles>
            </mesh>
        </geometry>
        <geometry id="ID20">
            <mesh>
                <source id="ID23">
                    <float_array id="ID26" count="12">0 39.37007874015748 39.37007874015748 0 0 0 0 0 39.37007874015748 0 39.37007874015748 0</float_array>
                    <technique_common>
                        <accessor count="4" source="#ID26" stride="3">
                            <param name="X" type="float" />
                            <param name="Y" type="float" />
                            <param name="Z" type="float" />
                        </accessor>
                    </technique_common>
                </source>
                <source id="ID24">
                    <float_array id="ID27" count="12">-1 0 0 -1 0 0 -1 0 0 -1 0 0</float_array>
                    <technique_common>
                        <accessor count="4" source="#ID27" stride="3">
                            <param name="X" type="float" />
                            <param name="Y" type="float" />
                            <param name="Z" type="float" />
                        </accessor>
                    </technique_common>
                </source>
                <vertices id="ID25">
                    <input semantic="POSITION" source="#ID23" />
                    <input semantic="NORMAL" source="#ID24" />
                </vertices>
                <triangles count="2" material="Material2">
                    <input offset="0" semantic="VERTEX" source="#ID25" />
                    <p>0 1 2 1 0 3</p>
                </triangles>
            </mesh>
        </geometry>
    </library_geometries>
    <library_materials>
        <material id="ID6" name="material">
            <instance_effect url="#ID5" />
        </material>
        <material id="ID13" name="Color_005_">
            <instance_effect url="#ID14" />
        </material>
        <material id="ID21" name="Color_A06_">
            <instance_effect url="#ID22" />
        </material>
    </library_materials>
    <library_effects>
        <effect id="ID5">
            <profile_COMMON>
                <technique sid="COMMON">
                    <lambert>
                        <diffuse>
                            <color>0 0 1 1</color>
                        </diffuse>
                    </lambert>
                </technique>
            </profile_COMMON>
        </effect>
        <effect id="ID14">
            <profile_COMMON>
                <technique sid="COMMON">
                    <lambert>
                        <diffuse>
                            <color>0 1 0 1</color>
                        </diffuse>
                    </lambert>
                </technique>
            </profile_COMMON>
        </effect>
        <effect id="ID22">
            <profile_COMMON>
                <technique sid="COMMON">
                    <lambert>
                        <diffuse>
                            <color>0.8 0 0 1</color>
                        </diffuse>
                    </lambert>
                </technique>
            </profile_COMMON>
        </effect>
    </library_effects>
    <scene>
        <instance_visual_scene url="#ID1" />
    </scene>
</COLLADA>
ColladaPlay06


Whitworth's (1981) Isothermal Free-Energy Surface

© 2014 - 2019 by Joel E. Tohline
|   H_Book Home   |   YouTube   |
Context: | PGE | SR |
Appendices: | Equations | Variables | References | Binary Polytropes | Ramblings | Images | Images (2016 Layout) | ADS |

Personal tools