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

[May18] Surface Magnetism + Spatial Processing example scene #2113

Merged
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

Large diffs are not rendered by default.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Spatial Processing + Solver Surface Magnetism example
This example shows how to make objects smoothly align with the physical surface. For more information about Spatial Processing and Solver system, please read these README files.
- [Spatial Processing](/Assets/HoloToolkit/SpatialMapping/README.md)
- [Solver System](/Assets/HoloToolkit-Examples/Utilities/Readme/README_SolverSystem.md)

## Demo Video
https://gfycat.com/PitifulRareKodiakbear

## Scene
[SpatialProcessingSurfaceMagnetism.unity](/Assets/HoloToolkit-Examples/SpatialMapping/Scenes/SpatialProcessingSurfaceMagnetism.unity)

## How to use
You need to assign same Unity layer to the Spatial mapping’s plane and Solver Surface Magnetism’s Magnetic Surface.

1. Add a new layer for the planes created by Spatial Processing. (to snap to) This example shows a new layer named ‘SpatialProcessingPlane’
<img src="/External/ReadMeImages/MRTK_SurfaceMagnetism1.png" width="550">
<img src="/External/ReadMeImages/MRTK_SurfaceMagnetism2.png" width="550">

2. In SpatialMapping prefab, change Physics Layer to the new layer number. In this example, the new layer is 8
<img src="/External/ReadMeImages/MRTK_SurfaceMagnetism3.png" width="550">

3. Assign SolverSurfaceMagnetism script to an object. In Magnetic Surface option, select the new layer (SpatialProcessingPlane) that you created.
<img src="/External/ReadMeImages/MRTK_SurfaceMagnetism4.png" width="550">

4. After initial room scanning, you will be able to see MRTK logo plane is smoothly snapping to the surfaces.



5 changes: 3 additions & 2 deletions Assets/HoloToolkit/SpatialMapping/Materials/Wireframe.mat
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ Material:
m_ShaderKeywords: ETC1_EXTERNAL_ALPHA
m_LightmapFlags: 5
m_EnableInstancingVariants: 0
m_DoubleSidedGI: 0
m_CustomRenderQueue: 2000
stringTagMap: {}
disabledShaderPasses: []
Expand Down Expand Up @@ -72,7 +73,7 @@ Material:
- _WireThickness: 100
- _ZWrite: 1
m_Colors:
- _BaseColor: {r: 0, g: 0, b: 0, a: 1}
- _BaseColor: {r: 0.0036224083, g: 0.24982113, b: 0.49264705, a: 1}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we be editing the base material, or using a copy for our example?

May need to revert.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed. Why was the color changed?

Copy link
Contributor Author

@cre8ivepark cre8ivepark May 17, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, I wanted to update default white to more similar to what we have in Fragments (changed it to blue)
Original:
2018-05-17 10_05_49-photos
Updated:
2018-05-17 10_06_13-photos

2018-05-17 10_14_00-

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can duplicate with a new name 'WireframeBlue.mat' if we want. and assign it to SpatialMapping prefab as a default material.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please do duplicate the material. Changing the color can cause confusion with customers.

Thanks!

- _Color: {r: 1, g: 1, b: 1, a: 1}
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
- _WireColor: {r: 1, g: 1, b: 1, a: 1}
- _WireColor: {r: 0, g: 0.66896534, b: 1, a: 1}
134 changes: 134 additions & 0 deletions Assets/HoloToolkit/UX/Materials/MRTK_SpatialProcessing_Transparent.mat
Original file line number Diff line number Diff line change
@@ -0,0 +1,134 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!21 &2100000
Material:
serializedVersion: 6
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_Name: MRTK_SpatialProcessing_Transparent
m_Shader: {fileID: 4800000, guid: d45c0efca53019e43891b0f610f8146e, type: 3}
m_ShaderKeywords: _ALPHABLEND_ON _BORDER_LIGHT_USES_HOVER_COLOR _DISABLE_ALBEDO_MAP
_HOVER_COLOR_OVERRIDE _LIGHTMAPPING_REALTIME _SPECULAR_HIGHLIGHTS
m_LightmapFlags: 1
m_EnableInstancingVariants: 1
m_DoubleSidedGI: 0
m_CustomRenderQueue: 3000
stringTagMap:
RenderType: Transparent
disabledShaderPasses: []
m_SavedProperties:
serializedVersion: 3
m_TexEnvs:
- _BumpMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailAlbedoMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailMask:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailNormalMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _EmissionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MainTex:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MetallicGlossMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _NormalMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _OcclusionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _ParallaxMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Floats:
- _AlbedoAlphaMode: 0
- _BlendOp: 0
- _BorderLight: 0
- _BorderLightOpaque: 0
- _BorderLightUsesHoverColor: 1
- _BorderMinValue: 0.1
- _BorderWidth: 0.532
- _BumpScale: 1
- _ClippingPlane: 0
- _ClippingPlaneBorder: 0
- _ClippingPlaneBorderWidth: 0.025
- _ColorWriteMask: 15
- _CullMode: 2
- _CustomMode: 2
- _Cutoff: 0.5
- _DetailNormalMapScale: 1
- _DirectionalLight: 0
- _DstBlend: 10
- _EdgeSmoothingValue: 0.002
- _EmissionScaleUI: 0
- _EnableEmission: 0
- _EnableHoverColorOpaqueOverride: 0
- _EnableHoverColorOverride: 1
- _EnableNormalMap: 0
- _EnvironmentColorIntensity: 0.5
- _EnvironmentColorThreshold: 1.5
- _EnvironmentColoring: 0
- _FadeBeginDistance: 0.85
- _FadeCompleteDistance: 0.5
- _GlossMapScale: 1
- _Glossiness: 0
- _GlossyReflections: 1
- _HoverLight: 0
- _HoverLightOpaque: 0
- _InnerGlow: 0
- _Lightmapping: 1
- _Metallic: 0
- _Mode: 2
- _NearPlaneFade: 0
- _OcclusionStrength: 1
- _Parallax: 0.02
- _Reflections: 0
- _Refraction: 0
- _RefractiveIndex: 1.1
- _RenderQueueOverride: -1
- _RimLight: 0
- _RimPower: 0.25
- _RoundCornerMargin: 0
- _RoundCornerRadius: 0.25
- _RoundCorners: 0
- _Smoothness: 0.5
- _SmoothnessTextureChannel: 0
- _SpecularHighlights: 1
- _SrcBlend: 5
- _UVSec: 0
- _ZTest: 4
- _ZWrite: 0
m_Colors:
- _ClipPlane: {r: 0, g: 1, b: 0, a: 0}
- _ClippingPlaneBorderColor: {r: 1, g: 0.2, b: 0, a: 1}
- _Color: {r: 0, g: 0, b: 0, a: 0}
- _EmissionColor: {r: 0, g: 0, b: 0, a: 0}
- _EmissionColorUI: {r: 1, g: 1, b: 1, a: 1}
- _EmissiveColor: {r: 0, g: 0, b: 0, a: 1}
- _EnvironmentColorX: {r: 1, g: 0, b: 0, a: 1}
- _EnvironmentColorY: {r: 0, g: 1, b: 0, a: 1}
- _EnvironmentColorZ: {r: 0, g: 0, b: 1, a: 1}
- _HoverColorOpaqueOverride: {r: 1, g: 1, b: 1, a: 1}
- _HoverColorOverride: {r: 1, g: 1, b: 1, a: 1}
- _InnerGlowColor: {r: 1, g: 1, b: 1, a: 0.75}
- _RimColor: {r: 0.5, g: 0.5, b: 0.5, a: 1}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

134 changes: 134 additions & 0 deletions Assets/HoloToolkit/UX/Materials/MRTK_SpatialProcessing_Wall.mat
Original file line number Diff line number Diff line change
@@ -0,0 +1,134 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!21 &2100000
Material:
serializedVersion: 6
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_Name: MRTK_SpatialProcessing_Wall
m_Shader: {fileID: 4800000, guid: d45c0efca53019e43891b0f610f8146e, type: 3}
m_ShaderKeywords: _BORDER_LIGHT _BORDER_LIGHT_USES_HOVER_COLOR _DISABLE_ALBEDO_MAP
_HOVER_COLOR_OVERRIDE _LIGHTMAPPING_REALTIME _SPECULAR_HIGHLIGHTS
m_LightmapFlags: 1
m_EnableInstancingVariants: 1
m_DoubleSidedGI: 0
m_CustomRenderQueue: 2000
stringTagMap:
RenderType: Opaque
disabledShaderPasses: []
m_SavedProperties:
serializedVersion: 3
m_TexEnvs:
- _BumpMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailAlbedoMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailMask:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailNormalMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _EmissionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MainTex:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MetallicGlossMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _NormalMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _OcclusionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _ParallaxMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Floats:
- _AlbedoAlphaMode: 0
- _BlendOp: 0
- _BorderLight: 1
- _BorderLightOpaque: 0
- _BorderLightUsesHoverColor: 1
- _BorderMinValue: 0.1
- _BorderWidth: 0.532
- _BumpScale: 1
- _ClippingPlane: 0
- _ClippingPlaneBorder: 0
- _ClippingPlaneBorderWidth: 0.025
- _ColorWriteMask: 15
- _CullMode: 2
- _CustomMode: 0
- _Cutoff: 0.5
- _DetailNormalMapScale: 1
- _DirectionalLight: 0
- _DstBlend: 0
- _EdgeSmoothingValue: 0.002
- _EmissionScaleUI: 0
- _EnableEmission: 0
- _EnableHoverColorOpaqueOverride: 0
- _EnableHoverColorOverride: 1
- _EnableNormalMap: 0
- _EnvironmentColorIntensity: 0.5
- _EnvironmentColorThreshold: 1.5
- _EnvironmentColoring: 0
- _FadeBeginDistance: 0.85
- _FadeCompleteDistance: 0.5
- _GlossMapScale: 1
- _Glossiness: 0
- _GlossyReflections: 1
- _HoverLight: 0
- _HoverLightOpaque: 0
- _InnerGlow: 0
- _Lightmapping: 1
- _Metallic: 0
- _Mode: 0
- _NearPlaneFade: 0
- _OcclusionStrength: 1
- _Parallax: 0.02
- _Reflections: 0
- _Refraction: 0
- _RefractiveIndex: 1.1
- _RenderQueueOverride: -1
- _RimLight: 0
- _RimPower: 0.25
- _RoundCornerMargin: 0
- _RoundCornerRadius: 0.25
- _RoundCorners: 0
- _Smoothness: 0.5
- _SmoothnessTextureChannel: 0
- _SpecularHighlights: 1
- _SrcBlend: 1
- _UVSec: 0
- _ZTest: 4
- _ZWrite: 1
m_Colors:
- _ClipPlane: {r: 0, g: 1, b: 0, a: 0}
- _ClippingPlaneBorderColor: {r: 1, g: 0.2, b: 0, a: 1}
- _Color: {r: 0.017463237, g: 0.0894016, b: 0.125, a: 1}
- _EmissionColor: {r: 0, g: 0, b: 0, a: 0}
- _EmissionColorUI: {r: 1, g: 1, b: 1, a: 1}
- _EmissiveColor: {r: 0, g: 0, b: 0, a: 1}
- _EnvironmentColorX: {r: 1, g: 0, b: 0, a: 1}
- _EnvironmentColorY: {r: 0, g: 1, b: 0, a: 1}
- _EnvironmentColorZ: {r: 0, g: 0, b: 1, a: 1}
- _HoverColorOpaqueOverride: {r: 1, g: 1, b: 1, a: 1}
- _HoverColorOverride: {r: 1, g: 1, b: 1, a: 1}
- _InnerGlowColor: {r: 1, g: 1, b: 1, a: 0.75}
- _RimColor: {r: 0.5, g: 0.5, b: 0.5, a: 1}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file added External/ReadMeImages/MRTK_SurfaceMagnetism1.png
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_SurfaceMagnetism2.png
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_SurfaceMagnetism3.png
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_SurfaceMagnetism4.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.