Editing
Appendix/Ramblings/VirtualReality
(section)
Jump to navigation
Jump to search
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
====Implementing the Raw COLLADA Code==== 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 — 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 [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%" cellpadding="5"> <tr><th align="center" colspan="3">Example #4 — 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" colspan="2"> <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" rowspan="1" bgcolor="lightgrey">[[File:ColladaPlay06_image.png|250px|ColladaPlay06_image]]</td> </tr> <tr> <td align="left" colspan="3"> <b>Principal responsibilities of various subsections from the above, <xml>-formatted code:</b> </td> </tr> <tr> <td align="center" width="50px" bgcolor="yellow">'''A.'''</td> <td align="left" colspan="2"> <pre> <library_visual_scenes> <visual_scene ID="ID1"> <node name="SketcUp"> </pre> <font color="darkblue">Generate 3 ''instances'' of </font><font color="green">#ID3</font><font color="darkblue">, placing them at 3 separate 16-argument "matrix" positions, as [[#Understanding_the_Positioning_Matrix|explained below]].</font> <pre> </node> </visual_scene> </library_visual_scenes> </pre> </td> </tr> <tr> <td align="center" width="50px" bgcolor="lightblue">'''B.'''</td> <td align="left" colspan="2"> <pre> <library_nodes> <node id="ID3"> </pre> <font color="darkblue">Define all components of a ''single node'' that describes a simple, 6-sided (8 vertices and 12 triangles) cube; this implementation builds the cube as being composed of ''three'' separate <instance_geometries>, as defined below:</font> <ul> <li><font color="#FF9999"><b>url = "</b></font><font color="darkgreen">#ID4</font><font color="#FF9999"><b>" should be colored/shaded as defined by material target = "</b></font><font color="darkgreen">#ID6</font><font color="#FF9999"><b>", which in turn points to library effect = "</b></font><font color="darkgreen">#ID5</font><font color="#FF9999"><b>".</b></font></li> <li><font color="#FF9999"><b>url = "</b></font><font color="darkgreen">#ID12</font><font color="#FF9999"><b>" should be colored/shaded as defined by material target = "</b></font><font color="darkgreen">#ID13</font><font color="#FF9999"><b>", which in turn points to library effect = "</b></font><font color="darkgreen">#ID14</font><font color="#FF9999"><b>".</b></font></li> <li><font color="#FF9999"><b>url = "</b></font><font color="darkgreen">#ID20</font><font color="#FF9999"><b>" should be colored/shaded as defined by material target = "</b></font><font color="darkgreen">#ID21</font><font color="#FF9999"><b>", which in turn points to library effect = "</b></font><font color="darkgreen">#ID22</font><font color="#FF9999"><b>".</b></font></li> </ul> <pre> </node> </library_nodes> </pre> </td> </tr> <tr> <td align="center" width="50px" bgcolor="yellow">'''C.'''</td> <td align="left" colspan="2"> <pre> <library_geometries> <geometry id="…"> </pre> <font color="darkblue">Two co-planar and adjacent triangles are prescribed such that, together, they define a square, which serves as ''one'' of the six sides of the cube; ''four'' unique vertices are required, referenced as … 0, 1, 2, 3.</font><br /> <mesh><br /> <vertices id="<font color="darkgreen">ID17</font>"> <ul> <li><font color="#FF9999"><b>(X, Y, Z) coordinate locations are pulled from</b></font> <source id="<font color="darkgreen">ID15</font>"> <font color="#FF9999"><b>, which contains a total of 4 × 3 = 12 floating-point numbers.</b></font></li> <li><font color="#FF9999"><b>The (X, Y, Z)-normals assigned to the four vertices are pulled from</b></font> <source id="<font color="darkgreen">ID16</font>"> <font color="#FF9999"><b>, which also contains a total of 4 × 3 = 12 floating-point numbers … the assigned values are usually 0 or ± 1.</b></font></li> </ul> </vertices><br /> <triangles source="<font color="darkgreen">#ID17</font>" count="2"><br /> <p>0 1 2 1 0 3</p> <ul> <li><font color="#FF9999"><b>This sequence of six integers means that the 1<sup>st</sup> (of count="2") triangular polygon is formed by connecting three vertices in the order … 0, 1, 2, then back to 0; and the 2<sup>nd</sup> (of count="2") triangular polygon is formed by connecting three vertices in the order … 1, 0, 3, then back to 1.</b></font></li> </ul> </triangles><br /> </mesh> <pre> </geometry> </library_geometries> </pre> </td> </tr> </table>
Summary:
Please note that all contributions to JETohlineWiki may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see
JETohlineWiki:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Navigation menu
Personal tools
Not logged in
Talk
Contributions
Log in
Namespaces
Page
Discussion
English
Views
Read
Edit
View history
More
Search
Navigation
Main page
Tiled Menu
Table of Contents
Old (VisTrails) Cover
Appendices
Variables & Parameters
Key Equations
Special Functions
Permissions
Formats
References
lsuPhys
Ramblings
Uploaded Images
Originals
Recent changes
Random page
Help about MediaWiki
Tools
What links here
Related changes
Special pages
Page information