Skip to content

Commit

Permalink
Merge pull request #2029 from cre8ivepark/Dev_Working_Branch_readme_i…
Browse files Browse the repository at this point in the history
…mages

[Dev] Readme updates: Landing page & UX
  • Loading branch information
David Kline authored May 4, 2018
2 parents 88bd6b1 + cf91358 commit 77f1404
Show file tree
Hide file tree
Showing 8 changed files with 111 additions and 91 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,20 @@ Dialog is a transient UI element which appears when something happens that requi
https://gfycat.com/ConventionalDirtyKiskadee

## Dialog prefab and DialogShell script
Dialog prefab is located under MixedRealityToolkit/UX/Prefabs folder and dynamically instantiated with Unity's Instantiate() function. This prefab contains **DialogShell** script and **Solver** scripts.
Dialog prefab is located under [MixedRealityToolkit/UX/Prefabs](/Assets/MixedRealityToolkit/UX/Prefabs) folder and dynamically instantiated with Unity's Instantiate() function. This prefab contains **DialogShell** script and **Solver** scripts.

## How to display a Dialog control
You can find the code example in **LaunchDialogScript.cs** under SceneContent > SquareButton. It demonstrates the instantiation and response to a Dialog using the function Launch Dialog. The Dialog can be specified to have a single button, useful for communicating information to the user. The Dialog can also be configured to display two buttons, allowing the user to make a choice. The name of the selected button is returned to the script that opens the Dialog.

An instance of the Dialog is created using:
```
//fill dialogPrefab in the inspector:
[Serialize]
private Dialog dialogPrefab;
//then call:
Dialog dialog = Dialog.Open(dialogPrefab.gameObject, buttons, title, message);

```
The second argument to the Open function defines the caption or captions that the button(s) will have.
They are identified by defining an enumerated value using Dialog.ButtonTypeEnum.
To define two buttons, simply bitwise OR two enumerations:
Expand All @@ -40,7 +40,7 @@ In a LaunchFunction() called by a Coroutine:
## Properties
The Dialog will stay in the user's field of view while the user can use gaze or controller targeting to make a button selection. Tag-along and billboarding interaction is achieved by using **Solver scripts**. When you select Dialog.prefab, you will be able to find Solver scripts for the size and distance control. In **SolverConstantViewSize**, you can adjust **Target View Percent V** value to modify the size of the Dialog window.

You can find more detailed information about the [Solver System on this README page](https://github.com/Microsoft/MixedRealityToolkit-Unity/blob/Dev_Working_Branch/Assets/MixedRealityToolkit-Examples/Utilities/Readme/README_SolverSystem.md).
You can find more detailed information about the [Solver System on this README page](/Assets/MixedRealityToolkit-Examples/Utilities/Readme/README_SolverSystem.md).

<img src="/External/ReadMeImages/MRTK_Dialog_Inspector.jpg" width="450">

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ Different types of Progress control can be opened by pressing these buttons in t

## ProgressIndicator Prefab

The **ProgressIndicator prefab** is located in MixedRealityToolkit/UX/Prefabs/Progress. It is composed of **ProgressIndicator** script and **Solver** scripts for the billboarding and tag-along behavior.
The **ProgressIndicator prefab** is located in [MixedRealityToolkit/UX/Prefabs/Progress](/Assets/MixedRealityToolkit/UX/Prefabs/Progress). It is composed of **ProgressIndicator** script and **Solver** scripts for the billboarding and tag-along behavior.

![ProgressIndicator Properties](/External/ReadMeImages/MRTK_ProgressIndicatorInspector.jpg)

Expand All @@ -41,42 +41,37 @@ In the example scene, each button is labeled with the variation of the ProgressI
In these buttons, you can find **ProgressButton** script along with Compound Button scripts. **ProgressButton** script contains simple code to call LaunchProgress() in **ProgressExamples** script on OnButtonClicked event. In **ProgressExamples** script, you can find the code for displaying Progress control.

It looks like this:
<pre>
```
ProgressIndicator.Instance.Open(
ProgressIndicator.IndicatorStyleEnum.None,
ProgressIndicator.ProgressStyleEnum.None,
ProgressIndicator.MessageStyleEnum.Visible,
LeadInMessage);
StartCoroutine(LoadOverTime(LoadTextMessage));
</pre>

```
The LoadOverTime function, also found in this script, fakes a loading sequence. To implement the ProgressIndicator during an actual loading sequence, Start a Coroutine with a function like LoadOverTime. In your LoadOverTime function, make sure to update the ProgressIndicator object with the actual loading progress.
<pre>
```
while (your loading operation is not complete)
{
LoadingDialog.Instance.SetMessage( <loading progress message> );
LoadingDialog.Instance.SetProgress<percent loaded>
yield return new WaitForSeconds(<amount of time between updates ie 0.25 seconds>);
}
</pre>
```

You can give an optional message to be displayed by the ProgressIndicator when load is complete, such as "finished!".
<pre>
```
ProgressIndicator.Instance.SetMessage(FinishMessage);
ProgressIndicator.Instance.SetProgress(1f);
yield return new WaitForSeconds(<amount of time to hold message ie 1.5 secs>);
</pre>
```

To close the ProgressIndicator, call the Close() function and wait for the IsLoading state to become false.
<pre>
```
LoadingDialog.Instance.Close();
while (LoadingDialog.Instance.IsLoading)
{
yield return null;
}
</pre>




```
102 changes: 30 additions & 72 deletions Assets/MixedRealityToolkit/UX/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,76 +2,34 @@

Useful common UX controls that you can leverage in your application.

### [Materials](Materials)

Materials used in prefabs

#### 3DTextSegoeUI.mat

Material for 3DTextPrefab with occlusion support. Requires 3DTextShader.shader

![Default Font material vs 3DTextSegoeUI material](../../../External/ReadMeImages/TextPrefabInstructions06.png)

### [Prefabs](Prefabs)

Common useful UI prefabs

#### 3DTextPrefab.prefab

3D Text Mesh prefab with optimized scaling factor at 2-meter distance. (Please read the instructions below)

#### UITextPrefab.prefab

UI Text Mesh prefab with optimized scaling factor at 2-meter distance. (Please read the instructions below)

**IMPORTANT: Text Prefab uses open source font 'Selawik'. To use Text Prefab with different font, please import font file and follow the instruction below. Below example shows how to use 'Segoe UI' font with Text Prefab.**

![Importing Segoe UI font file](../../../External/ReadMeImages/TextPrefabInstructions01.png)

1. Assign font texture to 3DTextSegoeUI.mat material.
![Assigning font texture](../../../External/ReadMeImages/TextPrefabInstructions02.png)

2. On 3DTextSegoeUI.mat material, select the shader Custom/3DTextShader.shader.
![Assigning shader](../../../External/ReadMeImages/TextPrefabInstructions03.png)

3. Assign Segoe UI font and 3DTextSegoeUI material to the text components in the prefabs.
![Assigning font file and material](../../../External/ReadMeImages/TextPrefabInstructions04.png)

4. Follow the same steps for the sample text layout prefabs in [MixedRealityToolkit-Examples\Text](../..//MixedRealityToolkit-Examples/Text)
![Sample layout prefabs](../../../External/ReadMeImages/TextPrefabInstructions05.png)

**Working with Fonts in Unity**

When adding a new 3D TextMesh to a scene in Unity there are two issues that are visually apparent. One, the font appears very large and two, the font appears very blurry. It is also interesting to notice that the default Font Size value is set to zero in the Inspector. Replacing this zero value with 13 will show no difference in size, because 13 is actually the default value.

Unity assumes all new elements added to a scene is 1 Unity Unit in size, or 100% Transform scale, which translates to about 1 meter on the HoloLens. In the case of fonts, the bounding box for a 3D TextMesh comes in, by default at about 1 meter in height.

**Font Scale and Font Sizes**

Most visual designers use Points to define font sizes in the real world, as well as their design programs. There are about 2835 (2,834.645666399962) points in 1 meter. Based on the point system conversion to 1 meter and Unity's default TextMesh Font Size of 13, the simple math of 13 divided by 2835 equals 0.0046 (0.004586111116 to be exact) provides a good standard scale to start with, though some may wish to round to 0.005.

Either way, scaling the Text object or container to these values will not only allow for the 1:1 conversion of font sizes from a design program, but also provides a standard to maintain consistency throughout the application or game.

**UI Text**

When adding a UI or canvas based Text element to a scene, the size disparity is greater still. The differences in the two sizes is about 1000%, which would bring the scale factor for UI based Text components to 0.00046 (0.0004586111116 to be exact) or 0.0005 for the rounded value.

**Disclaimer**: The default value of any font may be effected by the texture size of that font or how the font was imported into Unity. These tests were performed based on the default Arial font in Unity, as well as one other imported font.

![Font size with scaling factors](../../../External/ReadMeImages/TextPrefabInstructions07.png)

### [Scripts](Scripts)



## Examples - UI controls and building blocks
| [![Bounding Box and App Bar](/External/ReadMeImages/MRTK_AppBar_BoundingBox.jpg)](/Assets/MixedRealityToolkit-Examples/UX/Readme/README_BoundingBoxGizmoExample.md) [Bounding Box and App Bar](/Assets/MixedRealityToolkit-Examples/UX/Readme/README_BoundingBoxGizmoExample.md) | [![Interactable Objects](/External/ReadMeImages/MRTK_InteractableObject_HolographicButton.jpg)](/Assets/MixedRealityToolkit-Examples/UX/Readme/README_InteractableObjectExample.md) [Interactable Objects](/Assets/MixedRealityToolkit-Examples/UX/Readme/README_InteractableObjectExample.md) | [![Object Collection](/External/ReadMeImages/MRTK_ObjectCollection.jpg)](/Assets/MixedRealityToolkit-Examples/UX/Readme/README_ObjectCollection.md) [Object Collection](/Assets/MixedRealityToolkit-Examples/UX/Readme/README_ObjectCollection.md) |[![Keyboard](/External/ReadMeImages/MRTK_Keyboard.jpg)](/Assets/MixedRealityToolkit-Examples) [Keyboard](/Assets/MixedRealityToolkit-Examples) |
|:--- | :--- | :--- | :--- |
| Standard UI for manipulating objects in 3D space | Modular script for making objects interactable with visual states, including Holographic button | Script for lay out an array of objects in a three-dimensional shape | System style keyboard prefab for Unity projects |
| ![Dialog and Progress](/External/ReadMeImages/MRTK_DialogProgress.jpg) [Dialog](/Assets/MixedRealityToolkit-Examples/UX/Readme/README_DialogsExample.md) / [Progress](/Assets/MixedRealityToolkit-Examples/UX/Readme/README_ProgressExample.md) | [![Solver system](/External/ReadMeImages/MRTK_SolverSystem.jpg)](/Assets/MixedRealityToolkit-Examples/Utilities/Readme/README_SolverSystem.md) [Solver system](/Assets/MixedRealityToolkit-Examples/Utilities/Readme/README_SolverSystem.md) | [![Interactive button demos](/External/ReadMeImages/MRTK_InteractiveButtons.jpg)](/Assets/MixedRealityToolkit-Examples/UX/Readme/README_InteractiveButtonComponents.md) [Interactive button demos](/Assets/MixedRealityToolkit-Examples/UX/Readme/README_InteractiveButtonComponents.md) | [![ToolTip & Label](/External/ReadMeImages/MRTK_Tooltip.jpg)](/Assets/MixedRealityToolkit-Examples/UX/Readme/README_TooltipExample.md) [ToolTip & Label](/Assets/MixedRealityToolkit-Examples/UX/Readme/README_TooltipExample.md) |
| Standard UI for notification, approval, or additional information from the user / Data loading indicator | Scripts for various behavious such as tag-along, billboarding, body-lock, constant view size and surface magnetism | UWP style UI controls including radio, toggle and checkboxes | Annotation UI with flexible anchor/pivot system which can be used for labeling motion controllers and object. |


## [Audio](Audio)
Audio files used in Mixed Reality Toolkit.

## [Fonts](Fonts)
Open-source fonts used in Mixed Reality Toolkit. Selawik is Microsoft's open-source font. Please see [Text Prefab README](/Assets/MixedRealityToolkit/UX/README_TextPrefab.md) for more information about optimized text.

## [Materials](Materials)
Materials used in prefabs. You can find default color materials made with MixedRealityToolkit/Standard shader.

## [Scripts](Scripts)
Scripts for UI controls and building blocks. This folder includes the scripts for Bounding Box & App Bar, Interactable Object(Compound Button series), Object Collections, Interaction Receivers, Distorters, Lines and Tooltip. Please see example scenes for the detailed usage.

## [Prefabs](Prefabs)
### AppBar
Prefabs for [App Bar](/Assets/MixedRealityToolkit-Examples/UX/Readme/README_BoundingBoxGizmoExample.md)
### BoundingBoxes
Prefabs for [Bounding Box](/Assets/MixedRealityToolkit-Examples/UX/Readme/README_BoundingBoxGizmoExample.md)
### Buttons
Prefabs for [Interactable Object](/Assets/MixedRealityToolkit-Examples/UX/Readme/README_InteractableObjectExample.md)
This folder includes [Holographic Button Prefab](/Assets/MixedRealityToolkit/UX/Prefabs/Buttons/HolographicButton.prefab)
![Holographic Button](/External/ReadMeImages/MRTK_InteractableObject_HolographicButton.jpg)
### [Shaders](Shaders)

Materials used in prefabs

#### 3DTextShader.shader

Shader for 3DTextPrefab with occlusion support.

---
##### [Go back up to the table of contents.](../../../README.md)
---
Shaders used in prefabs
62 changes: 62 additions & 0 deletions Assets/MixedRealityToolkit/UX/README_TextPrefab.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
# Text Prefab
These prefabs are optimized for the rendering quality in Windows Mixed Reality. For more information, please read the guideline [Text in Unity](https://docs.microsoft.com/en-us/windows/mixed-reality/text-in-unity) on Microsoft Windows Dev Center.

#### [3DTextPrefab.prefab](/Assets/MixedRealityToolkit/UX/Prefabs/3DTextPrefab.prefab)

3D Text Mesh prefab with optimized scaling factor at 2-meter distance. (Please read the instructions below)

#### [UITextPrefab.prefab](/Assets/MixedRealityToolkit/UX/Prefabs/UITextPrefab.prefab)

UI Text Mesh prefab with optimized scaling factor at 2-meter distance. (Please read the instructions below)

#### [Fonts](/Assets/MixedRealityToolkit/UX/Fonts)

Open-source fonts included in Mixed Reality Toolkit.


**IMPORTANT: Text Prefab uses open source font 'Selawik'. To use Text Prefab with different font, please import font file and follow the instruction below. Below example shows how to use 'Segoe UI' font with Text Prefab.**

![Importing Segoe UI font file](/External/ReadMeImages/TextPrefabInstructions01.png)

1. Assign font texture to 3DTextSegoeUI.mat material.
![Assigning font texture](/External/ReadMeImages/TextPrefabInstructions02.png)

2. On 3DTextSegoeUI.mat material, select the shader Custom/3DTextShader.shader.
![Assigning shader](/External/ReadMeImages/TextPrefabInstructions03.png)

3. Assign Segoe UI font and 3DTextSegoeUI material to the text components in the prefabs.
![Assigning font file and material](/External/ReadMeImages/TextPrefabInstructions04.png)

4. Follow the same steps for the sample text layout prefabs in [MixedRealityToolkit-Examples\Text](/Assets/MixedRealityToolkit-Examples/UX/Prefabs)
![Sample layout prefabs](/External/ReadMeImages/TextPrefabInstructions05.png)

**Working with Fonts in Unity**

When adding a new 3D TextMesh to a scene in Unity there are two issues that are visually apparent. One, the font appears very large and two, the font appears very blurry. It is also interesting to notice that the default Font Size value is set to zero in the Inspector. Replacing this zero value with 13 will show no difference in size, because 13 is actually the default value.

Unity assumes all new elements added to a scene is 1 Unity Unit in size, or 100% Transform scale, which translates to about 1 meter on the HoloLens. In the case of fonts, the bounding box for a 3D TextMesh comes in, by default at about 1 meter in height.

**Font Scale and Font Sizes**

Most visual designers use Points to define font sizes in the real world, as well as their design programs. There are about 2835 (2,834.645666399962) points in 1 meter. Based on the point system conversion to 1 meter and Unity's default TextMesh Font Size of 13, the simple math of 13 divided by 2835 equals 0.0046 (0.004586111116 to be exact) provides a good standard scale to start with, though some may wish to round to 0.005.

Either way, scaling the Text object or container to these values will not only allow for the 1:1 conversion of font sizes from a design program, but also provides a standard to maintain consistency throughout the application or game.

**UI Text**

When adding a UI or canvas based Text element to a scene, the size disparity is greater still. The differences in the two sizes is about 1000%, which would bring the scale factor for UI based Text components to 0.00046 (0.0004586111116 to be exact) or 0.0005 for the rounded value.

**Disclaimer**: The default value of any font may be effected by the texture size of that font or how the font was imported into Unity. These tests were performed based on the default Arial font in Unity, as well as one other imported font.

![Font size with scaling factors](/External/ReadMeImages/TextPrefabInstructions07.png)

### [3DTextSelawik.mat](/Assets/MixedRealityToolkit/UX/Fonts/3DTextSelawik.mat)

Material for 3DTextPrefab with occlusion support. Requires 3DTextShader.shader

![Default Font material vs 3DTextSegoeUI material](/External/ReadMeImages/TextPrefabInstructions06.png)


### [3DTextShader.shader](/Assets/MixedRealityToolkit/UX/Shaders/3DTextShader.shader)

Shader for 3DTextPrefab with occlusion support.
Binary file added External/ReadMeImages/MRTK_SpatialMapping.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added External/ReadMeImages/MRTK_SpatialProcessing.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 77f1404

Please sign in to comment.