Unity
XR Tutorial 1:
Unity Scene Graph API and Editor
Spring 2022
Due: See Canvas
Assignment T3: Unity XR Tutorial 1
Author: Zachary Wartell
https://webpages.uncc.edu/~zwartell/
Updated: Wed May 4 20:48:24 2022 -0400
Change Log: [link]
This page has been tested on Firefox and Chrome.
I estimate this tutorial will take roughly 30 hours over the three week assignment period.
Pedagogical Footnote: Design of and Audience for this Tutorial Project
This course is a Computer Science course, not an Industrial Design or Industrial Art course that would be appropriate for individuals seeking an MFA in digital product art. Of course, real world interactive 3D applications -- especially entertainment products, but less so for data visualization applications -- require team members from dozens of professions. For instance, Dr. Wartell's first post-baccalaureate job was at NCR Human Interface Technology Center [MacTavish97] whose members included computer scientists, industrial artists, industrial designers, cognitive scientists, psychologists, electrical engineers, and industrial engineers. He part of a team of 3D graphics programmers hired by Dr. Mark and Nong Tarlton in order to develop the Dr.'s Tarltons' cross-platform, object-oriented real-time rendering engine, "Mirage" [Tarlton92][Tarlton95].
For this tutorial, a CS student's goal is to be familiarity with
the Unity Editor's capabilities as a 3D modeling tool, but not to
be an expert at the level of a digital production artist,
architect or industrial designer. These professionals generally
use more sophisticated 3D modeling tools as well such as Blender, AutoCAD,
etc.
To avoid the cost of additional textbooks (or on-line certificate
courses), this tutorial project interjects custom exercises into
readings from dollar free, advertisement free (i.e. distraction
free), on-line manuals. In Unity the on-line manuals are split
between the Unity Manual (https://docs.unity3d.com/Manual/UnityManual.html)
and the Scripting API (https://docs.unity3d.com/ScriptReference/index.html).
The Unity Manual focuses on Unity's Editor (e.g. it's 3D modeling
tool) with only cursory coverage of the Unity scene graph and
renderer API that makes the entire 3D simulation system work. The
documentation on the latter, the Scripting API, tends to assume
either:
This tutorial project interweaves readings from both the Unity
Manual and the Unity Scripting API. The goal is CS start students
on the path toward mastering the 3D graphics and geomtric
programming necessary to implemented 3D user interfaces on
VR/AR/MR or WIMP systems along with the relevant 3D geometric
programming required for such applications.
Spring 2020 Students: Items 1-3 are unchanged from previous assignments, but Item 4 is new.
lucretius@CCIWD-435B-1 ~/ITCS_4120 $ ls -la total 20
|
In this document's instructions, you are required to make git commits at specific points using specific commit messages. The git commits are a required part of the assignment. It also introduces you to good git practices.
As your read through various sections of the U3DDoc's you will perform various exercises. You must submit them to various directories inside a single Git repo.
lucretius@CCIWD-435B-1
~/
lucretius@CCIWD-435B-1 ~/ $cd ITCS_VRAR
|
lucretius@CCIWD-435B-1
~/ITCS_VRAR/ $git clone
https://cci-git.uncc.edu/your_user_id/Unity_XR_Tutorial_1.git
Unity_XR_Tutorial_1-git-start Cloning into ' Unity_XR_Tutorial_1-git-start '...
|
You will need a computer that has the Unity Hub and Unity Editor installed. Unity provides a free Personal Edition for students the you can access through an on-line signup mechnism. U3DDoc's describes this installed and setup process at https://docs.unity3d.com/Manual/GettingStartedInstallingUnity.html.
Computers in the VisCenter and in the CCI Open Lab has Unity Hub and Unity Editor installed.
The instructions below walk the reader through a subset of the
Unity Manual and the Scripting API and interject multiple required
exercises. Most of the instruction steps are labeled as "Chapter :
Section : Subsection" indicating the related sections found the
Unity documenation. When successive steps refer to the same online
Chapter, the short-hand notation "⮤:"
is used to indicate that the reading in a step is part of the same
chapter (or section) as in the previous step. Mouse
hovering on the "⮤:"
will
temporarily display the full document path to the step's section.
Note, there are many versions of Unity. For this class
we are using the most recent version the Unity granted LTS
status, 2020.3 LTS. (My
experience in teaching suggests that using a Beta version or a
non-LTS version of an API in a classroom setting is typically not a
good idea.).
"Unity User Manual 2020.3 (LTS)"
Note:
if (debugLog)
.
Leave the breakpoint disabled (but do not delete it).
Pedagogical Footnote: Scene Graph Instancing
Scene graphs are called scene graphs and not scene tree's because the scene's data structure as a whole is not a tree but rather a directed-acyclic-graph (DAG). In a DAG, an geometric object, such as a wheel, can be instantiated multiple times by making the same programming language geometry object into a child of multiple transform nodes in the scene graph. So a single wheel geometry object would be a child of four different transform nodes, where each transform node has it's own location and orientation ("pose"). The rendering engine will draw 4 copies of the wheel at four locations corresponding to the four wheel of the car object. DAG based instancing is ubiquitous in scene graph API's at least since the 80's (if not earlier).
Note: The next few steps require reading the
U3DDoc sub-sections of Creating Gameplay : Prefabs
slightly out of order.
Note: Skip "Rotation and Orientation in Unity " and skip "Lights" (You read them earlier).
See the course syllabus regarding partial credit and the late
penalty policy.
This is an individual student project. Each student
should be writing and submitting their own code.
Students can discuss general aspects of the various API's and tools with each other and this is strongly encouraged. Discussing algorithm's at the pseudo-code level is also acceptable.
However, it is not permissible:
using System.Collections; using System.Collections.Generic; using System; using UnityEngine; public class MainScript : MonoBehaviour { private GameObject platform; private GameObject tracker; private GameObject leftSensor; private GameObject rightSensor; private GameObject leftController; private GameObject rightController; private bool debugLog = false; // Start is called before the first frame update void Start() { tracker = GameObject.Find("Tracker"); leftSensor = GameObject.Find("Left Sensor"); rightSensor = GameObject.Find("Right Sensor"); leftController = GameObject.Find("Left Controller"); rightController = GameObject.Find("Right Controller"); } // Update is called once per frame void Update() { if (debugLog) LogHierarchy(transform,0); } static void LogHierarchy(Transform t,int level) { String indent=""; indent = indent.PadLeft(level * 4, ' '); Debug.Log(indent + t.gameObject.name + " LCS: " + t.localPosition + " WCS: " + t.position); for (int i=0;i < t.childCount;i++) LogHierarchy(t.GetChild(i),level+1); } }
Section | Item | Category | Link | Points | Full Marks | Marks | Comments |
---|